summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-05-04 16:38:29 -0700
committerRoshan Pius <rpius@google.com>2018-05-18 10:38:13 -0700
commitd5265a61c41f23503e755d37bd5611ebef3f12b0 (patch)
tree3c11188fa12f5ce7d630807a929167814a6ade6a /service
parente93744bec9cb63b00b4597d49a20378749634358 (diff)
WifiConfigManager: Temporarily disable network with no internet access
Changes in the CL: a) Add a new network disable reason to temporarily blacklist an auto-connected network. b) When the device auto-connects to a network and then it detects a no internet report, we temporarily disable the network for 10 minutes. This should force network selection to pick another candidate if available. Note: a) If there are no other candidates available to auto-connect, the device will remain connected to the existing network (even though it is temporarily disabled). b) If the user explicitly clicked on the network, we'll not temporarily disable the network. Bug: 72635747 Test: Unit tests Test: Manually verified that device switched away from an auto-connected network when it detects no internet. Change-Id: I644693fa5d4477bdce1d39f391fc2fb24a773eeb
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java6
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java16
2 files changed, 17 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 982c48a48..09b0b3483 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -119,10 +119,11 @@ public class WifiConfigManager {
5, // threshold for DISABLED_AUTHENTICATION_FAILURE
5, // threshold for DISABLED_DHCP_FAILURE
5, // threshold for DISABLED_DNS_FAILURE
+ 1, // threshold for DISABLED_NO_INTERNET_TEMPORARY
1, // threshold for DISABLED_WPS_START
6, // threshold for DISABLED_TLS_VERSION_MISMATCH
1, // threshold for DISABLED_AUTHENTICATION_NO_CREDENTIALS
- 1, // threshold for DISABLED_NO_INTERNET
+ 1, // threshold for DISABLED_NO_INTERNET_PERMANENT
1, // threshold for DISABLED_BY_WIFI_MANAGER
1, // threshold for DISABLED_BY_USER_SWITCH
1 // threshold for DISABLED_BY_WRONG_PASSWORD
@@ -141,10 +142,11 @@ public class WifiConfigManager {
5 * 60 * 1000, // threshold for DISABLED_AUTHENTICATION_FAILURE
5 * 60 * 1000, // threshold for DISABLED_DHCP_FAILURE
5 * 60 * 1000, // threshold for DISABLED_DNS_FAILURE
+ 10 * 60 * 1000, // threshold for DISABLED_NO_INTERNET_TEMPORARY
0 * 60 * 1000, // threshold for DISABLED_WPS_START
Integer.MAX_VALUE, // threshold for DISABLED_TLS_VERSION
Integer.MAX_VALUE, // threshold for DISABLED_AUTHENTICATION_NO_CREDENTIALS
- Integer.MAX_VALUE, // threshold for DISABLED_NO_INTERNET
+ Integer.MAX_VALUE, // threshold for DISABLED_NO_INTERNET_PERMANENT
Integer.MAX_VALUE, // threshold for DISABLED_BY_WIFI_MANAGER
Integer.MAX_VALUE, // threshold for DISABLED_BY_USER_SWITCH
Integer.MAX_VALUE // threshold for DISABLED_BY_WRONG_PASSWORD
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 74a4dc7f0..fa22749bb 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -5292,10 +5292,20 @@ public class WifiStateMachine extends StateMachine {
config.networkId, false);
mWifiConfigManager.updateNetworkSelectionStatus(config.networkId,
WifiConfiguration.NetworkSelectionStatus
- .DISABLED_NO_INTERNET);
+ .DISABLED_NO_INTERNET_PERMANENT);
+ } else {
+ mWifiConfigManager.incrementNetworkNoInternetAccessReports(
+ config.networkId);
+ // If this was not the last selected network, update network
+ // selection status to temporarily disable the network.
+ if (mWifiConfigManager.getLastSelectedNetwork() != config.networkId
+ && !config.noInternetAccessExpected) {
+ mWifiConfigManager.updateNetworkSelectionStatus(
+ config.networkId,
+ WifiConfiguration.NetworkSelectionStatus
+ .DISABLED_NO_INTERNET_TEMPORARY);
+ }
}
- mWifiConfigManager.incrementNetworkNoInternetAccessReports(
- config.networkId);
}
}
return HANDLED;