From 9f67db616a8317ca00941658d2679b78293f0d44 Mon Sep 17 00:00:00 2001 From: xshu Date: Wed, 27 Nov 2019 13:52:48 -0800 Subject: Don't trigger watchdog for network related failures APs are using REASON_CODE_AP_UNABLE_TO_HANDLE_NEW_STA to redirect devices. EAP failure happens when there is a problem with the device's credential. In the above cases, we should just block the AP instead of trying to rely on the Watchdog restart. Bug: 139287182 Test: atest FrameworksWifiTests Change-Id: I15bc1a7917779584c369baa9728d1a26cff54095 --- .../android/server/wifi/ClientModeImplTest.java | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 7946ecbc0..33d1d4bf5 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -2984,8 +2984,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 @@ -2996,7 +2996,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); @@ -3040,6 +3040,27 @@ public class ClientModeImplTest extends WifiBaseTest { BssidBlocklistMonitor.REASON_WRONG_PASSWORD); } + /** + * 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 -- cgit v1.2.3