Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0780a7c authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

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
parent a5ac7ce5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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. -->
+3 −3
Original line number Diff line number Diff line
@@ -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
+9 −11
Original line number Diff line number Diff line
@@ -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);