summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOscar Shu <xshu@google.com>2019-12-09 23:17:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-12-09 23:17:08 +0000
commit49d7669f7aef11da095ca0231bd80e32e77402a1 (patch)
tree3fe6a8560600fe37cdd20a7775033347fb203480
parent0df094692bf06251e42eaf55158748a8876e829b (diff)
parent344945cc66898eb2ed8acac2dc571a8150f3d01b (diff)
Merge "validation success - remove BSSID from blocklist"
-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());
}
/**