summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-05-31 11:15:41 -0700
committerIrfan Sheriff <isheriff@google.com>2012-05-31 11:15:41 -0700
commitf0780a7cad2bb8f430d5766115f7f9f50698cfb3 (patch)
tree75a8f288d84ba398887e0546fe417828ce765673
parenta5ac7ce5149ea3f6f4b27259cd9fd4a23b7ac47a (diff)
downloadpackages_apps_settings-f0780a7cad2bb8f430d5766115f7f9f50698cfb3.zip
packages_apps_settings-f0780a7cad2bb8f430d5766115f7f9f50698cfb3.tar.gz
packages_apps_settings-f0780a7cad2bb8f430d5766115f7f9f50698cfb3.tar.bz2
Fix poor network detection setting
We used to base this on watchdog being turned on, but it should be based on whether device is wifi only Bug: 6576101 Change-Id: Ib5221287e6713c625d39ef986ceb278825fb4895
-rw-r--r--res/values/strings.xml8
-rw-r--r--res/xml/wifi_advanced_settings.xml6
-rw-r--r--src/com/android/settings/wifi/AdvancedWifiSettings.java20
3 files changed, 16 insertions, 18 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6f1bdad..8005059 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1198,10 +1198,10 @@
<string name="wifi_notify_open_networks">Network notification</string>
<!-- Checkbox summary for option to notify user when open networks are nearby -->
<string name="wifi_notify_open_networks_summary">Notify me when an open network is available</string>
- <!-- Checkbox title for option to toggle wifi watchdog service -->
- <string name="wifi_enable_watchdog_service">Avoid poor connections</string>
- <!-- Checkbox summary for option to toggle wifi watchdog service -->
- <string name="wifi_enable_watchdog_service_summary">Don\'t use a Wi-Fi network unless it has a good Internet connection</string>
+ <!-- Checkbox title for option to toggle poor network detection -->
+ <string name="wifi_poor_network_detection">Avoid poor connections</string>
+ <!-- Checkbox summary for option to toggle poor network detection -->
+ <string name="wifi_poor_network_detection_summary">Don\'t use a Wi-Fi network unless it has a good Internet connection</string>
<!-- 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-Fi on during sleep</string>
<!-- Generic error message when the sleep policy could not be set. -->
diff --git a/res/xml/wifi_advanced_settings.xml b/res/xml/wifi_advanced_settings.xml
index d500ff2..3000666 100644
--- a/res/xml/wifi_advanced_settings.xml
+++ b/res/xml/wifi_advanced_settings.xml
@@ -34,9 +34,9 @@
<!-- android:dependency="enable_wifi" -->
<CheckBoxPreference
- android:key="wifi_enable_watchdog_service"
- android:title="@string/wifi_enable_watchdog_service"
- android:summary="@string/wifi_enable_watchdog_service_summary"
+ android:key="wifi_poor_network_detection"
+ android:title="@string/wifi_poor_network_detection"
+ android:summary="@string/wifi_poor_network_detection_summary"
android:persistent="false" />
<ListPreference
diff --git a/src/com/android/settings/wifi/AdvancedWifiSettings.java b/src/com/android/settings/wifi/AdvancedWifiSettings.java
index d8a4080..bb50d2a 100644
--- a/src/com/android/settings/wifi/AdvancedWifiSettings.java
+++ b/src/com/android/settings/wifi/AdvancedWifiSettings.java
@@ -43,7 +43,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
private static final String KEY_FREQUENCY_BAND = "frequency_band";
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_ENABLE_WIFI_WATCHDOG = "wifi_enable_watchdog_service";
+ private static final String KEY_POOR_NETWORK_DETECTION = "wifi_poor_network_detection";
private WifiManager mWifiManager;
@@ -73,16 +73,14 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
notifyOpenNetworks.setEnabled(mWifiManager.isWifiEnabled());
- boolean watchdogEnabled = Secure.getInt(getContentResolver(),
- Secure.WIFI_WATCHDOG_ON, 1) != 0;
- CheckBoxPreference watchdog =
- (CheckBoxPreference) findPreference(KEY_ENABLE_WIFI_WATCHDOG);
- if (watchdog != null) {
- if (watchdogEnabled) {
- watchdog.setChecked(Secure.getInt(getContentResolver(),
- Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 1) == 1);
+ CheckBoxPreference poorNetworkDetection =
+ (CheckBoxPreference) findPreference(KEY_POOR_NETWORK_DETECTION);
+ if (poorNetworkDetection != null) {
+ if (Utils.isWifiOnly(getActivity())) {
+ getPreferenceScreen().removePreference(poorNetworkDetection);
} else {
- getPreferenceScreen().removePreference(watchdog);
+ poorNetworkDetection.setChecked(Secure.getInt(getContentResolver(),
+ Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 1) == 1);
}
}
@@ -146,7 +144,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
Secure.putInt(getContentResolver(),
Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
((CheckBoxPreference) preference).isChecked() ? 1 : 0);
- } else if (KEY_ENABLE_WIFI_WATCHDOG.equals(key)) {
+ } else if (KEY_POOR_NETWORK_DETECTION.equals(key)) {
Secure.putInt(getContentResolver(),
Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
((CheckBoxPreference) preference).isChecked() ? 1 : 0);