diff options
author | Oscar Shu <xshu@google.com> | 2019-12-02 18:40:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-12-02 18:40:47 +0000 |
commit | 10945006c172ca71cf2de64ee7a70a9f00fd43bf (patch) | |
tree | 303f51a1ffda507a663d3f92b09c5eb86fe0ba96 | |
parent | 1369ef2a467dd13aa67ff3a0a85e21f0a52b73fe (diff) | |
parent | 9f67db616a8317ca00941658d2679b78293f0d44 (diff) |
Merge "Don't trigger watchdog for network related failures"
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 13 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 27 |
2 files changed, 32 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index ad8d79746..f358e9acd 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -3502,10 +3502,12 @@ public class ClientModeImpl extends StateMachine { : WifiMetrics.ConnectionEvent.FAILURE_ASSOCIATION_REJECTION, WifiMetricsProto.ConnectionEvent.HLF_NONE, level2FailureReason); - mWifiInjector.getWifiLastResortWatchdog() - .noteConnectionFailureAndTriggerIfNeeded( - getTargetSsid(), bssid, - WifiLastResortWatchdog.FAILURE_CODE_ASSOCIATION); + if (reasonCode != REASON_CODE_AP_UNABLE_TO_HANDLE_NEW_STA) { + mWifiInjector.getWifiLastResortWatchdog() + .noteConnectionFailureAndTriggerIfNeeded( + getTargetSsid(), bssid, + WifiLastResortWatchdog.FAILURE_CODE_ASSOCIATION); + } break; case WifiMonitor.AUTHENTICATION_FAILURE_EVENT: mWifiDiagnostics.captureBugReportData( @@ -3562,7 +3564,8 @@ public class ClientModeImpl extends StateMachine { WifiMetrics.ConnectionEvent.FAILURE_AUTHENTICATION_FAILURE, WifiMetricsProto.ConnectionEvent.HLF_NONE, level2FailureReason); - if (reasonCode != WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD) { + if (reasonCode != WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD && reasonCode + != WifiManager.ERROR_AUTH_FAILURE_EAP_FAILURE) { mWifiInjector.getWifiLastResortWatchdog() .noteConnectionFailureAndTriggerIfNeeded( getTargetSsid(), diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 48d016ae9..61ca10e53 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -2951,8 +2951,8 @@ public class ClientModeImplTest extends WifiBaseTest { } /** - * Verifies that WifiLastResortWatchdog and BssidBlocklistMonitor is notified of - * association rejection of type REASON_CODE_AP_UNABLE_TO_HANDLE_NEW_STA. + * Verifies that the BssidBlocklistMonitor is notified, but the WifiLastResortWatchdog is + * not notified of association rejections of type REASON_CODE_AP_UNABLE_TO_HANDLE_NEW_STA. * @throws Exception */ @Test @@ -2963,7 +2963,7 @@ public class ClientModeImplTest extends WifiBaseTest { mCmi.sendMessage(WifiMonitor.ASSOCIATION_REJECTION_EVENT, 0, ClientModeImpl.REASON_CODE_AP_UNABLE_TO_HANDLE_NEW_STA, sBSSID); mLooper.dispatchAll(); - verify(mWifiLastResortWatchdog).noteConnectionFailureAndTriggerIfNeeded( + verify(mWifiLastResortWatchdog, never()).noteConnectionFailureAndTriggerIfNeeded( anyString(), anyString(), anyInt()); verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA); @@ -3008,6 +3008,27 @@ public class ClientModeImplTest extends WifiBaseTest { } /** + * Verifies that WifiLastResortWatchdog is not notified of authentication failures of type + * ERROR_AUTH_FAILURE_EAP_FAILURE. + * @throws Exception + */ + @Test + public void testEapFailureIsIgnoredByWatchdog() throws Exception { + // Setup CONNECT_MODE & a WifiConfiguration + initializeAndAddNetworkAndVerifySuccess(); + mCmi.sendMessage(ClientModeImpl.CMD_START_CONNECT, 0, 0, sBSSID); + mCmi.sendMessage(WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT, 0, 0, + new StateChangeResult(0, sWifiSsid, sBSSID, SupplicantState.COMPLETED)); + mCmi.sendMessage(WifiMonitor.AUTHENTICATION_FAILURE_EVENT, + WifiManager.ERROR_AUTH_FAILURE_EAP_FAILURE); + mLooper.dispatchAll(); + verify(mWifiLastResortWatchdog, never()).noteConnectionFailureAndTriggerIfNeeded( + anyString(), anyString(), anyInt()); + verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID, + BssidBlocklistMonitor.REASON_EAP_FAILURE); + } + + /** * Verifies that WifiLastResortWatchdog is notified of other types of authentication failures. * @throws Exception */ |