Setting to turn off power optimizations
Bug: 5885175 Change-Id: I55bfabdffea95d151af6bb4d9da9137124bcb763
This commit is contained in:
@@ -1212,6 +1212,10 @@
|
||||
<string name="wifi_setting_sleep_policy_title">Keep Wi-Fi on during sleep</string>
|
||||
<!-- Generic error message when the sleep policy could not be set. -->
|
||||
<string name="wifi_setting_sleep_policy_error">There was a problem changing the setting</string>
|
||||
<!-- Checkbox title for option to toggle suspend power optimizations -->
|
||||
<string name="wifi_suspend_optimizations">Power save</string>
|
||||
<!-- Checkbox summary for option to toggle suspend power optimizations -->
|
||||
<string name="wifi_suspend_optimizations_summary">Save power when screen is turned off</string>
|
||||
<!-- Action bar text message to manually add a wifi network [CHAR LIMIT=20]-->
|
||||
<string name="wifi_add_network">Add network</string>
|
||||
<!-- Header for the list of wifi networks-->
|
||||
|
@@ -47,6 +47,12 @@
|
||||
android:entries="@array/wifi_frequency_band_entries"
|
||||
android:entryValues="@array/wifi_frequency_band_values"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="suspend_optimizations"
|
||||
android:title="@string/wifi_suspend_optimizations"
|
||||
android:summary="@string/wifi_suspend_optimizations_summary"
|
||||
android:persistent="false" />
|
||||
|
||||
<Preference android:key="mac_address"
|
||||
style="?android:attr/preferenceInformationStyle"
|
||||
|
@@ -44,6 +44,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
|
||||
private static final String KEY_NOTIFY_OPEN_NETWORKS = "notify_open_networks";
|
||||
private static final String KEY_SLEEP_POLICY = "sleep_policy";
|
||||
private static final String KEY_POOR_NETWORK_DETECTION = "wifi_poor_network_detection";
|
||||
private static final String KEY_SUSPEND_OPTIMIZATIONS = "suspend_optimizations";
|
||||
|
||||
private WifiManager mWifiManager;
|
||||
|
||||
@@ -84,6 +85,11 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
CheckBoxPreference suspendOptimizations =
|
||||
(CheckBoxPreference) findPreference(KEY_SUSPEND_OPTIMIZATIONS);
|
||||
suspendOptimizations.setChecked(Secure.getInt(getContentResolver(),
|
||||
Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
|
||||
|
||||
ListPreference frequencyPref = (ListPreference) findPreference(KEY_FREQUENCY_BAND);
|
||||
|
||||
if (mWifiManager.isDualBandSupported()) {
|
||||
@@ -148,6 +154,10 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
|
||||
Secure.putInt(getContentResolver(),
|
||||
Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
|
||||
((CheckBoxPreference) preference).isChecked() ? 1 : 0);
|
||||
} else if (KEY_SUSPEND_OPTIMIZATIONS.equals(key)) {
|
||||
Secure.putInt(getContentResolver(),
|
||||
Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED,
|
||||
((CheckBoxPreference) preference).isChecked() ? 1 : 0);
|
||||
} else {
|
||||
return super.onPreferenceTreeClick(screen, preference);
|
||||
}
|
||||
|
Reference in New Issue
Block a user