summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Ma <xiaom@google.com>2020-03-10 23:05:31 +0900
committerXiao Ma <xiaom@google.com>2020-03-13 11:48:45 +0900
commitec3264870af96b469b4f65fd843ff8f9cc4d1098 (patch)
tree79bcde809ad03c4e0cedc4d6d32c86628d957d21
parent01d689899fcd12fb7429b72dded7a4c64076333c (diff)
Update method of getting ScanResult of current network.
Noticed that ScanResult got from ScanDetailCache associated with provided BSSID would be null if forcing to forget and then reconnet to the wifi network. This would cause IpClient get null ScanResult. Update the method of getting ScanResult with a more robust way. Bug: 137835398 Test: atest FrameworksWifiTests Change-Id: I3ea5a301a9635248a2d121d9a6b7493cc6f430a6
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index d3bbdfdc8..28c503323 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -6386,8 +6386,25 @@ public class ClientModeImpl extends StateMachine {
ScanDetailCache scanDetailCache =
mWifiConfigManager.getScanDetailCacheForNetwork(config.networkId);
ScanResult scanResult = null;
- if (scanDetailCache != null && mLastBssid != null) {
- scanResult = scanDetailCache.getScanResult(mLastBssid);
+ if (mLastBssid != null) {
+ if (scanDetailCache != null) {
+ scanResult = scanDetailCache.getScanResult(mLastBssid);
+ }
+
+ // The cached scan result of connected network would be null at the first
+ // connection, try to check full scan result list again to look up matched
+ // scan result associated to the current SSID and BSSID.
+ if (scanResult == null) {
+ ScanRequestProxy scanRequestProxy = mWifiInjector.getScanRequestProxy();
+ List<ScanResult> scanResults = scanRequestProxy.getScanResults();
+ for (ScanResult result : scanResults) {
+ if (result.SSID.equals(WifiInfo.removeDoubleQuotes(config.SSID))
+ && result.BSSID.equals(mLastBssid)) {
+ scanResult = result;
+ break;
+ }
+ }
+ }
}
final ProvisioningConfiguration prov;