From c481bdc54f3c2420c67d1f19a1c6e0dbfdada19a Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Fri, 22 Nov 2019 15:00:21 -0800 Subject: Update the WifiConfig each time evalutor return a candidate. Bug: 145020223 Test: atest android.net.wifi Test: atest com.android.server.wifi Merged-In: I2b454af0cb2850c86d142ec170b1c3de7724121f Change-Id: I2b454af0cb2850c86d142ec170b1c3de7724121f --- .../server/wifi/hotspot2/PasspointNetworkEvaluator.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'service') 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(), -- cgit v1.2.3