summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaIfaceHal.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java24
2 files changed, 26 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
index 5bf44ce66..03925e877 100644
--- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
@@ -2339,6 +2339,8 @@ public class SupplicantStaIfaceHal {
public void onNetworkRemoved(int id) {
synchronized (mLock) {
logCallback("onNetworkRemoved");
+ // Reset 4way handshake state since network has been removed.
+ mStateIsFourway = false;
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
index b4ea5af34..eded7fc17 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
@@ -1201,6 +1201,30 @@ public class SupplicantStaIfaceHalTest {
eq(WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD), eq(-1));
}
+ /**
+ * Tests the handling of incorrect network passwords, edge case.
+ *
+ * If the network is removed during 4-way handshake, do not call it a password mismatch.
+ */
+ @Test
+ public void testNetworkRemovedDuring4way() throws Exception {
+ executeAndValidateInitializationSequence();
+ assertNotNull(mISupplicantStaIfaceCallback);
+
+ int reasonCode = 3;
+
+ mISupplicantStaIfaceCallback.onStateChanged(
+ ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE,
+ NativeUtil.macAddressToByteArray(BSSID),
+ SUPPLICANT_NETWORK_ID,
+ NativeUtil.decodeSsid(SUPPLICANT_SSID));
+ mISupplicantStaIfaceCallback.onNetworkRemoved(SUPPLICANT_NETWORK_ID);
+ mISupplicantStaIfaceCallback.onDisconnected(
+ NativeUtil.macAddressToByteArray(BSSID), true, reasonCode);
+ verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt(),
+ anyInt());
+ }
+
/**
* Tests the handling of incorrect network passwords, edge case.
*