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

Commit d6b8cbb1 authored by Arif Hussain's avatar Arif Hussain Committed by Linux Build Service Account
Browse files

wlan: Provide runtime option to enable or disable rssi threshold (settings)

RSSI threshold check in AutoJoin feature will not allow
to connect if AP's RSSI is low, this option will allow user
to enable/disable RSSI threshold check through advance settings.

Conflicts:
        res/xml/wifi_advanced_settings.xml
        src/com/android/settings/wifi/AdvancedWifiSettings.java

Change-Id: I82d7082a97cfc2dc75e0b14221b176697060e05d
CRs-Fixed: 710284
parent 62e6e37d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1469,6 +1469,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 toggle wifi RSSI threshold check -->
    <string name="wifi_rssi_threshold_check">Enable RSSI threshold</string>
    <!-- Checkbox summary for option to toggle poor network detection -->
    <string name="wifi_rssi_threshold_check_summary">Do not connect to an AP if RSSI is poor</string>
    <!-- Checkbox summary for option to toggle poor network detection [CHAR LIMIT=60] -->
    <string name="wifi_avoid_poor_network_detection_summary">Only use networks that have a good Internet connection</string>
    <!-- Checkbox title for option to scan always available setting -->
+7 −0
Original line number Diff line number Diff line
@@ -35,6 +35,13 @@
            android:title="@string/wifi_automatically_manage_title"
            android:persistent="false" />

    <CheckBoxPreference
            android:key="wifi_rssi_threshold_check"
            android:title="@string/wifi_rssi_threshold_check"
            android:summary="@string/wifi_rssi_threshold_check_summary"
            android:persistent="false" />


    <ListPreference
            android:key="sleep_policy"
            android:title="@string/wifi_setting_sleep_policy_title"
+11 −0
Original line number Diff line number Diff line
@@ -58,6 +58,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_SCAN_ALWAYS_AVAILABLE = "wifi_scan_always_available";
    private static final String KEY_WIFI_RSSI_THRESHOLD_CHECK = "wifi_rssi_threshold_check";
    private static final String KEY_INSTALL_CREDENTIALS = "install_credentials";
    private static final String KEY_WIFI_ASSISTANT = "wifi_assistant";
    private static final String KEY_WIFI_DIRECT = "wifi_direct";
@@ -122,6 +123,11 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
        scanAlwaysAvailable.setChecked(Global.getInt(getContentResolver(),
                    Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1);

        CheckBoxPreference wifiRssiThresholdCheck =
            (CheckBoxPreference) findPreference(KEY_WIFI_RSSI_THRESHOLD_CHECK);
        wifiRssiThresholdCheck.setChecked(Global.getInt(getContentResolver(),
                    Global.WIFI_RSSI_THRESHOLD, 0) == 1);

        Intent intent = new Intent(Credentials.INSTALL_AS_USER_ACTION);
        intent.setClassName("com.android.certinstaller",
                "com.android.certinstaller.CertInstallerMain");
@@ -239,6 +245,11 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
            Global.putInt(getContentResolver(),
                    Global.WIFI_SCAN_ALWAYS_AVAILABLE,
                    ((SwitchPreference) preference).isChecked() ? 1 : 0);
        } else if (KEY_WIFI_RSSI_THRESHOLD_CHECK.equals(key)) {
            Global.putInt(getContentResolver(),
                    Global.WIFI_RSSI_THRESHOLD,
                    ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
            mWifiManager.enableRssiThreshold(((CheckBoxPreference) preference).isChecked() ? 1 : 0);
        } else {
            return super.onPreferenceTreeClick(screen, preference);
        }