From a9af37006b20d012ab7dcd329c088cb8d0795289 Mon Sep 17 00:00:00 2001 From: xshu Date: Mon, 11 May 2020 17:24:00 -0700 Subject: BssidBlocklistMonitor history It's been found that often the local log does not cover enough time for Bssid blocklist related debugging. This change will make sure that we will get data on the latest 30 unblocked BSSIDs during bugreport dump. Bug: 156004955 Test: atest com.android.server.wifi Change-Id: I16efa8cae4b2cabdc5727aab214b66ccee465a5c --- .../server/wifi/BssidBlocklistMonitorTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java index 2567faa91..4369a831b 100644 --- a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java @@ -582,6 +582,24 @@ public class BssidBlocklistMonitorTest { verifyAddTestBssidToBlocklist(); mBssidBlocklistMonitor.clearBssidBlocklist(); assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); + + } + + /** + * Verify that the BssidStatusHistoryLoggerSize is capped. + */ + @Test + public void testBssidStatusHistoryLoggerSize() { + int bssidStatusHistoryLoggerSize = 30; + for (int i = 0; i < bssidStatusHistoryLoggerSize; i++) { + verifyAddTestBssidToBlocklist(); + mBssidBlocklistMonitor.clearBssidBlocklist(); + assertEquals(i + 1, mBssidBlocklistMonitor.getBssidStatusHistoryLoggerSize()); + } + verifyAddTestBssidToBlocklist(); + mBssidBlocklistMonitor.clearBssidBlocklist(); + assertEquals(bssidStatusHistoryLoggerSize, + mBssidBlocklistMonitor.getBssidStatusHistoryLoggerSize()); } /** @@ -633,6 +651,7 @@ public class BssidBlocklistMonitorTest { // Verify that the BSSID is removed from blocklist by clearBssidBlocklistForSsid mBssidBlocklistMonitor.clearBssidBlocklistForSsid(TEST_SSID_1); assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); + assertEquals(1, mBssidBlocklistMonitor.getBssidStatusHistoryLoggerSize()); // Add the BSSID to blocklist again. mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration); @@ -641,5 +660,6 @@ public class BssidBlocklistMonitorTest { // Verify that the BSSID is removed from blocklist once the specified duration is over. when(mClock.getWallClockMillis()).thenReturn(testDuration + 1); assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); + assertEquals(2, mBssidBlocklistMonitor.getBssidStatusHistoryLoggerSize()); } } -- cgit v1.2.3