summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/BssidBlocklistMonitor.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java5
2 files changed, 19 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
index 2151da2af..530ad6de0 100644
--- a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
+++ b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
@@ -279,6 +279,7 @@ public class BssidBlocklistMonitor {
/**
* Note a successful network validation on a BSSID and clear appropriate failure counters.
+ * And then remove the BSSID from blocklist.
*/
public void handleNetworkValidationSuccess(@NonNull String bssid, @NonNull String ssid) {
mWifiScoreCard.resetBssidBlocklistStreak(ssid, bssid, REASON_NETWORK_VALIDATION_FAILURE);
@@ -287,6 +288,12 @@ public class BssidBlocklistMonitor {
return;
}
status.failureCount[REASON_NETWORK_VALIDATION_FAILURE] = 0;
+ /**
+ * Network validation may take more than 1 tries to succeed.
+ * remove the BSSID from blocklist to make sure we are not accidentally blocking good
+ * BSSIDs.
+ **/
+ status.removeFromBlocklist();
}
/**
@@ -441,6 +448,14 @@ public class BssidBlocklistMonitor {
blocklistEndTimeMs = mClock.getWallClockMillis() + durationMs;
}
+ /**
+ * Remove this BSSID from the blocklist.
+ */
+ public void removeFromBlocklist() {
+ isInBlocklist = false;
+ blocklistEndTimeMs = 0;
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
diff --git a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java
index 7f72269bd..7a0bb5b60 100644
--- a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java
@@ -328,13 +328,16 @@ public class BssidBlocklistMonitorTest {
}
/**
- * Verify that handleNetworkValidationSuccess resets appropriate blocklist streak counts.
+ * Verify that handleNetworkValidationSuccess resets appropriate blocklist streak counts
+ * and removes the BSSID from blocklist.
*/
@Test
public void testNetworkValidationResetsBlocklistStreak() {
+ verifyAddTestBssidToBlocklist();
mBssidBlocklistMonitor.handleNetworkValidationSuccess(TEST_BSSID_1, TEST_SSID_1);
verify(mWifiScoreCard).resetBssidBlocklistStreak(TEST_SSID_1, TEST_BSSID_1,
BssidBlocklistMonitor.REASON_NETWORK_VALIDATION_FAILURE);
+ assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
}
/**