diff options
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkSelector.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java index bd9ca7422..cd73b784d 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSelector.java +++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java @@ -129,9 +129,6 @@ public class WifiNetworkSelector { } private boolean isCurrentNetworkSufficient(WifiInfo wifiInfo, List<ScanDetail> scanDetails) { - WifiConfiguration network = - mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); - // Currently connected? if (wifiInfo.getSupplicantState() != SupplicantState.COMPLETED) { localLog("No current connected network."); @@ -157,12 +154,6 @@ public class WifiNetworkSelector { return false; } - // Open network is not qualified. - if (WifiConfigurationUtil.isConfigForOpenNetwork(network)) { - localLog("Current network is a open one."); - return false; - } - if (wifiInfo.is24GHz()) { // 2.4GHz networks is not qualified whenever 5GHz is available if (is5GHzNetworkAvailable(scanDetails)) { @@ -175,6 +166,20 @@ public class WifiNetworkSelector { return false; } + WifiConfiguration network = + mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); + + if (network == null) { + localLog("Current network was removed."); + return false; + } + + // Open network is not qualified. + if (WifiConfigurationUtil.isConfigForOpenNetwork(network)) { + localLog("Current network is a open one."); + return false; + } + // Network with no internet access reports is not qualified. if (network.numNoInternetAccessReports > 0 && !network.noInternetAccessExpected) { localLog("Current network has [" + network.numNoInternetAccessReports |