Bring back Wi-Fi sleep policy setting for wifi-only devices.
Have a different set of strings, since we cannot mention mobile data for a wifi-only device. Bug: 3487952 Change-Id: I486315da40f15807f75d85d2a077a6b234a1e3d7
This commit is contained in:
@@ -313,6 +313,17 @@
|
||||
<item>Never (uses more battery power)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Wi-Fi settings. Presented as a list dialog to the user to choose the Wi-Fi sleep policy. Used when
|
||||
the device is Wi-Fi-only. [CHAR LIMIT=30] -->
|
||||
<string-array name="wifi_sleep_policy_entries_wifi_only">
|
||||
<!-- Wi-Fi should go to sleep when the screen turns off, for Wi-Fi-only devices. -->
|
||||
<item>When screen turns off</item>
|
||||
<!-- When plugged in, never go to sleep. When on battery, go to sleep when screen turns off. -->
|
||||
<item>Never when plugged in</item>
|
||||
<!-- Never go to sleep. -->
|
||||
<item>Never (uses more battery power)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Match with wifi_sleep_policy_entries and the values of the settings in Settings class. --> <skip />
|
||||
<!-- Do not translate. -->
|
||||
<string-array name="wifi_sleep_policy_values">
|
||||
|
@@ -213,14 +213,13 @@ public class WifiSettings extends SettingsPreferenceFragment
|
||||
ListPreference pref = (ListPreference) findPreference(KEY_SLEEP_POLICY);
|
||||
if (pref != null) {
|
||||
if (Utils.isWifiOnly()) {
|
||||
getPreferenceScreen().removePreference(pref);
|
||||
} else {
|
||||
pref.setOnPreferenceChangeListener(this);
|
||||
int value = Settings.System.getInt(getContentResolver(),
|
||||
Settings.System.WIFI_SLEEP_POLICY,
|
||||
Settings.System.WIFI_SLEEP_POLICY_NEVER);
|
||||
pref.setValue(String.valueOf(value));
|
||||
pref.setEntries(R.array.wifi_sleep_policy_entries_wifi_only);
|
||||
}
|
||||
pref.setOnPreferenceChangeListener(this);
|
||||
int value = Settings.System.getInt(getContentResolver(),
|
||||
Settings.System.WIFI_SLEEP_POLICY,
|
||||
Settings.System.WIFI_SLEEP_POLICY_NEVER);
|
||||
pref.setValue(String.valueOf(value));
|
||||
}
|
||||
|
||||
registerForContextMenu(getListView());
|
||||
|
Reference in New Issue
Block a user