diff options
author | Randy Pan <zpan@google.com> | 2016-11-04 16:15:49 -0700 |
---|---|---|
committer | Randy Pan <zpan@google.com> | 2016-11-07 10:46:25 -0800 |
commit | 70570f92c6e0a65c144c8df2e5639ef454f1dc7a (patch) | |
tree | 962b27cc022ca970f3b64b29aa02ca477fb1cb49 /service | |
parent | a8a5644b48660a166adfad9fdc274cbdb44cdf4b (diff) | |
download | android_frameworks_opt_net_wifi-70570f92c6e0a65c144c8df2e5639ef454f1dc7a.tar.gz android_frameworks_opt_net_wifi-70570f92c6e0a65c144c8df2e5639ef454f1dc7a.tar.bz2 android_frameworks_opt_net_wifi-70570f92c6e0a65c144c8df2e5639ef454f1dc7a.zip |
DO NOT MERGE: QNS: less agressive roaming
When connected, QNS no longer triggers network switching if the
current network didn't show up in the scan results.
While there, fixed a QNS unit test failure.
Bug: 31707128
Test: Wifi Unit Tests
Change-Id: I24a16828fb60af4015a4faf4e00c356898729173
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java b/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java index e916c8c4a..1ddf6ebcb 100644 --- a/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java +++ b/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java @@ -652,6 +652,7 @@ public class WifiQualifiedNetworkSelector { StringBuffer noValidSsid = new StringBuffer(); StringBuffer scoreHistory = new StringBuffer(); ArrayList<NetworkKey> unscoredNetworks = new ArrayList<NetworkKey>(); + boolean scanResultsHaveCurrentBssid = false; //iterate all scan results and find the best candidate with the highest score for (ScanDetail scanDetail : mScanDetails) { @@ -665,6 +666,12 @@ public class WifiQualifiedNetworkSelector { continue; } + //check if the scan results contain the current connected + //BSSID. + if (scanResult.BSSID.equals(mCurrentBssid)) { + scanResultsHaveCurrentBssid = true; + } + final String scanId = toScanId(scanResult); //check whether this BSSID is blocked or not if (mWifiConfigManager.isBssidBlacklisted(scanResult.BSSID) @@ -819,6 +826,16 @@ public class WifiQualifiedNetworkSelector { localLog(scoreHistory.toString()); } + //QNS listens to all single scan results. Some scan requests may not include + //the channel of the currently connected network, so the currently connected network + //won't show up in the scan results. We don't act on these scan results to avoid + //aggressive network switching which might trigger disconnection. + if (isConnected && !scanResultsHaveCurrentBssid) { + localLog("Current connected BSSID " + mCurrentBssid + " is not in the scan results." + + " Skip network selection."); + return null; + } + //we need traverse the whole user preference to choose the one user like most now if (scanResultCandidate != null) { WifiConfiguration tempConfig = networkCandidate; |