summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2019-11-22 15:00:21 -0800
committerNate Jiang <qiangjiang@google.com>2019-11-25 19:44:56 +0000
commitc481bdc54f3c2420c67d1f19a1c6e0dbfdada19a (patch)
tree07a65e9acc50d64e394bdc058cf946c6a7674635
parentff23d602c7a925a7aef87f1f7c3d08e67ad31a5e (diff)
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
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java12
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(),