summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-07-07 22:07:53 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-07 22:07:53 +0000
commit281b5b2e2a4ddbd399ab4c337eb7d5cad6208821 (patch)
tree237244fd61326457c0eda0644925913a513fe16e /service
parentec181da32f6197c3fd6ac5c9c4eb0e7cea023e65 (diff)
parent05043809c3e9f5156aad48f43f1939253dbe1db7 (diff)
RESTRICT AUTOMERGE resubmit "Bug fix channel utilization during high traffic" am: 05043809c3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/12095044 Change-Id: I190cd8605dce9cf9f190e67025d6b702d0ec74b5
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiChannelUtilization.java27
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java4
-rw-r--r--service/res/values/config.xml9
-rw-r--r--service/res/values/overlayable.xml4
4 files changed, 40 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiChannelUtilization.java b/service/java/com/android/server/wifi/WifiChannelUtilization.java
index 906e2d04c..5e8cde61d 100644
--- a/service/java/com/android/server/wifi/WifiChannelUtilization.java
+++ b/service/java/com/android/server/wifi/WifiChannelUtilization.java
@@ -19,6 +19,8 @@ package com.android.server.wifi;
import static android.net.wifi.WifiManager.DEVICE_MOBILITY_STATE_STATIONARY;
import static android.net.wifi.WifiManager.DEVICE_MOBILITY_STATE_UNKNOWN;
+import android.content.Context;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager.DeviceMobilityState;
import android.util.Log;
import android.util.SparseArray;
@@ -27,6 +29,7 @@ import android.util.SparseIntArray;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wifi.WifiLinkLayerStats.ChannelStats;
import com.android.server.wifi.util.InformationElementUtil.BssLoad;
+import com.android.wifi.resources.R;
import java.util.ArrayDeque;
import java.util.Iterator;
@@ -60,6 +63,7 @@ public class WifiChannelUtilization {
@VisibleForTesting
static final int CHANNEL_STATS_CACHE_SIZE = 5;
private final Clock mClock;
+ private final Context mContext;
private @DeviceMobilityState int mDeviceMobilityState = DEVICE_MOBILITY_STATE_UNKNOWN;
private int mCacheUpdateIntervalMinMs = DEFAULT_CACHE_UPDATE_INTERVAL_MIN_MS;
@@ -72,7 +76,8 @@ public class WifiChannelUtilization {
private long mLastChannelStatsMapTimeStamp;
private int mLastChannelStatsMapMobilityState;
- WifiChannelUtilization(Clock clock) {
+ WifiChannelUtilization(Clock clock, Context context) {
+ mContext = context;
mClock = clock;
}
@@ -85,7 +90,7 @@ public class WifiChannelUtilization {
}
/**
- * Initialize internal variables and status after wifi is enabled
+ * (Re)initialize internal variables and status
* @param wifiLinkLayerStats The latest wifi link layer stats
*/
public void init(WifiLinkLayerStats wifiLinkLayerStats) {
@@ -120,6 +125,19 @@ public class WifiChannelUtilization {
* @return Utilization ratio value if it is available; BssLoad.INVALID otherwise
*/
public int getUtilizationRatio(int frequency) {
+ if (mContext.getResources().getBoolean(
+ R.bool.config_wifiChannelUtilizationOverrideEnabled)) {
+ if (ScanResult.is24GHz(frequency)) {
+ return mContext.getResources().getInteger(
+ R.integer.config_wifiChannelUtilizationOverride2g);
+ }
+ if (ScanResult.is5GHz(frequency)) {
+ return mContext.getResources().getInteger(
+ R.integer.config_wifiChannelUtilizationOverride5g);
+ }
+ return mContext.getResources().getInteger(
+ R.integer.config_wifiChannelUtilizationOverride6g);
+ }
return mChannelUtilizationMap.get(frequency, BssLoad.INVALID);
}
@@ -153,6 +171,11 @@ public class WifiChannelUtilization {
*/
public void refreshChannelStatsAndChannelUtilization(WifiLinkLayerStats wifiLinkLayerStats,
int frequency) {
+ if (mContext.getResources().getBoolean(
+ R.bool.config_wifiChannelUtilizationOverrideEnabled)) {
+ return;
+ }
+
if (wifiLinkLayerStats == null) {
return;
}
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 8f6465b00..b9aa0521f 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -329,7 +329,7 @@ public class WifiInjector {
mWifiDiagnostics = new WifiDiagnostics(
mContext, this, mWifiNative, mBuildProperties,
new LastMileLogger(this), mClock);
- mWifiChannelUtilizationConnected = new WifiChannelUtilization(mClock);
+ mWifiChannelUtilizationConnected = new WifiChannelUtilization(mClock, mContext);
mWifiDataStall = new WifiDataStall(mFrameworkFacade, mWifiMetrics, mContext,
mDeviceConfigFacade, mWifiChannelUtilizationConnected, mClock, wifiHandler,
mThroughputPredictor);
@@ -617,7 +617,7 @@ public class WifiInjector {
mBssidBlocklistMonitor = new BssidBlocklistMonitor(mContext, mWifiConnectivityHelper,
mWifiLastResortWatchdog, mClock, mConnectivityLocalLog, mWifiScoreCard);
mWifiMetrics.setBssidBlocklistMonitor(mBssidBlocklistMonitor);
- mWifiChannelUtilizationScan = new WifiChannelUtilization(mClock);
+ mWifiChannelUtilizationScan = new WifiChannelUtilization(mClock, mContext);
return new WifiConnectivityManager(mContext, getScoringParams(),
clientModeImpl, this,
mWifiConfigManager, mWifiNetworkSuggestionsManager, clientModeImpl.getWifiInfo(),
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index 4ea23adc0..cc80f608c 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -422,6 +422,15 @@
<!-- Integer indicating the RSSI and link layer stats polling interval in milliseconds when device is connected and screen is on -->
<integer translatable="false" name="config_wifiPollRssiIntervalMilliseconds">3000</integer>
+ <!-- Override channel utilization estimation with fixed value -->
+ <bool translatable="false" name="config_wifiChannelUtilizationOverrideEnabled">true</bool>
+ <!-- Integer values represent the channel utilization in different RF bands when
+ config_wifiChannelUtilizationOverridingEnabled is true.
+ They should be set to [0, 255] corresponding to utilization ratio between 0 and 1 -->
+ <integer translatable="false" name="config_wifiChannelUtilizationOverride2g">80</integer>
+ <integer translatable="false" name="config_wifiChannelUtilizationOverride5g">15</integer>
+ <integer translatable="false" name="config_wifiChannelUtilizationOverride6g">10</integer>
+
<!-- Enable WPA2 to WPA3 auto-upgrade -->
<bool translatable="false" name="config_wifiSaeUpgradeEnabled">true</bool>
diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml
index b02eb9e77..a4b7011b0 100644
--- a/service/res/values/overlayable.xml
+++ b/service/res/values/overlayable.xml
@@ -132,6 +132,10 @@
<item type="integer" name="config_wifiHighMovementNetworkSelectionOptimizationRssiDelta" />
<item type="integer" name="config_wifiRttBackgroundExecGapMs" />
<item type="integer" name="config_wifiPollRssiIntervalMilliseconds" />
+ <item type="bool" name="config_wifiChannelUtilizationOverrideEnabled" />
+ <item type="integer" name="config_wifiChannelUtilizationOverride2g" />
+ <item type="integer" name="config_wifiChannelUtilizationOverride5g" />
+ <item type="integer" name="config_wifiChannelUtilizationOverride6g" />
<item type="bool" name="config_wifiSaeUpgradeEnabled" />
<item type="bool" name="config_wifiSaeUpgradeOffloadEnabled" />
<item type="integer" name="config_wifiMaxNativeFailureSelfRecoveryPerHour" />