summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-09-02 18:05:03 -0700
committerKai Shi <kaishi@google.com>2020-09-08 15:04:25 -0700
commite9cfb8f54b276b3b5afc72a9fb239aab48f4d86f (patch)
tree001ea51447c33b1e84b80a1b24a414c7a2035cbb /service
parenta0d01b665d79abaeabcbddba79c46d7d3b10e168 (diff)
wifi: bug fix of network selection when autoConnect == false
Ensure current network has the correct throughput prediction value even when autoConnect is disabled. Test: atest com.android.server.wifi Test: manual test to ensre the current network is still selected when autoConnect is disabled. Bug: 167409983 Change-Id: I9e6059ee057d0f17c1cdf7cafd98dceafaef7eb5 Merged-In: I9e6059ee057d0f17c1cdf7cafd98dceafaef7eb5
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSelector.java15
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() + " :");