Allow user to change scan always available setting

Bug: 8141918
Change-Id: I3595812eccf5f7760f7521b9cbe6dece6fd658f1
This commit is contained in:
Irfan Sheriff
2013-03-12 17:57:57 -07:00
parent 22ace5059a
commit 1019ec10e3
3 changed files with 19 additions and 0 deletions

View File

@@ -1270,6 +1270,10 @@
<string name="wifi_poor_network_detection">Avoid poor connections</string> <string name="wifi_poor_network_detection">Avoid poor connections</string>
<!-- Checkbox summary for option to toggle poor network detection --> <!-- Checkbox summary for option to toggle poor network detection -->
<string name="wifi_poor_network_detection_summary">Don\'t use a Wi\u2011Fi network unless it has a good Internet connection</string> <string name="wifi_poor_network_detection_summary">Don\'t use a Wi\u2011Fi network unless it has a good Internet connection</string>
<!-- Checkbox title for option to scan always available setting -->
<string name="wifi_scan_always_available">Scanning always available</string>
<!-- Checkbox summary for option to toggle scan always available setting -->
<string name="wifi_scan_always_available_summary">Let Google\'s location service and other apps scan for networks, even when Wi-Fi is off</string>
<!-- Setting title for setting the wifi sleep policy. Do we keep Wi-Fi active when the screen turns off? --> <!-- Setting title for setting the wifi sleep policy. Do we keep Wi-Fi active when the screen turns off? -->
<string name="wifi_setting_sleep_policy_title">Keep Wi\u2011Fi on during sleep</string> <string name="wifi_setting_sleep_policy_title">Keep Wi\u2011Fi on during sleep</string>
<!-- Generic error message when the sleep policy could not be set. --> <!-- Generic error message when the sleep policy could not be set. -->

View File

@@ -31,6 +31,11 @@
android:entries="@array/wifi_sleep_policy_entries" android:entries="@array/wifi_sleep_policy_entries"
android:entryValues="@array/wifi_sleep_policy_values" android:entryValues="@array/wifi_sleep_policy_values"
/> />
<CheckBoxPreference
android:key="wifi_scan_always_available"
android:title="@string/wifi_scan_always_available"
android:summary="@string/wifi_scan_always_available_summary"
android:persistent="false" />
<!-- android:dependency="enable_wifi" --> <!-- android:dependency="enable_wifi" -->
<CheckBoxPreference <CheckBoxPreference

View File

@@ -45,6 +45,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
private static final String KEY_NOTIFY_OPEN_NETWORKS = "notify_open_networks"; 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_SLEEP_POLICY = "sleep_policy";
private static final String KEY_POOR_NETWORK_DETECTION = "wifi_poor_network_detection"; private static final String KEY_POOR_NETWORK_DETECTION = "wifi_poor_network_detection";
private static final String KEY_SCAN_ALWAYS_AVAILABLE = "wifi_scan_always_available";
private static final String KEY_SUSPEND_OPTIMIZATIONS = "suspend_optimizations"; private static final String KEY_SUSPEND_OPTIMIZATIONS = "suspend_optimizations";
private WifiManager mWifiManager; private WifiManager mWifiManager;
@@ -88,6 +89,11 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
} }
} }
CheckBoxPreference scanAlwaysAvailable =
(CheckBoxPreference) findPreference(KEY_SCAN_ALWAYS_AVAILABLE);
scanAlwaysAvailable.setChecked(Global.getInt(getContentResolver(),
Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1);
CheckBoxPreference suspendOptimizations = CheckBoxPreference suspendOptimizations =
(CheckBoxPreference) findPreference(KEY_SUSPEND_OPTIMIZATIONS); (CheckBoxPreference) findPreference(KEY_SUSPEND_OPTIMIZATIONS);
suspendOptimizations.setChecked(Global.getInt(getContentResolver(), suspendOptimizations.setChecked(Global.getInt(getContentResolver(),
@@ -167,6 +173,10 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
Global.putInt(getContentResolver(), Global.putInt(getContentResolver(),
Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED,
((CheckBoxPreference) preference).isChecked() ? 1 : 0); ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
} else if (KEY_SCAN_ALWAYS_AVAILABLE.equals(key)) {
Global.putInt(getContentResolver(),
Global.WIFI_SCAN_ALWAYS_AVAILABLE,
((CheckBoxPreference) preference).isChecked() ? 1 : 0);
} else { } else {
return super.onPreferenceTreeClick(screen, preference); return super.onPreferenceTreeClick(screen, preference);
} }