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

Commit d77990f4 authored by Jonathan Dean's avatar Jonathan Dean Committed by Steve Kondik
Browse files

wifi: forward port avoid poor connection setting

Squash:
fixup "wifi: forward port avoid poor connection setting"

Author: : Evisceration <eviscerationls@gmail.com>

Change-Id: I3545e874bd6519a586744fc36297f7f3f3cb1f42

Change-Id: I22d0866e2c5d9b7f119b7ad42cc66e78bfd6ada0
parent 7a090794
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,13 @@
            android:dialogTitle="@string/wifi_select_assistant_dialog_title"
            android:persistent="false" />

    <!-- android:dependency="enable_wifi" -->
    <SwitchPreference
            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
            android:key="frequency_band"
            android:title="@string/wifi_setting_frequency_band_title"
+18 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
    private static final String KEY_COUNTRY_CODE = "wifi_countrycode";
    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_INSTALL_CREDENTIALS = "install_credentials";
    private static final String KEY_WIFI_ASSISTANT = "wifi_assistant";
    private static final String KEY_WIFI_DIRECT = "wifi_direct";
@@ -125,6 +126,19 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
                Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
        notifyOpenNetworks.setEnabled(mWifiManager.isWifiEnabled());

        SwitchPreference poorNetworkDetection =
            (SwitchPreference) findPreference(KEY_POOR_NETWORK_DETECTION);
        if (poorNetworkDetection != null) {
            if (Utils.isWifiOnly(getActivity())) {
                getPreferenceScreen().removePreference(poorNetworkDetection);
            } else {
                poorNetworkDetection.setChecked(Settings.Global.getInt(getContentResolver(),
                        Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
                        WifiManager.DEFAULT_POOR_NETWORK_AVOIDANCE_ENABLED ?
                        1 : 0) == 1);
            }
        }

        Intent intent = new Intent(Credentials.INSTALL_AS_USER_ACTION);
        intent.setClassName("com.android.certinstaller",
                "com.android.certinstaller.CertInstallerMain");
@@ -257,6 +271,10 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
            Global.putInt(getContentResolver(),
                    Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
                    ((SwitchPreference) preference).isChecked() ? 1 : 0);
        } else if (KEY_POOR_NETWORK_DETECTION.equals(key)) {
            Global.putInt(getContentResolver(),
                    Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
                    ((SwitchPreference) preference).isChecked() ? 1 : 0);
        } else {
            return super.onPreferenceTreeClick(screen, preference);
        }