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

Commit 9955dfc3 authored by Paul Mongold's avatar Paul Mongold Committed by Seth Shelnutt
Browse files

wifi: don't avoid poor connections if mobile isn't connected and avoid

NPE on wifi only devices.

Change-Id: I7dcbbe682ee69bc23b8d9fe8cbed49cab7cea04b
parent 08c0c3ba
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -262,6 +262,8 @@ public class WifiWatchdogStateMachine extends StateMachine {
        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
        sWifiOnly = (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false);
        boolean noMobileConnection = sWifiOnly ? true : (cm.getNetworkInfo(
                ConnectivityManager.TYPE_MOBILE).isConnected() == false);

        // Watchdog is always enabled. Poor network detection & walled garden detection
        // can individually be turned on/off
@@ -270,7 +272,7 @@ public class WifiWatchdogStateMachine extends StateMachine {
        putSettingsBoolean(contentResolver, Settings.Secure.WIFI_WATCHDOG_ON, true);

        // Disable poor network avoidance, but keep watchdog active for walled garden detection
        if (sWifiOnly) {
        if (sWifiOnly || noMobileConnection) {
            log("Disabling poor network avoidance for wi-fi only device");
            putSettingsBoolean(contentResolver,
                    Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, false);