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

Commit 1019ec10 authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

Allow user to change scan always available setting

Bug: 8141918
Change-Id: I3595812eccf5f7760f7521b9cbe6dece6fd658f1
parent 22ace505
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1270,6 +1270,10 @@
    <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\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? -->
    <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. -->
+5 −0
Original line number Diff line number Diff line
@@ -31,6 +31,11 @@
            android:entries="@array/wifi_sleep_policy_entries"
            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" -->
    <CheckBoxPreference
+10 −0
Original line number Diff line number Diff line
@@ -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_SLEEP_POLICY = "sleep_policy";
    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 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) findPreference(KEY_SUSPEND_OPTIMIZATIONS);
        suspendOptimizations.setChecked(Global.getInt(getContentResolver(),
@@ -167,6 +173,10 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
            Global.putInt(getContentResolver(),
                    Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED,
                    ((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 {
            return super.onPreferenceTreeClick(screen, preference);
        }