diff options
author | Kai Shi <kaishi@google.com> | 2020-04-14 15:03:27 -0700 |
---|---|---|
committer | Kai Shi <kaishi@google.com> | 2020-04-14 15:03:27 -0700 |
commit | 2693c3a8265476521c5dbb599cab444268769c5b (patch) | |
tree | b5c6fedcffa5fff924d6feeecc31b7d75211147b /service | |
parent | 82298418fe24c1d0d8f62ba1b79e55d168bf6351 (diff) |
Check internet status for pre-scan sufficiency check
If internet status is not acceptable, don't skip screen-on scan even if RSSI is
high and there is a recent network selection.
Test: atest com.android.server.wifi
Bug: 154040171
Change-Id: I4ffded56a7aae2740c625f25ca2158de39c79220
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConnectivityManager.java | 8 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkSelector.java | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index 467abf32b..39603dd22 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -1080,17 +1080,19 @@ public class WifiConnectivityManager { <= 1000 * mContext.getResources().getInteger( R.integer.config_wifiConnectedHighRssiScanMinimumWindowSizeSec)); - boolean isGoodLinkAndShortTimeSinceLastNetworkSelection = + boolean isGoodLinkAndAcceptableInternetAndShortTimeSinceLastNetworkSelection = mNetworkSelector.hasSufficientLinkQuality(mWifiInfo) + && mNetworkSelector.hasInternetOrExpectNoInternet(mWifiInfo) && isShortTimeSinceLastNetworkSelection; // Check it is one of following conditions to skip scan (with firmware roaming) // or do partial scan only (without firmware roaming). // 1) Network is sufficient - // 2) link is good and it is a short time since last network selection + // 2) link is good, internet status is acceptable + // and it is a short time since last network selection // 3) There is active stream such that scan will be likely disruptive if (mWifiState == WIFI_STATE_CONNECTED && (mNetworkSelector.isNetworkSufficient(mWifiInfo) - || isGoodLinkAndShortTimeSinceLastNetworkSelection + || isGoodLinkAndAcceptableInternetAndShortTimeSinceLastNetworkSelection || mNetworkSelector.hasActiveStream(mWifiInfo))) { // If only partial scan is proposed and firmware roaming control is supported, // we will not issue any scan because firmware roaming will take care of diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java index f6178f24c..20544282f 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSelector.java +++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java @@ -218,6 +218,17 @@ public class WifiNetworkSelector { } /** + * Check if current network has internet or is expected to not have internet + */ + public boolean hasInternetOrExpectNoInternet(WifiInfo wifiInfo) { + WifiConfiguration network = + mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); + if (network == null) { + return false; + } + return !network.hasNoInternetAccess() || network.isNoInternetAccessExpected(); + } + /** * Determines whether the currently connected network is sufficient. * * If the network is good enough, or if switching to a new network is likely to @@ -262,7 +273,7 @@ public class WifiNetworkSelector { } // Network without internet access is not sufficient, unless expected - if (network.hasNoInternetAccess() && !network.isNoInternetAccessExpected()) { + if (!hasInternetOrExpectNoInternet(wifiInfo)) { localLog("Current network has [" + network.numNoInternetAccessReports + "] no-internet access reports"); return false; |