summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorOscar Shu <xshu@google.com>2020-08-04 20:49:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-08-04 20:49:14 +0000
commit8c113bc36b80a18a0823ca6ce966c85747671b85 (patch)
treedfe84222003397b06b661a92226e2675b3652dd8 /service
parentb64129c61416da5a3817d328a7adb166485254ea (diff)
parentdd6ac245bb30bf99b3ef961f7b9fa3fe82261166 (diff)
Merge "Update firmware roaming config for connected network" into rvc-qpr-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/BssidBlocklistMonitor.java28
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java2
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java3
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java2
4 files changed, 31 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
index dffd77443..5b151d55f 100644
--- a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
+++ b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java
@@ -18,6 +18,7 @@ package com.android.server.wifi;
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.util.ArrayMap;
@@ -448,11 +449,36 @@ public class BssidBlocklistMonitor {
* @param ssid
* @return the number of BSSIDs currently in the blocklist for the |ssid|.
*/
- public int getNumBlockedBssidsForSsid(@NonNull String ssid) {
+ public int updateAndGetNumBlockedBssidsForSsid(@NonNull String ssid) {
return (int) updateAndGetBssidBlocklistInternal()
.filter(entry -> ssid.equals(entry.ssid)).count();
}
+ private int getNumBlockedBssidsForSsid(@Nullable String ssid) {
+ if (ssid == null) {
+ return 0;
+ }
+ return (int) mBssidStatusMap.values().stream()
+ .filter(entry -> entry.isInBlocklist && ssid.equals(entry.ssid))
+ .count();
+ }
+
+ /**
+ * Overloaded version of updateAndGetBssidBlocklist.
+ * Accepts a @Nullable String ssid as input, and updates the firmware roaming
+ * configuration if the blocklist for the input ssid has been changed.
+ * @param ssid to update firmware roaming configuration for.
+ * @return Set of BSSIDs currently in the blocklist
+ */
+ public Set<String> updateAndGetBssidBlocklistForSsid(@Nullable String ssid) {
+ int numBefore = getNumBlockedBssidsForSsid(ssid);
+ Set<String> bssidBlocklist = updateAndGetBssidBlocklist();
+ if (getNumBlockedBssidsForSsid(ssid) != numBefore) {
+ updateFirmwareRoamingConfiguration(ssid);
+ }
+ return bssidBlocklist;
+ }
+
/**
* Gets the BSSIDs that are currently in the blocklist.
* @return Set of BSSIDs currently in the blocklist
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 5b5c968c1..45a5d90b9 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -1801,7 +1801,7 @@ public class WifiConfigManager {
int disableReason = networkStatus.getNetworkSelectionDisableReason();
int blockedBssids = Math.min(MAX_BLOCKED_BSSID_PER_NETWORK,
mWifiInjector.getBssidBlocklistMonitor()
- .getNumBlockedBssidsForSsid(config.SSID));
+ .updateAndGetNumBlockedBssidsForSsid(config.SSID));
// if no BSSIDs are blocked then we should keep trying to connect to something
long disableTimeoutMs = 0;
if (blockedBssids > 0) {
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 2ce0bc024..131f4d1c1 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -304,7 +304,8 @@ public class WifiConnectivityManager {
updateUserDisabledList(scanDetails);
// Check if any blocklisted BSSIDs can be freed.
- Set<String> bssidBlocklist = mBssidBlocklistMonitor.updateAndGetBssidBlocklist();
+ Set<String> bssidBlocklist = mBssidBlocklistMonitor.updateAndGetBssidBlocklistForSsid(
+ mWifiInfo.getSSID());
if (mStateMachine.isSupplicantTransientState()) {
localLog(listenerName
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index a7544e031..6c2b5e369 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -1459,7 +1459,7 @@ public class WifiMetrics {
mScanResultRssiTimestampMillis = mClock.getElapsedSinceBootMillis();
}
mCurrentConnectionEvent.mConnectionEvent.numBssidInBlocklist =
- mBssidBlocklistMonitor.getNumBlockedBssidsForSsid(config.SSID);
+ mBssidBlocklistMonitor.updateAndGetNumBlockedBssidsForSsid(config.SSID);
mCurrentConnectionEvent.mConnectionEvent.networkType =
WifiMetricsProto.ConnectionEvent.TYPE_UNKNOWN;
mCurrentConnectionEvent.mConnectionEvent.isOsuProvisioned = false;