diff options
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java index ec8a009d9..148af39c6 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java @@ -231,24 +231,20 @@ public class PasspointNetworkEvaluator implements WifiNetworkSelector.NetworkEva if (existingNetwork != null) { WifiConfiguration.NetworkSelectionStatus status = existingNetwork.getNetworkSelectionStatus(); - if (!status.isNetworkEnabled()) { - boolean isSuccess = mWifiConfigManager.tryEnableNetwork(existingNetwork.networkId); - if (isSuccess) { - return existingNetwork; - } + if (!status.isNetworkEnabled() + && !mWifiConfigManager.tryEnableNetwork(existingNetwork.networkId)) { localLog("Current configuration for the Passpoint AP " + config.SSID + " is disabled, skip this candidate"); return null; } - return existingNetwork; } - // Add the newly created WifiConfiguration to WifiConfigManager. + // Add or update with the newly created WifiConfiguration to WifiConfigManager. NetworkUpdateResult result = mWifiConfigManager.addOrUpdateNetwork(config, Process.WIFI_UID); if (!result.isSuccess()) { localLog("Failed to add passpoint network"); - return null; + return existingNetwork; } mWifiConfigManager.enableNetwork(result.getNetworkId(), false, Process.WIFI_UID); mWifiConfigManager.setNetworkCandidateScanResult(result.getNetworkId(), |