summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java129
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java45
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java10
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java7
4 files changed, 128 insertions, 63 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java
index 44303fe25..e3c8d52fa 100644
--- a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import android.content.Context;
+import android.net.wifi.ScanResult;
import android.util.LocalLog;
import androidx.test.filters.SmallTest;
@@ -32,6 +33,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -47,12 +49,14 @@ 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_GOOD_RSSI = -50;
+ private static final int TEST_SUFFICIENT_RSSI = -67;
+ private static final int MIN_RSSI_DIFF_TO_UNBLOCK_BSSID = 5;
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
- private static final long BASE_LOW_RSSI_BLOCKLIST_DURATION = TimeUnit.SECONDS.toMillis(30);
private static final long ABNORMAL_DISCONNECT_TIME_WINDOW_MS = TimeUnit.SECONDS.toMillis(30);
private static final long ABNORMAL_DISCONNECT_RESET_TIME_MS = TimeUnit.HOURS.toMillis(3);
private static final int FAILURE_STREAK_CAP = 7;
@@ -77,6 +81,7 @@ public class BssidBlocklistMonitorTest {
@Mock private Clock mClock;
@Mock private LocalLog mLocalLog;
@Mock private WifiScoreCard mWifiScoreCard;
+ @Mock private ScoringParams mScoringParams;
private MockResources mResources;
private BssidBlocklistMonitor mBssidBlocklistMonitor;
@@ -88,12 +93,10 @@ public class BssidBlocklistMonitorTest {
when(mWifiConnectivityHelper.isFirmwareRoamingSupported()).thenReturn(true);
when(mWifiConnectivityHelper.getMaxNumBlacklistBssid())
.thenReturn(TEST_NUM_MAX_FIRMWARE_SUPPORT_BSSIDS);
+ when(mScoringParams.getSufficientRssi(anyInt())).thenReturn(TEST_SUFFICIENT_RSSI);
mResources = new MockResources();
mResources.setInteger(R.integer.config_wifiBssidBlocklistMonitorBaseBlockDurationMs,
(int) BASE_BLOCKLIST_DURATION);
- mResources.setInteger(
- R.integer.config_wifiBssidBlocklistMonitorBaseLowRssiBlockDurationMs,
- (int) BASE_LOW_RSSI_BLOCKLIST_DURATION);
mResources.setInteger(R.integer.config_wifiBssidBlocklistMonitorFailureStreakCap,
FAILURE_STREAK_CAP);
mResources.setInteger(R.integer.config_wifiBssidBlocklistAbnormalDisconnectTimeWindowMs,
@@ -125,13 +128,13 @@ public class BssidBlocklistMonitorTest {
when(mContext.getResources()).thenReturn(mResources);
mBssidBlocklistMonitor = new BssidBlocklistMonitor(mContext, mWifiConnectivityHelper,
- mWifiLastResortWatchdog, mClock, mLocalLog, mWifiScoreCard);
+ mWifiLastResortWatchdog, mClock, mLocalLog, mWifiScoreCard, mScoringParams);
}
private void verifyAddTestBssidToBlocklist() {
mBssidBlocklistMonitor.handleBssidConnectionFailure(
TEST_BSSID_1, TEST_SSID_1,
- BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, false);
+ BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, TEST_GOOD_RSSI);
assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
}
@@ -139,12 +142,15 @@ public class BssidBlocklistMonitorTest {
private void verifyAddMultipleBssidsToBlocklist() {
when(mClock.getWallClockMillis()).thenReturn(0L);
mBssidBlocklistMonitor.handleBssidConnectionFailure(TEST_BSSID_1,
- TEST_SSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, false);
+ TEST_SSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA,
+ TEST_GOOD_RSSI);
when(mClock.getWallClockMillis()).thenReturn(1L);
mBssidBlocklistMonitor.handleBssidConnectionFailure(TEST_BSSID_2,
- TEST_SSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, false);
+ TEST_SSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA,
+ TEST_GOOD_RSSI);
mBssidBlocklistMonitor.handleBssidConnectionFailure(TEST_BSSID_3,
- TEST_SSID_2, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, false);
+ TEST_SSID_2, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA,
+ TEST_GOOD_RSSI);
// Verify that we have 3 BSSIDs in the blocklist.
Set<String> bssidList = mBssidBlocklistMonitor.updateAndGetBssidBlocklist();
@@ -161,7 +167,8 @@ public class BssidBlocklistMonitorTest {
private void handleBssidConnectionFailureMultipleTimes(String bssid, String ssid, int reason,
int times) {
for (int i = 0; i < times; i++) {
- mBssidBlocklistMonitor.handleBssidConnectionFailure(bssid, ssid, reason, false);
+ mBssidBlocklistMonitor.handleBssidConnectionFailure(bssid, ssid, reason,
+ TEST_GOOD_RSSI);
}
}
@@ -194,22 +201,6 @@ public class BssidBlocklistMonitorTest {
}
/**
- * Verify that a BSSID is blocked for a shorter time if the failure reason is association
- * timeout and the RSSI is low.
- */
- @Test
- public void testAssociationTimeoutAtLowRssi() {
- for (int i = 0; i < NUM_FAILURES_TO_BLOCKLIST; i++) {
- mBssidBlocklistMonitor.handleBssidConnectionFailure(TEST_BSSID_1, TEST_SSID_1,
- BssidBlocklistMonitor.REASON_ASSOCIATION_TIMEOUT, true);
- }
- when(mClock.getWallClockMillis()).thenReturn(BASE_LOW_RSSI_BLOCKLIST_DURATION);
- assertEquals(1, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
- when(mClock.getWallClockMillis()).thenReturn(BASE_LOW_RSSI_BLOCKLIST_DURATION + 1);
- assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
- }
-
- /**
* Verify that updateAndGetBssidBlocklist(ssid) updates firmware roaming configuration
* if a BSSID that belongs to the ssid is removed from blocklist.
*/
@@ -309,7 +300,7 @@ public class BssidBlocklistMonitorTest {
.thenReturn(0L);
when(mClock.getWallClockMillis()).thenReturn(ABNORMAL_DISCONNECT_TIME_WINDOW_MS + 1);
assertFalse(mBssidBlocklistMonitor.handleBssidConnectionFailure(TEST_BSSID_1, TEST_SSID_1,
- BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT, false));
+ BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT, TEST_GOOD_RSSI));
verify(mWifiScoreCard, never()).incrementBssidBlocklistStreak(TEST_SSID_1, TEST_BSSID_1,
BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT);
@@ -317,7 +308,7 @@ public class BssidBlocklistMonitorTest {
// added to blocklist.
when(mClock.getWallClockMillis()).thenReturn(ABNORMAL_DISCONNECT_TIME_WINDOW_MS);
assertTrue(mBssidBlocklistMonitor.handleBssidConnectionFailure(TEST_BSSID_1, TEST_SSID_1,
- BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT, false));
+ BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT, TEST_GOOD_RSSI));
verify(mWifiScoreCard).incrementBssidBlocklistStreak(TEST_SSID_1, TEST_BSSID_1,
BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT);
}
@@ -331,7 +322,7 @@ public class BssidBlocklistMonitorTest {
when(mWifiScoreCard.getBssidBlocklistStreak(anyString(), anyString(), anyInt()))
.thenReturn(1);
assertTrue(mBssidBlocklistMonitor.handleBssidConnectionFailure(
- TEST_BSSID_1, TEST_SSID_1, TEST_L2_FAILURE, false));
+ TEST_BSSID_1, TEST_SSID_1, TEST_L2_FAILURE, TEST_GOOD_RSSI));
assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
}
@@ -572,7 +563,8 @@ public class BssidBlocklistMonitorTest {
for (int i = 0; i < 10; i++) {
when(mClock.getWallClockMillis()).thenReturn((long) i);
mBssidBlocklistMonitor.handleBssidConnectionFailure(bssid + i,
- TEST_SSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, false);
+ TEST_SSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA,
+ TEST_GOOD_RSSI);
// This will build a List of BSSIDs starting from the latest added ones that is at
// most size |TEST_NUM_MAX_FIRMWARE_SUPPORT_BSSIDS|.
@@ -676,7 +668,7 @@ public class BssidBlocklistMonitorTest {
when(mClock.getWallClockMillis()).thenReturn(0L);
long testDuration = 5500L;
mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration,
- TEST_FRAMEWORK_BLOCK_REASON);
+ TEST_FRAMEWORK_BLOCK_REASON, TEST_GOOD_RSSI);
assertEquals(1, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
// Verify that the BSSID is removed from blocklist by clearBssidBlocklistForSsid
@@ -686,7 +678,7 @@ public class BssidBlocklistMonitorTest {
// Add the BSSID to blocklist again.
mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, testDuration,
- TEST_FRAMEWORK_BLOCK_REASON);
+ TEST_FRAMEWORK_BLOCK_REASON, TEST_GOOD_RSSI);
assertEquals(1, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
// Verify that the BSSID is removed from blocklist once the specified duration is over.
@@ -704,17 +696,84 @@ public class BssidBlocklistMonitorTest {
when(mClock.getWallClockMillis()).thenReturn(0L);
long testDuration = 5500L;
mBssidBlocklistMonitor.blockBssidForDurationMs(null, TEST_SSID_1, testDuration,
- TEST_FRAMEWORK_BLOCK_REASON);
+ TEST_FRAMEWORK_BLOCK_REASON, TEST_GOOD_RSSI);
assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
// test invalid SSID
mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, null, testDuration,
- TEST_FRAMEWORK_BLOCK_REASON);
+ TEST_FRAMEWORK_BLOCK_REASON, TEST_GOOD_RSSI);
assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
// test invalid duration
mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, -1,
- TEST_FRAMEWORK_BLOCK_REASON);
+ TEST_FRAMEWORK_BLOCK_REASON, TEST_GOOD_RSSI);
assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
}
+
+ private void simulateRssiUpdate(String bssid, int rssi) {
+ ScanDetail scanDetail = mock(ScanDetail.class);
+ ScanResult scanResult = mock(ScanResult.class);
+ scanResult.BSSID = bssid;
+ scanResult.level = rssi;
+ when(scanDetail.getScanResult()).thenReturn(scanResult);
+ List<ScanDetail> scanDetails = new ArrayList<>();
+ scanDetails.add(scanDetail);
+ mBssidBlocklistMonitor.tryEnablingBlockedBssids(scanDetails);
+ }
+
+ /**
+ * Verify that if the RSSI is low when the BSSID is blocked, a RSSI improvement will remove
+ * the BSSID from blocklist.
+ */
+ @Test
+ public void testUnblockBssidAfterRssiImproves() {
+ when(mClock.getWallClockMillis()).thenReturn(0L);
+ // verify TEST_BSSID_1 is blocked
+ mBssidBlocklistMonitor.handleBssidConnectionFailure(
+ TEST_BSSID_1, TEST_SSID_1, BssidBlocklistMonitor.REASON_EAP_FAILURE,
+ TEST_SUFFICIENT_RSSI - MIN_RSSI_DIFF_TO_UNBLOCK_BSSID);
+ assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
+
+ // verify the blocklist is not cleared when the rssi improvement is not large enough.
+ simulateRssiUpdate(TEST_BSSID_1, TEST_SUFFICIENT_RSSI - 1);
+ assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
+
+ // verify TEST_BSSID_1 is removed from the blocklist after RSSI improves
+ simulateRssiUpdate(TEST_BSSID_1, TEST_SUFFICIENT_RSSI);
+ assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size());
+ }
+
+ /**
+ * Verify that if the RSSI is already good when the BSSID is blocked, a RSSI improvement will
+ * not remove the BSSID from blocklist.
+ */
+ @Test
+ public void testBssidNotUnblockedIfRssiAlreadyGood() {
+ when(mClock.getWallClockMillis()).thenReturn(0L);
+ // verify TEST_BSSID_1 is blocked
+ mBssidBlocklistMonitor.handleBssidConnectionFailure(
+ TEST_BSSID_1, TEST_SSID_1, BssidBlocklistMonitor.REASON_EAP_FAILURE,
+ TEST_SUFFICIENT_RSSI);
+ assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
+
+ // verify TEST_BSSID_1 is not removed from blocklist
+ simulateRssiUpdate(TEST_BSSID_1, TEST_GOOD_RSSI);
+ assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
+ }
+
+ /**
+ * Verify that the logic to unblock BSSIDs after RSSI improvement does not apply for some
+ * failure reasons.
+ */
+ @Test
+ public void testRssiImprovementNotUnblockBssidForSomeFailureReasons() {
+ when(mClock.getWallClockMillis()).thenReturn(0L);
+ mBssidBlocklistMonitor.handleBssidConnectionFailure(
+ TEST_BSSID_1, TEST_SSID_1, BssidBlocklistMonitor.REASON_WRONG_PASSWORD,
+ TEST_SUFFICIENT_RSSI - MIN_RSSI_DIFF_TO_UNBLOCK_BSSID);
+ assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
+
+ simulateRssiUpdate(TEST_BSSID_1, TEST_SUFFICIENT_RSSI);
+ assertTrue(mBssidBlocklistMonitor.updateAndGetBssidBlocklist().contains(TEST_BSSID_1));
+ }
}
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index b945a8b81..cf1c4f97a 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -1742,10 +1742,10 @@ public class ClientModeImplTest extends WifiBaseTest {
// by DHCP failure
verify(mWifiLastResortWatchdog, times(2)).noteConnectionFailureAndTriggerIfNeeded(
sSSID, sBSSID, WifiLastResortWatchdog.FAILURE_CODE_DHCP);
- verify(mBssidBlocklistMonitor, times(2)).handleBssidConnectionFailure(sBSSID,
- sSSID, BssidBlocklistMonitor.REASON_DHCP_FAILURE, false);
- verify(mBssidBlocklistMonitor, times(2)).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_DHCP_FAILURE, false);
+ verify(mBssidBlocklistMonitor, times(2)).handleBssidConnectionFailure(eq(sBSSID),
+ eq(sSSID), eq(BssidBlocklistMonitor.REASON_DHCP_FAILURE), anyInt());
+ verify(mBssidBlocklistMonitor, times(2)).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_DHCP_FAILURE), anyInt());
verify(mBssidBlocklistMonitor, never()).handleDhcpProvisioningSuccess(sBSSID, sSSID);
verify(mBssidBlocklistMonitor, never()).handleNetworkValidationSuccess(sBSSID, sSSID);
}
@@ -3136,8 +3136,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mCmi.sendMessage(WifiMonitor.NETWORK_DISCONNECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();
- verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT, false);
+ verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT), anyInt());
}
/**
@@ -3146,6 +3146,7 @@ public class ClientModeImplTest extends WifiBaseTest {
*/
@Test
public void testNotifiesBssidBlocklistMonitorLowRssi() throws Exception {
+ int testLowRssi = -80;
initializeAndAddNetworkAndVerifySuccess();
mCmi.sendMessage(ClientModeImpl.CMD_START_CONNECT, FRAMEWORK_NETWORK_ID, 0,
ClientModeImpl.SUPPLICANT_BSSID_ANY);
@@ -3154,13 +3155,13 @@ public class ClientModeImplTest extends WifiBaseTest {
when(mWifiConfigManager.getScanDetailCacheForNetwork(FRAMEWORK_NETWORK_ID))
.thenReturn(mScanDetailCache);
when(mScanDetailCache.getScanDetail(sBSSID)).thenReturn(
- getGoogleGuestScanDetail(-80, sBSSID, sFreq));
+ getGoogleGuestScanDetail(testLowRssi, sBSSID, sFreq));
when(mScanDetailCache.getScanResult(sBSSID)).thenReturn(
- getGoogleGuestScanDetail(-80, sBSSID, sFreq).getScanResult());
+ getGoogleGuestScanDetail(testLowRssi, sBSSID, sFreq).getScanResult());
mLooper.dispatchAll();
verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_ASSOCIATION_TIMEOUT, true);
+ BssidBlocklistMonitor.REASON_ASSOCIATION_TIMEOUT, testLowRssi);
}
/**
@@ -3178,8 +3179,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mWifiLastResortWatchdog, never()).noteConnectionFailureAndTriggerIfNeeded(
anyString(), anyString(), anyInt());
- verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA, false);
+ verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA), anyInt());
}
/**
@@ -3197,8 +3198,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mWifiLastResortWatchdog).noteConnectionFailureAndTriggerIfNeeded(
anyString(), anyString(), anyInt());
- verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_ASSOCIATION_REJECTION, false);
+ verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_ASSOCIATION_REJECTION), anyInt());
verify(mWifiMetrics).incrementNumOfCarrierWifiConnectionNonAuthFailure();
}
@@ -3219,8 +3220,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mWifiLastResortWatchdog, never()).noteConnectionFailureAndTriggerIfNeeded(
anyString(), anyString(), anyInt());
- verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_WRONG_PASSWORD, false);
+ verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_WRONG_PASSWORD), anyInt());
}
/**
@@ -3240,8 +3241,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mWifiLastResortWatchdog, never()).noteConnectionFailureAndTriggerIfNeeded(
anyString(), anyString(), anyInt());
- verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_EAP_FAILURE, false);
+ verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_EAP_FAILURE), anyInt());
}
/**
@@ -3260,8 +3261,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mWifiLastResortWatchdog).noteConnectionFailureAndTriggerIfNeeded(
anyString(), anyString(), anyInt());
- verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_AUTHENTICATION_FAILURE, false);
+ verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(eq(sBSSID), eq(sSSID),
+ eq(BssidBlocklistMonitor.REASON_AUTHENTICATION_FAILURE), anyInt());
}
/**
@@ -3578,7 +3579,7 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiConfigManager).updateNetworkSelectionStatus(
FRAMEWORK_NETWORK_ID, DISABLED_NO_INTERNET_TEMPORARY);
verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
- BssidBlocklistMonitor.REASON_NETWORK_VALIDATION_FAILURE, true);
+ BssidBlocklistMonitor.REASON_NETWORK_VALIDATION_FAILURE, RSSI_THRESHOLD_BREACH_MIN);
verify(mWifiScoreCard).noteValidationFailure(any());
}
@@ -4349,7 +4350,7 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiMetrics, times(1)).incrementSteeringRequestCountIncludingMboAssocRetryDelay();
verify(mBssidBlocklistMonitor).blockBssidForDurationMs(eq(sBSSID), eq(sSSID),
- eq(btmFrmData.mBlackListDurationMs), anyInt());
+ eq(btmFrmData.mBlackListDurationMs), anyInt(), anyInt());
}
/**
@@ -4373,7 +4374,7 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(eq(sBSSID), eq(sSSID),
- eq(btmFrmData.mBlackListDurationMs), anyInt());
+ eq(btmFrmData.mBlackListDurationMs), anyInt(), 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 6b953175a..38d2e8275 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(), anyInt());
+ eq(CANDIDATE_SSID), anyLong(), anyInt(), anyInt());
// Verify another connection starting
verify(mWifiNS).selectNetwork((List<WifiCandidates.Candidate>)
argThat(new WifiCandidatesListSizeMatcher(1)));
@@ -2210,10 +2210,14 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
public void verifyBlacklistRefreshedAfterScanResults() {
when(mWifiConnectivityHelper.isFirmwareRoamingSupported()).thenReturn(true);
+ InOrder inOrder = inOrder(mBssidBlocklistMonitor);
// Force a connectivity scan
- verify(mBssidBlocklistMonitor, never()).updateAndGetBssidBlocklistForSsid(anyString());
+ inOrder.verify(mBssidBlocklistMonitor, never())
+ .updateAndGetBssidBlocklistForSsid(anyString());
mWifiConnectivityManager.forceConnectivityScan(WIFI_WORK_SOURCE);
- verify(mBssidBlocklistMonitor).updateAndGetBssidBlocklistForSsid(anyString());
+
+ inOrder.verify(mBssidBlocklistMonitor).tryEnablingBlockedBssids(any());
+ inOrder.verify(mBssidBlocklistMonitor).updateAndGetBssidBlocklistForSsid(anyString());
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
index 182abbb4e..9402e9900 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
@@ -782,7 +782,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiScoreReport.stopConnectedNetworkScorer();
mLooper.dispatchAll();
verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong(),
- anyInt());
+ anyInt(), anyInt());
}
/**
@@ -806,7 +806,8 @@ public class WifiScoreReportTest extends WifiBaseTest {
mLooper.dispatchAll();
mWifiScoreReport.stopConnectedNetworkScorer();
mLooper.dispatchAll();
- verify(mBssidBlocklistMonitor).blockBssidForDurationMs(any(), any(), anyLong(), anyInt());
+ verify(mBssidBlocklistMonitor).blockBssidForDurationMs(any(), any(), anyLong(), anyInt(),
+ anyInt());
}
/**
@@ -833,7 +834,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiScoreReport.stopConnectedNetworkScorer();
mLooper.dispatchAll();
verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong(),
- anyInt());
+ anyInt(), anyInt());
}
/**