diff options
author | Oscar Shu <xshu@google.com> | 2020-09-16 16:42:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-09-16 16:42:21 +0000 |
commit | 61c09c33d23d149d1703d53591ee5a84554fd565 (patch) | |
tree | 8188b476d1d9040e74ed11408528ff245a1b0ee8 /service | |
parent | 6ff6c908a4c4bc65f071b76ec0866991be26404d (diff) | |
parent | 80d0986ea4ec6d2bff2af02a9e1a31593c200540 (diff) |
Merge "Exponential backoff for external score blocklist" into rvc-qpr-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/BssidBlocklistMonitor.java | 16 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiScoreReport.java | 4 | ||||
-rw-r--r-- | service/res/values/config.xml | 7 | ||||
-rw-r--r-- | service/res/values/overlayable.xml | 1 |
4 files changed, 23 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java index d96fdb39e..e3fe32ab7 100644 --- a/service/java/com/android/server/wifi/BssidBlocklistMonitor.java +++ b/service/java/com/android/server/wifi/BssidBlocklistMonitor.java @@ -330,8 +330,7 @@ public class BssidBlocklistMonitor { if (shouldWaitForWatchdogToTriggerFirst(bssid, reasonCode)) { return false; } - int baseBlockDurationMs = mContext.getResources().getInteger( - R.integer.config_wifiBssidBlocklistMonitorBaseBlockDurationMs); + int baseBlockDurationMs = getBaseBlockDurationForReason(reasonCode); addToBlocklist(entry, getBlocklistDurationWithExponentialBackoff(currentStreak, baseBlockDurationMs), reasonCode, rssi); @@ -341,6 +340,17 @@ public class BssidBlocklistMonitor { return false; } + private int getBaseBlockDurationForReason(int blockReason) { + switch (blockReason) { + case REASON_FRAMEWORK_DISCONNECT_CONNECTED_SCORE: + return mContext.getResources().getInteger(R.integer + .config_wifiBssidBlocklistMonitorConnectedScoreBaseBlockDurationMs); + default: + return mContext.getResources().getInteger( + R.integer.config_wifiBssidBlocklistMonitorBaseBlockDurationMs); + } + } + /** * Note a failure event on a bssid and perform appropriate actions. * @return True if the blocklist has been modified. @@ -383,6 +393,8 @@ public class BssidBlocklistMonitor { ssid, bssid, connectionTime); if (connectionTime - prevConnectionTime > ABNORMAL_DISCONNECT_RESET_TIME_MS) { mWifiScoreCard.resetBssidBlocklistStreak(ssid, bssid, REASON_ABNORMAL_DISCONNECT); + mWifiScoreCard.resetBssidBlocklistStreak(ssid, bssid, + REASON_FRAMEWORK_DISCONNECT_CONNECTED_SCORE); } BssidStatus status = mBssidStatusMap.get(bssid); diff --git a/service/java/com/android/server/wifi/WifiScoreReport.java b/service/java/com/android/server/wifi/WifiScoreReport.java index 80a561d05..bd92c6dac 100644 --- a/service/java/com/android/server/wifi/WifiScoreReport.java +++ b/service/java/com/android/server/wifi/WifiScoreReport.java @@ -60,7 +60,6 @@ public class WifiScoreReport { private static final int WIFI_CONNECTED_NETWORK_SCORER_IDENTIFIER = 0; private static final int INVALID_SESSION_ID = -1; private static final long MIN_TIME_TO_WAIT_BEFORE_BLOCKLIST_BSSID_MILLIS = 29000; - private static final long DURATION_TO_BLOCKLIST_BSSID_AFTER_FIRST_EXITING_MILLIS = 30000; private static final long INVALID_WALL_CLOCK_MILLIS = -1; /** @@ -751,9 +750,8 @@ public class WifiScoreReport { if ((mLastScoreBreachLowTimeMillis != INVALID_WALL_CLOCK_MILLIS) && ((millis - mLastScoreBreachLowTimeMillis) >= MIN_TIME_TO_WAIT_BEFORE_BLOCKLIST_BSSID_MILLIS)) { - mBssidBlocklistMonitor.blockBssidForDurationMs(mWifiInfo.getBSSID(), + mBssidBlocklistMonitor.handleBssidConnectionFailure(mWifiInfo.getBSSID(), mWifiInfo.getSSID(), - DURATION_TO_BLOCKLIST_BSSID_AFTER_FIRST_EXITING_MILLIS, 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 1220c260a..0264c3eae 100644 --- a/service/res/values/config.xml +++ b/service/res/values/config.xml @@ -355,6 +355,13 @@ config_wifiBssidBlocklistMonitorFailureStreakCap is set to 7--> <integer translatable="false" name="config_wifiBssidBlocklistMonitorBaseBlockDurationMs"> 300000 </integer> + <!-- Base duration to block a BSSID after the external connected scorer sets wifi as unusable. + The block duration is increased exponentially if the same BSSID is repeated marked as unusable. + 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. The block duration is reset to + the base value 3 hours after the latest connection to this BSSID. --> + <integer translatable="false" name="config_wifiBssidBlocklistMonitorConnectedScoreBaseBlockDurationMs"> 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 diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml index 56c94246d..60764ba6e 100644 --- a/service/res/values/overlayable.xml +++ b/service/res/values/overlayable.xml @@ -114,6 +114,7 @@ <item type="integer" name="config_wifiBssidBlocklistMonitorDhcpFailureThreshold" /> <item type="integer" name="config_wifiBssidBlocklistMonitorAbnormalDisconnectThreshold" /> <item type="integer" name="config_wifiBssidBlocklistMonitorBaseBlockDurationMs" /> + <item type="integer" name="config_wifiBssidBlocklistMonitorConnectedScoreBaseBlockDurationMs" /> <item type="integer" name="config_wifiBssidBlocklistMonitorFailureStreakCap" /> <item type="integer" name="config_wifiBssidBlocklistAbnormalDisconnectTimeWindowMs" /> <item type="bool" name="config_wifiScanHiddenNetworksScanOnlyMode" /> |