summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/BssidBlocklistMonitor.java106
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java22
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java3
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java5
-rw-r--r--service/java/com/android/server/wifi/WifiScoreReport.java3
-rw-r--r--service/res/values/config.xml10
-rw-r--r--service/res/values/overlayable.xml1
-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
11 files changed, 213 insertions, 128 deletions
diff --git a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
index 96b70c39e..bc41aa929 100644
--- a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
+++ b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
@@ -20,8 +20,10 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.util.ArrayMap;
+import android.util.ArraySet;
import android.util.LocalLog;
import android.util.Log;
@@ -33,8 +35,10 @@ import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -108,7 +112,18 @@ public class BssidBlocklistMonitor {
"REASON_FRAMEWORK_DISCONNECT_FAST_RECONNECT",
"REASON_FRAMEWORK_DISCONNECT_CONNECTED_SCORE"
};
+ private static final Set<Integer> LOW_RSSI_SENSITIVE_FAILURES = new ArraySet<>(Arrays.asList(
+ REASON_NETWORK_VALIDATION_FAILURE,
+ REASON_EAP_FAILURE,
+ REASON_ASSOCIATION_REJECTION,
+ REASON_ASSOCIATION_TIMEOUT,
+ REASON_AUTHENTICATION_FAILURE,
+ REASON_DHCP_FAILURE,
+ REASON_ABNORMAL_DISCONNECT,
+ REASON_FRAMEWORK_DISCONNECT_CONNECTED_SCORE
+ ));
private static final long ABNORMAL_DISCONNECT_RESET_TIME_MS = TimeUnit.HOURS.toMillis(3);
+ private static final int MIN_RSSI_DIFF_TO_UNBLOCK_BSSID = 5;
private static final String TAG = "BssidBlocklistMonitor";
private final Context mContext;
@@ -118,6 +133,7 @@ public class BssidBlocklistMonitor {
private final LocalLog mLocalLog;
private final Calendar mCalendar;
private final WifiScoreCard mWifiScoreCard;
+ private final ScoringParams mScoringParams;
// Map of bssid to BssidStatus
private Map<String, BssidStatus> mBssidStatusMap = new ArrayMap<>();
@@ -130,7 +146,7 @@ public class BssidBlocklistMonitor {
*/
BssidBlocklistMonitor(Context context, WifiConnectivityHelper connectivityHelper,
WifiLastResortWatchdog wifiLastResortWatchdog, Clock clock, LocalLog localLog,
- WifiScoreCard wifiScoreCard) {
+ WifiScoreCard wifiScoreCard, ScoringParams scoringParams) {
mContext = context;
mConnectivityHelper = connectivityHelper;
mWifiLastResortWatchdog = wifiLastResortWatchdog;
@@ -138,6 +154,7 @@ public class BssidBlocklistMonitor {
mLocalLog = localLog;
mCalendar = Calendar.getInstance();
mWifiScoreCard = wifiScoreCard;
+ mScoringParams = scoringParams;
}
// A helper to log debugging information in the local log buffer, which can
@@ -174,10 +191,11 @@ public class BssidBlocklistMonitor {
}
private void addToBlocklist(@NonNull BssidStatus entry, long durationMs,
- @FailureReason int reason) {
- entry.addToBlocklist(durationMs, reason);
+ @FailureReason int reason, int rssi) {
+ entry.setAsBlocked(durationMs, reason, rssi);
localLog(TAG + " addToBlocklist: bssid=" + entry.bssid + ", ssid=" + entry.ssid
- + ", durationMs=" + durationMs + ", reason=" + getFailureReasonString(reason));
+ + ", durationMs=" + durationMs + ", reason=" + getFailureReasonString(reason)
+ + ", rssi=" + rssi);
}
/**
@@ -237,12 +255,14 @@ public class BssidBlocklistMonitor {
* @param ssid identifies the SSID the AP belongs to.
* @param durationMs duration in millis to block.
* @param blockReason reason for blocking the BSSID.
+ * @param rssi the latest RSSI observed.
*/
public void blockBssidForDurationMs(@NonNull String bssid, @NonNull String ssid,
- long durationMs, @FailureReason int blockReason) {
+ long durationMs, @FailureReason int blockReason, int rssi) {
if (durationMs <= 0 || !isValidNetworkAndFailureReason(bssid, ssid, blockReason)) {
Log.e(TAG, "Invalid input: BSSID=" + bssid + ", SSID=" + ssid
- + ", durationMs=" + durationMs + ", blockReason=" + blockReason);
+ + ", durationMs=" + durationMs + ", blockReason=" + blockReason
+ + ", rssi=" + rssi);
return;
}
BssidStatus status = getOrCreateBssidStatus(bssid, ssid);
@@ -251,7 +271,7 @@ public class BssidBlocklistMonitor {
// Return because this BSSID is already being blocked for a longer time.
return;
}
- addToBlocklist(status, durationMs, blockReason);
+ addToBlocklist(status, durationMs, blockReason, rssi);
}
private String getFailureReasonString(@FailureReason int reasonCode) {
@@ -299,7 +319,7 @@ public class BssidBlocklistMonitor {
}
private boolean handleBssidConnectionFailureInternal(String bssid, String ssid,
- @FailureReason int reasonCode, boolean isLowRssi) {
+ @FailureReason int reasonCode, int rssi) {
BssidStatus entry = incrementFailureCountForBssid(bssid, ssid, reasonCode);
int failureThreshold = getFailureThresholdForReason(reasonCode);
int currentStreak = mWifiScoreCard.getBssidBlocklistStreak(ssid, bssid, reasonCode);
@@ -311,14 +331,9 @@ public class BssidBlocklistMonitor {
}
int baseBlockDurationMs = mContext.getResources().getInteger(
R.integer.config_wifiBssidBlocklistMonitorBaseBlockDurationMs);
- if ((reasonCode == REASON_ASSOCIATION_TIMEOUT
- || reasonCode == REASON_ABNORMAL_DISCONNECT) && isLowRssi) {
- baseBlockDurationMs = mContext.getResources().getInteger(
- R.integer.config_wifiBssidBlocklistMonitorBaseLowRssiBlockDurationMs);
- }
addToBlocklist(entry,
getBlocklistDurationWithExponentialBackoff(currentStreak, baseBlockDurationMs),
- reasonCode);
+ reasonCode, rssi);
mWifiScoreCard.incrementBssidBlocklistStreak(ssid, bssid, reasonCode);
return true;
}
@@ -330,7 +345,7 @@ public class BssidBlocklistMonitor {
* @return True if the blocklist has been modified.
*/
public boolean handleBssidConnectionFailure(String bssid, String ssid,
- @FailureReason int reasonCode, boolean isLowRssi) {
+ @FailureReason int reasonCode, int rssi) {
if (!isValidNetworkAndFailureReason(bssid, ssid, reasonCode)) {
return false;
}
@@ -343,7 +358,7 @@ public class BssidBlocklistMonitor {
return false;
}
}
- return handleBssidConnectionFailureInternal(bssid, ssid, reasonCode, isLowRssi);
+ return handleBssidConnectionFailureInternal(bssid, ssid, reasonCode, rssi);
}
/**
@@ -401,7 +416,10 @@ public class BssidBlocklistMonitor {
* remove the BSSID from blocklist to make sure we are not accidentally blocking good
* BSSIDs.
**/
- status.removeFromBlocklist();
+ if (status.isInBlocklist) {
+ mBssidStatusHistoryLogger.add(status, "Network validation success");
+ mBssidStatusMap.remove(bssid);
+ }
}
/**
@@ -510,6 +528,33 @@ public class BssidBlocklistMonitor {
}
/**
+ * Attempts to re-enable BSSIDs that likely experienced failures due to low RSSI.
+ * @param scanDetails
+ */
+ public void tryEnablingBlockedBssids(List<ScanDetail> scanDetails) {
+ if (scanDetails == null) {
+ return;
+ }
+ for (ScanDetail scanDetail : scanDetails) {
+ ScanResult scanResult = scanDetail.getScanResult();
+ if (scanResult == null) {
+ continue;
+ }
+ BssidStatus status = mBssidStatusMap.get(scanResult.BSSID);
+ if (status == null || !status.isInBlocklist
+ || !LOW_RSSI_SENSITIVE_FAILURES.contains(status.blockReason)) {
+ continue;
+ }
+ int sufficientRssi = mScoringParams.getSufficientRssi(scanResult.frequency);
+ if (status.lastRssi < sufficientRssi && scanResult.level >= sufficientRssi
+ && scanResult.level - status.lastRssi >= MIN_RSSI_DIFF_TO_UNBLOCK_BSSID) {
+ mBssidStatusHistoryLogger.add(status, "rssi significantly improved");
+ mBssidStatusMap.remove(status.bssid);
+ }
+ }
+ }
+
+ /**
* Removes expired BssidStatus entries and then return remaining entries in the blocklist.
* @return Stream of BssidStatus for BSSIDs that are in the blocklist.
*/
@@ -613,7 +658,9 @@ public class BssidBlocklistMonitor {
public final String bssid;
public final String ssid;
public final int[] failureCount = new int[NUMBER_REASON_CODES];
- private int mBlockReason = INVALID_REASON; // reason of blocking this BSSID
+ public int blockReason = INVALID_REASON; // reason of blocking this BSSID
+ // The latest RSSI that's seen before this BSSID is added to blocklist.
+ public int lastRssi = 0;
// The following are used to flag how long this BSSID stays in the blocklist.
public boolean isInBlocklist;
@@ -634,27 +681,17 @@ public class BssidBlocklistMonitor {
}
/**
- * Add this BSSID to blocklist for the specified duration.
+ * Set this BSSID as blocked for the specified duration.
* @param durationMs
* @param blockReason
+ * @param rssi
*/
- public void addToBlocklist(long durationMs, @FailureReason int blockReason) {
+ public void setAsBlocked(long durationMs, @FailureReason int blockReason, int rssi) {
isInBlocklist = true;
blocklistStartTimeMs = mClock.getWallClockMillis();
blocklistEndTimeMs = blocklistStartTimeMs + durationMs;
- mBlockReason = blockReason;
- }
-
- /**
- * Remove this BSSID from the blocklist.
- */
- public void removeFromBlocklist() {
- mBssidStatusHistoryLogger.add(this, "removeFromBlocklist");
- isInBlocklist = false;
- blocklistStartTimeMs = 0;
- blocklistEndTimeMs = 0;
- mBlockReason = INVALID_REASON;
- localLog(TAG + " removeFromBlocklist BSSID=" + bssid);
+ this.blockReason = blockReason;
+ lastRssi = rssi;
}
@Override
@@ -664,7 +701,8 @@ public class BssidBlocklistMonitor {
sb.append(", SSID=" + ssid);
sb.append(", isInBlocklist=" + isInBlocklist);
if (isInBlocklist) {
- sb.append(", blockReason=" + getFailureReasonString(mBlockReason));
+ sb.append(", blockReason=" + getFailureReasonString(blockReason));
+ sb.append(", lastRssi=" + lastRssi);
mCalendar.setTimeInMillis(blocklistStartTimeMs);
sb.append(", blocklistStartTimeMs="
+ String.format("%tm-%td %tH:%tM:%tS.%tL", mCalendar, mCalendar,
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index c73fe4bae..66972d468 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -2966,13 +2966,8 @@ public class ClientModeImpl extends StateMachine {
mWifiHealthMonitor.getScanRssiValidTimeMs());
mWifiScoreCard.noteConnectionFailure(mWifiInfo, scanRssi, ssid, blocklistReason);
checkAbnormalConnectionFailureAndTakeBugReport(ssid);
- boolean isLowRssi = false;
- int sufficientRssi = getSufficientRssi(networkId, bssid);
- if (scanRssi != WifiInfo.INVALID_RSSI && sufficientRssi != WifiInfo.INVALID_RSSI) {
- isLowRssi = scanRssi < sufficientRssi;
- }
mBssidBlocklistMonitor.handleBssidConnectionFailure(bssid, ssid, blocklistReason,
- isLowRssi);
+ scanRssi);
}
}
@@ -5421,14 +5416,10 @@ public class ClientModeImpl extends StateMachine {
config.networkId,
DISABLED_NO_INTERNET_TEMPORARY);
}
- int rssi = mWifiInfo.getRssi();
- int sufficientRssi = mWifiInjector.getScoringParams()
- .getSufficientRssi(mWifiInfo.getFrequency());
- boolean isLowRssi = rssi < sufficientRssi;
mBssidBlocklistMonitor.handleBssidConnectionFailure(
mLastBssid, config.SSID,
BssidBlocklistMonitor.REASON_NETWORK_VALIDATION_FAILURE,
- isLowRssi);
+ mWifiInfo.getRssi());
mWifiScoreCard.noteValidationFailure(mWifiInfo);
}
}
@@ -5484,13 +5475,10 @@ public class ClientModeImpl extends StateMachine {
boolean localGen = message.arg1 == 1;
if (!localGen) { // ignore disconnects initiated by wpa_supplicant.
mWifiScoreCard.noteNonlocalDisconnect(message.arg2);
- int rssi = mWifiInfo.getRssi();
- int sufficientRssi = mWifiInjector.getScoringParams()
- .getSufficientRssi(mWifiInfo.getFrequency());
- boolean isLowRssi = rssi < sufficientRssi;
mBssidBlocklistMonitor.handleBssidConnectionFailure(mWifiInfo.getBSSID(),
mWifiInfo.getSSID(),
- BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT, isLowRssi);
+ BssidBlocklistMonitor.REASON_ABNORMAL_DISCONNECT,
+ mWifiInfo.getRssi());
}
config = getCurrentWifiConfiguration();
@@ -6296,7 +6284,7 @@ public class ClientModeImpl extends StateMachine {
}
// Blacklist the current BSS
mBssidBlocklistMonitor.blockBssidForDurationMs(bssid, ssid, duration,
- BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_MBO_OCE);
+ BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_MBO_OCE, 0);
}
if (frameData.mStatus != MboOceConstants.BTM_RESPONSE_STATUS_ACCEPT) {
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index a6f58fbe6..77af65400 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -304,6 +304,7 @@ public class WifiConnectivityManager {
updateUserDisabledList(scanDetails);
// Check if any blocklisted BSSIDs can be freed.
+ mBssidBlocklistMonitor.tryEnablingBlockedBssids(scanDetails);
Set<String> bssidBlocklist = mBssidBlocklistMonitor.updateAndGetBssidBlocklistForSsid(
mWifiInfo.getSSID());
@@ -1760,7 +1761,7 @@ public class WifiConnectivityManager {
// to prevent the supplicant from trying it again.
mBssidBlocklistMonitor.blockBssidForDurationMs(bssid, ssid,
TEMP_BSSID_BLOCK_DURATION,
- BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_FAST_RECONNECT);
+ BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_FAST_RECONNECT, 0);
connectToNetwork(candidate);
}
} catch (IllegalArgumentException e) {
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index b9aa0521f..b18dd6a29 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -192,6 +192,7 @@ public class WifiInjector {
mFrameworkFacade = new FrameworkFacade();
mMacAddressUtil = new MacAddressUtil();
mContext = context;
+ mScoringParams = new ScoringParams(mContext);
mSettingsMigrationDataHolder = new SettingsMigrationDataHolder(mContext);
mConnectionFailureNotificationBuilder = new ConnectionFailureNotificationBuilder(
mContext, getWifiStackPackageName(), mFrameworkFacade);
@@ -284,7 +285,6 @@ public class WifiInjector {
mWifiConnectivityHelper = new WifiConnectivityHelper(mWifiNative);
mConnectivityLocalLog = new LocalLog(
mContext.getSystemService(ActivityManager.class).isLowRamDevice() ? 256 : 512);
- mScoringParams = new ScoringParams(mContext);
mWifiMetrics.setScoringParams(mScoringParams);
mThroughputPredictor = new ThroughputPredictor(mContext);
mWifiNetworkSelector = new WifiNetworkSelector(mContext, mWifiScoreCard, mScoringParams,
@@ -615,7 +615,8 @@ public class WifiInjector {
mWifiMetrics, clientModeImpl, mWifiHandlerThread.getLooper(), mDeviceConfigFacade,
mWifiThreadRunner);
mBssidBlocklistMonitor = new BssidBlocklistMonitor(mContext, mWifiConnectivityHelper,
- mWifiLastResortWatchdog, mClock, mConnectivityLocalLog, mWifiScoreCard);
+ mWifiLastResortWatchdog, mClock, mConnectivityLocalLog, mWifiScoreCard,
+ mScoringParams);
mWifiMetrics.setBssidBlocklistMonitor(mBssidBlocklistMonitor);
mWifiChannelUtilizationScan = new WifiChannelUtilization(mClock, mContext);
return new WifiConnectivityManager(mContext, getScoringParams(),
diff --git a/service/java/com/android/server/wifi/WifiScoreReport.java b/service/java/com/android/server/wifi/WifiScoreReport.java
index 61809113c..5a1e9d378 100644
--- a/service/java/com/android/server/wifi/WifiScoreReport.java
+++ b/service/java/com/android/server/wifi/WifiScoreReport.java
@@ -632,7 +632,8 @@ public class WifiScoreReport {
mBssidBlocklistMonitor.blockBssidForDurationMs(mWifiInfo.getBSSID(),
mWifiInfo.getSSID(),
DURATION_TO_BLOCKLIST_BSSID_AFTER_FIRST_EXITING_MILLIS,
- BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_CONNECTED_SCORE);
+ BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_CONNECTED_SCORE,
+ mWifiInfo.getRssi());
mLastScoreBreachLowTimeMillis = INVALID_WALL_CLOCK_MILLIS;
}
}
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index cc80f608c..742cf681f 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -355,20 +355,12 @@
config_wifiBssidBlocklistMonitorFailureStreakCap is set to 7-->
<integer translatable="false" name="config_wifiBssidBlocklistMonitorBaseBlockDurationMs"> 300000 </integer>
- <!-- Base block duration for a failure at low RSSI (less than the sufficient RSSI) used for
- ASSOCIATION_TIMEOUT, ABNORMAL_DISCONNECT, and NETWORK_VALIDATION failures. The block duration
- for a BSSID that keeps failing will grow exponentially to the this base duration.
- ie. 0.5/1/2/4/8/16/32/64 minutes - capped at 64 minutes because the default for
- config_wifiBssidBlocklistMonitorFailureStreakCap is set to 7.
- This value should be configured to be less than config_wifiBssidBlocklistMonitorBaseBlockDurationMs -->
- <integer translatable="false" name="config_wifiBssidBlocklistMonitorBaseLowRssiBlockDurationMs"> 30000 </integer>
-
<!-- The failure streak is the number of times a BSSID consecutively gets blocked without ever
successfully connecting in between, and is used to calculate the exponentially growing blocklist time.
The config_wifiBssidBlocklistMonitorFailureStreakCap controls how many times the block duration
could exponentially grow when a BSSID keeps failing.
ie. A value of 0 means BSSIDs are always blocked for the flat base duration defined by
- config_wifiBssidBlocklistMonitorBaseBlockDurationMs and config_wifiBssidBlocklistMonitorBaseLowRssiBlockDurationMs. -->
+ config_wifiBssidBlocklistMonitorBaseBlockDurationMs. -->
<integer translatable="false" name="config_wifiBssidBlocklistMonitorFailureStreakCap"> 7 </integer>
<!-- If a non-locally generated disconnect happens within this time window after association,
diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml
index a4b7011b0..8b592623f 100644
--- a/service/res/values/overlayable.xml
+++ b/service/res/values/overlayable.xml
@@ -114,7 +114,6 @@
<item type="integer" name="config_wifiBssidBlocklistMonitorDhcpFailureThreshold" />
<item type="integer" name="config_wifiBssidBlocklistMonitorAbnormalDisconnectThreshold" />
<item type="integer" name="config_wifiBssidBlocklistMonitorBaseBlockDurationMs" />
- <item type="integer" name="config_wifiBssidBlocklistMonitorBaseLowRssiBlockDurationMs" />
<item type="integer" name="config_wifiBssidBlocklistMonitorFailureStreakCap" />
<item type="integer" name="config_wifiBssidBlocklistAbnormalDisconnectTimeWindowMs" />
<item type="bool" name="config_wifiScanHiddenNetworksScanOnlyMode" />
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());
}
/**