diff options
author | xshu <xshu@google.com> | 2020-06-19 18:21:52 -0700 |
---|---|---|
committer | xshu <xshu@google.com> | 2020-08-04 21:49:18 -0700 |
commit | cc1e31863b17b6a02e3efb88a6493c475a60568a (patch) | |
tree | 55b345d3416eec7ce0e0d8e9334e9f7d0f767bdc /tests | |
parent | c83a6ec1e99253a78d843237c0757df16f9b4f7d (diff) |
Separate framework initiated blocklists by reason
(cherry picked from 7930f4755e90ef2b150696a50bf644fae0978922)
Multiple wifi features are now blocking BSSIDs.
Separate the block reason for easier debugging.
Bug: 159499995
Test: atest com.android.server.wifi
Change-Id: I4c8a1d716bf373322b38285997443664ed27b51c
Merged-In: I4c8a1d716bf373322b38285997443664ed27b51c
Diffstat (limited to 'tests')
4 files changed, 22 insertions, 13 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java index 4d2db7b02..44303fe25 100644 --- a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java @@ -47,6 +47,8 @@ public class BssidBlocklistMonitorTest { private static final String TEST_BSSID_1 = "0a:08:5c:67:89:00"; private static final String TEST_BSSID_2 = "0a:08:5c:67:89:01"; private static final String TEST_BSSID_3 = "0a:08:5c:67:89:02"; + private static final int TEST_FRAMEWORK_BLOCK_REASON = + BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_MBO_OCE; private static final int TEST_L2_FAILURE = BssidBlocklistMonitor.REASON_ASSOCIATION_REJECTION; private static final int TEST_DHCP_FAILURE = BssidBlocklistMonitor.REASON_DHCP_FAILURE; private static final long BASE_BLOCKLIST_DURATION = TimeUnit.MINUTES.toMillis(5); // 5 minutes @@ -673,7 +675,8 @@ public class BssidBlocklistMonitorTest { public void testBlockBssidForDurationMs() { when(mClock.getWallClockMillis()).thenReturn(0L); long testDuration = 5500L; - mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration); + mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration, + TEST_FRAMEWORK_BLOCK_REASON); assertEquals(1, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); // Verify that the BSSID is removed from blocklist by clearBssidBlocklistForSsid @@ -682,7 +685,8 @@ public class BssidBlocklistMonitorTest { assertEquals(1, mBssidBlocklistMonitor.getBssidStatusHistoryLoggerSize()); // Add the BSSID to blocklist again. - mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration); + mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration, + TEST_FRAMEWORK_BLOCK_REASON); assertEquals(1, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); // Verify that the BSSID is removed from blocklist once the specified duration is over. @@ -699,15 +703,18 @@ public class BssidBlocklistMonitorTest { // test invalid BSSID when(mClock.getWallClockMillis()).thenReturn(0L); long testDuration = 5500L; - mBssidBlocklistMonitor.blockBssidForDurationMs(null, TEST_SSID_1, testDuration); + mBssidBlocklistMonitor.blockBssidForDurationMs(null, TEST_SSID_1, testDuration, + TEST_FRAMEWORK_BLOCK_REASON); assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); // test invalid SSID - mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, null, testDuration); + mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, null, testDuration, + TEST_FRAMEWORK_BLOCK_REASON); assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); // test invalid duration - mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, -1); + mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, -1, + TEST_FRAMEWORK_BLOCK_REASON); assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); } } diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index d23925424..b945a8b81 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -4348,8 +4348,8 @@ public class ClientModeImplTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mWifiMetrics, times(1)).incrementSteeringRequestCountIncludingMboAssocRetryDelay(); - verify(mBssidBlocklistMonitor).blockBssidForDurationMs(sBSSID, sSSID, - btmFrmData.mBlackListDurationMs); + verify(mBssidBlocklistMonitor).blockBssidForDurationMs(eq(sBSSID), eq(sSSID), + eq(btmFrmData.mBlackListDurationMs), anyInt()); } /** @@ -4372,8 +4372,8 @@ public class ClientModeImplTest extends WifiBaseTest { mCmi.sendMessage(WifiMonitor.MBO_OCE_BSS_TM_HANDLING_DONE, btmFrmData); mLooper.dispatchAll(); - verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(sBSSID, sSSID, - btmFrmData.mBlackListDurationMs); + verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(eq(sBSSID), eq(sSSID), + eq(btmFrmData.mBlackListDurationMs), anyInt()); verify(mWifiConnectivityManager).forceConnectivityScan(ClientModeImpl.WIFI_WORK_SOURCE); verify(mWifiMetrics, times(1)).incrementMboCellularSwitchRequestCount(); verify(mWifiMetrics, times(1)) diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java index 9203a8d9b..6b953175a 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java @@ -893,7 +893,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { CANDIDATE_SSID); // Verify the failed BSSID is added to blocklist verify(mBssidBlocklistMonitor).blockBssidForDurationMs(eq(CANDIDATE_BSSID), - eq(CANDIDATE_SSID), anyLong()); + eq(CANDIDATE_SSID), anyLong(), anyInt()); // Verify another connection starting verify(mWifiNS).selectNetwork((List<WifiCandidates.Candidate>) argThat(new WifiCandidatesListSizeMatcher(1))); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 3c752f97a..182abbb4e 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -781,7 +781,8 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); mWifiScoreReport.stopConnectedNetworkScorer(); mLooper.dispatchAll(); - verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong()); + verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong(), + anyInt()); } /** @@ -805,7 +806,7 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); mWifiScoreReport.stopConnectedNetworkScorer(); mLooper.dispatchAll(); - verify(mBssidBlocklistMonitor).blockBssidForDurationMs(any(), any(), anyLong()); + verify(mBssidBlocklistMonitor).blockBssidForDurationMs(any(), any(), anyLong(), anyInt()); } /** @@ -831,7 +832,8 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); mWifiScoreReport.stopConnectedNetworkScorer(); mLooper.dispatchAll(); - verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong()); + verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong(), + anyInt()); } /** |