Adding a new config and Setting for WiFi Wakeup.
Created a new config for WiFi Wakeup (config_wifi_wakeup_available)
and defaulted it to NOT_AVAILABLE.
Also added a new global Settings constant (WIFI_WAKEUP_AVAILABLE)
and defaulted it to the value of the new config noted above.
Bug: 37987491
Bug: 38036968
Test: Built, flashed and confirmed proper config value.
Test: runtest --path frameworks/base/core/tests/coretests/src/android/provider/SettingsProviderTest.java
Change-Id: I0cdca4262a0ef473fcbbf7da8d960c41dfafb11f
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 0840549..dd7faac 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8315,6 +8315,17 @@
public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
/**
+ * Value to specify if Wi-Fi Wakeup is available.
+ *
+ * Wi-Fi Wakeup will only operate if it's available
+ * and {@link #WIFI_WAKEUP_ENABLED} is true.
+ *
+ * Type: int (0 for false, 1 for true)
+ * @hide
+ */
+ public static final String WIFI_WAKEUP_AVAILABLE = "wifi_wakeup_available";
+
+ /**
* Value to specify whether network quality scores and badging should be shown in the UI.
*
* Type: int (0 for false, 1 for true)
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index aeb564b..bdc7666 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -393,6 +393,12 @@
<!-- Activity name to enable wifi tethering after provisioning app succeeds -->
<string translatable="false" name="config_wifi_tether_enable">com.android.settings/.TetherService</string>
+ <!-- Controls the WiFi wakeup feature.
+ 0 = Not available.
+ 1 = Available.
+ -->
+ <integer translatable="false" name="config_wifi_wakeup_available">0</integer>
+
<!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
<!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
<!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index cff6eb1..586b6dd 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2085,6 +2085,7 @@
<java-symbol type="string" name="config_mobile_hotspot_provision_response" />
<java-symbol type="integer" name="config_mobile_hotspot_provision_check_period" />
<java-symbol type="string" name="config_wifi_tether_enable" />
+ <java-symbol type="integer" name="config_wifi_wakeup_available" />
<java-symbol type="bool" name="config_intrusiveNotificationLed" />
<java-symbol type="dimen" name="preference_fragment_padding_bottom" />
<java-symbol type="dimen" name="preference_fragment_padding_side" />
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 4b304b2..502d658 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2872,7 +2872,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 144;
+ private static final int SETTINGS_VERSION = 145;
private final int mUserId;
@@ -3454,6 +3454,25 @@
currentVersion = 144;
}
+ if (currentVersion == 144) {
+ // Version 145: Set the default value for WIFI_WAKEUP_AVAILABLE.
+ if (userId == UserHandle.USER_SYSTEM) {
+ final SettingsState globalSettings = getGlobalSettingsLocked();
+ final Setting currentSetting = globalSettings.getSettingLocked(
+ Settings.Global.WIFI_WAKEUP_AVAILABLE);
+ if (currentSetting.isNull()) {
+ final int defaultValue = getContext().getResources().getInteger(
+ com.android.internal.R.integer.config_wifi_wakeup_available);
+ globalSettings.insertSettingLocked(
+ Settings.Global.WIFI_WAKEUP_AVAILABLE,
+ String.valueOf(defaultValue),
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ }
+
+ currentVersion = 145;
+ }
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {