diff options
author | Kai Shi <kaishi@google.com> | 2020-09-09 23:27:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-09-09 23:27:11 +0000 |
commit | 2a2fc39e77bf780fbb2e98255738c818c5927392 (patch) | |
tree | 21a2b4979a2acb45769fb02b7e228c7ac4ca3944 /service | |
parent | 22f265e77b3c293c1a9ef2c15aae06e6b8a9e27d (diff) | |
parent | e9cfb8f54b276b3b5afc72a9fb239aab48f4d86f (diff) |
Merge "wifi: bug fix of network selection when autoConnect == false" into rvc-qpr-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkSelector.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java index 50078b628..fbbcb3174 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSelector.java +++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java @@ -462,6 +462,17 @@ public class WifiNetworkSelector { return validScanDetails; } + private ScanDetail findScanDetailForBssid(List<ScanDetail> scanDetails, + String currentBssid) { + for (ScanDetail scanDetail : scanDetails) { + ScanResult scanResult = scanDetail.getScanResult(); + if (scanResult.BSSID.equals(currentBssid)) { + return scanDetail; + } + } + return null; + } + private boolean isEnhancedOpenSupported() { if (mIsEnhancedOpenSupportedInitialized) { return mIsEnhancedOpenSupported; @@ -790,6 +801,8 @@ public class WifiNetworkSelector { WifiCandidates.Key key = new WifiCandidates.Key( ScanResultMatchInfo.fromWifiConfiguration(currentNetwork), bssid, currentNetwork.networkId); + ScanDetail scanDetail = findScanDetailForBssid(mFilteredNetworks, currentBssid); + int predictedTputMbps = (scanDetail == null) ? 0 : predictThroughput(scanDetail); wifiCandidates.add(key, currentNetwork, NetworkNominator.NOMINATOR_ID_CURRENT, wifiInfo.getRssi(), @@ -797,7 +810,7 @@ public class WifiNetworkSelector { calculateLastSelectionWeight(currentNetwork.networkId), WifiConfiguration.isMetered(currentNetwork, wifiInfo), isFromCarrierOrPrivilegedApp(currentNetwork), - 0 /* Mbps */); + predictedTputMbps); } for (NetworkNominator registeredNominator : mNominators) { localLog("About to run " + registeredNominator.getName() + " :"); |