diff options
author | Roshan Pius <rpius@google.com> | 2018-05-07 14:58:58 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2018-05-18 10:38:13 -0700 |
commit | 095121ada1c9ea6034e86606395de20cddcad9ba (patch) | |
tree | 6af2f8f02eddb8368e63ceff8bcb4a65391e67d6 /service | |
parent | d5265a61c41f23503e755d37bd5611ebef3f12b0 (diff) |
WifiConfigManager: Do not disconnect on temp failure due to no internet
This will let network selector find a better candidate, if available.
If network selector does not find any other candidates, we will remain
connected to the no-internet network.
Bug: 72635747
Test: Unit tests
Test: Manually verified that device did not disconnect from an
auto-connected network when it detects no internet.
Change-Id: I5cfaff1ef534b4f638e7a147d79d2c264718ce2b
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 12 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiConnectivityManager.java | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 09b0b3483..0b70dbf4e 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -167,7 +167,7 @@ public class WifiConfigManager { /** * Invoked on saved network being permanently disabled. */ - void onSavedNetworkPermanentlyDisabled(int networkId); + void onSavedNetworkPermanentlyDisabled(int networkId, int disableReason); /** * Invoked on saved network being removed. */ @@ -175,7 +175,7 @@ public class WifiConfigManager { /** * Invoked on saved network being temporarily disabled. */ - void onSavedNetworkTemporarilyDisabled(int networkId); + void onSavedNetworkTemporarilyDisabled(int networkId, int disableReason); /** * Invoked on saved network being updated. */ @@ -1303,7 +1303,9 @@ public class WifiConfigManager { // Only need a valid time filled in for temporarily disabled networks. status.setDisableTime(mClock.getElapsedSinceBootMillis()); status.setNetworkSelectionDisableReason(disableReason); - if (mListener != null) mListener.onSavedNetworkTemporarilyDisabled(config.networkId); + if (mListener != null) { + mListener.onSavedNetworkTemporarilyDisabled(config.networkId, disableReason); + } } /** @@ -1317,7 +1319,9 @@ public class WifiConfigManager { status.setDisableTime( NetworkSelectionStatus.INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP); status.setNetworkSelectionDisableReason(disableReason); - if (mListener != null) mListener.onSavedNetworkPermanentlyDisabled(config.networkId); + if (mListener != null) { + mListener.onSavedNetworkPermanentlyDisabled(config.networkId, disableReason); + } } /** diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index aa4fd80df..d10d80013 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -16,6 +16,8 @@ package com.android.server.wifi; +import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED_NO_INTERNET_TEMPORARY; + import static com.android.server.wifi.WifiStateMachine.WIFI_WORK_SOURCE; import android.app.AlarmManager; @@ -37,7 +39,6 @@ import android.util.Log; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.util.ArrayUtils; import com.android.server.wifi.hotspot2.PasspointNetworkEvaluator; import com.android.server.wifi.util.ScanResultUtil; @@ -545,11 +546,12 @@ public class WifiConnectivityManager { updatePnoScan(); } @Override - public void onSavedNetworkTemporarilyDisabled(int networkId) { + public void onSavedNetworkTemporarilyDisabled(int networkId, int disableReason) { + if (disableReason == DISABLED_NO_INTERNET_TEMPORARY) return; mConnectivityHelper.removeNetworkIfCurrent(networkId); } @Override - public void onSavedNetworkPermanentlyDisabled(int networkId) { + public void onSavedNetworkPermanentlyDisabled(int networkId, int disableReason) { mConnectivityHelper.removeNetworkIfCurrent(networkId); updatePnoScan(); } |