summaryrefslogtreecommitdiffstats
path: root/service/java/com/android
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2019-06-03 18:23:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-06-03 18:23:29 +0000
commit782f16649ce3e8f95fea3c701b046842bca35c18 (patch)
treeb9938ec92b800f52de124079c3b842e07b597952 /service/java/com/android
parentaa697357cdf78fa41e7fb6a52803e5d2f9bcc5ae (diff)
parent13d755aca12a1e9b252fbfb8f36670dc0fb7ed71 (diff)
downloadandroid_frameworks_opt_net_wifi-782f16649ce3e8f95fea3c701b046842bca35c18.tar.gz
android_frameworks_opt_net_wifi-782f16649ce3e8f95fea3c701b046842bca35c18.tar.bz2
android_frameworks_opt_net_wifi-782f16649ce3e8f95fea3c701b046842bca35c18.zip
Merge "[WifiNetworkSelector] User-selected network is sufficient for a while" into qt-dev
Diffstat (limited to 'service/java/com/android')
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSelector.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java
index 4b7e3f02b..85bd9174a 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSelector.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java
@@ -56,6 +56,7 @@ public class WifiNetworkSelector {
private static final String TAG = "WifiNetworkSelector";
private static final long INVALID_TIME_STAMP = Long.MIN_VALUE;
+
/**
* Minimum time gap between last successful network selection and a
* new selection attempt.
@@ -64,6 +65,15 @@ public class WifiNetworkSelector {
public static final int MINIMUM_NETWORK_SELECTION_INTERVAL_MS = 10 * 1000;
/**
+ * For this duration after user selected it, consider the current network as sufficient.
+ *
+ * This delays network selection during the time that connectivity service may be posting
+ * a dialog about a no-internet network.
+ */
+ @VisibleForTesting
+ public static final int LAST_USER_SELECTION_SUFFICIENT_MS = 30_000;
+
+ /**
* Time that it takes for the boost given to the most recently user-selected
* network to decay to zero.
*
@@ -235,6 +245,14 @@ public class WifiNetworkSelector {
return false;
}
+ if (mWifiConfigManager.getLastSelectedNetwork() == network.networkId
+ && (mClock.getElapsedSinceBootMillis()
+ - mWifiConfigManager.getLastSelectedTimeStamp())
+ <= LAST_USER_SELECTION_SUFFICIENT_MS) {
+ localLog("Current network is recently user-selected.");
+ return true;
+ }
+
// OSU (Online Sign Up) network for Passpoint Release 2 is sufficient network.
if (network.osu) {
return true;