From 3fcdf58a464baac7156a75967e555467e35ac94b Mon Sep 17 00:00:00 2001 From: Kai Shi Date: Tue, 7 Jul 2020 04:44:33 +0000 Subject: Revert "Bug fix channel utilization during high traffic" This reverts commit 2800851c885bd0f228e42a587c1db33da98f29ce. Reason for revert: the merged CL has a wrong Merged-In which prevents the CL being auto-merged to other RVC branches including mainline-prod. Will re-submit a new CL with correct Merged-In so that it can be still auto-merged to other RVC branches but not into master. Bug: 159866355 Test: atest com.android.server.wifi Change-Id: I3fb0484ca365c13a547d371b69fe5548a39bdb99 Merged-In: I6e131f149d242e5dbf0b8b0087303e85ed428f9f --- .../server/wifi/WifiChannelUtilization.java | 27 ++----------------- .../java/com/android/server/wifi/WifiInjector.java | 4 +-- service/res/values/config.xml | 9 ------- service/res/values/overlayable.xml | 4 --- .../server/wifi/WifiChannelUtilizationTest.java | 30 +--------------------- .../com/android/server/wifi/WifiDataStallTest.java | 2 +- 6 files changed, 6 insertions(+), 70 deletions(-) diff --git a/service/java/com/android/server/wifi/WifiChannelUtilization.java b/service/java/com/android/server/wifi/WifiChannelUtilization.java index 5e8cde61d..906e2d04c 100644 --- a/service/java/com/android/server/wifi/WifiChannelUtilization.java +++ b/service/java/com/android/server/wifi/WifiChannelUtilization.java @@ -19,8 +19,6 @@ 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; @@ -29,7 +27,6 @@ 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; @@ -63,7 +60,6 @@ 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; @@ -76,8 +72,7 @@ public class WifiChannelUtilization { private long mLastChannelStatsMapTimeStamp; private int mLastChannelStatsMapMobilityState; - WifiChannelUtilization(Clock clock, Context context) { - mContext = context; + WifiChannelUtilization(Clock clock) { mClock = clock; } @@ -90,7 +85,7 @@ public class WifiChannelUtilization { } /** - * (Re)initialize internal variables and status + * Initialize internal variables and status after wifi is enabled * @param wifiLinkLayerStats The latest wifi link layer stats */ public void init(WifiLinkLayerStats wifiLinkLayerStats) { @@ -125,19 +120,6 @@ 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); } @@ -171,11 +153,6 @@ 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 b9aa0521f..8f6465b00 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, mContext); + mWifiChannelUtilizationConnected = new WifiChannelUtilization(mClock); 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, mContext); + mWifiChannelUtilizationScan = new WifiChannelUtilization(mClock); 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 cc80f608c..4ea23adc0 100644 --- a/service/res/values/config.xml +++ b/service/res/values/config.xml @@ -422,15 +422,6 @@ 3000 - - true - - 80 - 15 - 10 - true diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml index a4b7011b0..b02eb9e77 100644 --- a/service/res/values/overlayable.xml +++ b/service/res/values/overlayable.xml @@ -132,10 +132,6 @@ - - - - diff --git a/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java b/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java index bb6ff74a3..31fc7b7a9 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java @@ -30,13 +30,10 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*; import static org.mockito.Mockito.validateMockitoUsage; -import android.content.Context; - import androidx.test.filters.SmallTest; import com.android.server.wifi.WifiLinkLayerStats.ChannelStats; import com.android.server.wifi.util.InformationElementUtil.BssLoad; -import com.android.wifi.resources.R; import org.junit.After; import org.junit.Before; @@ -51,19 +48,13 @@ import org.mockito.MockitoAnnotations; public class WifiChannelUtilizationTest extends WifiBaseTest { private WifiChannelUtilization mWifiChannelUtilization; @Mock private Clock mClock; - @Mock Context mContext; - MockResources mMockResources = new MockResources(); /** * Called before each test */ @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - when(mContext.getResources()).thenReturn(mMockResources); - mMockResources.setBoolean( - R.bool.config_wifiChannelUtilizationOverrideEnabled, - false); - mWifiChannelUtilization = new WifiChannelUtilization(mClock, mContext); + mWifiChannelUtilization = new WifiChannelUtilization(mClock); mWifiChannelUtilization.init(null); } @@ -437,23 +428,4 @@ public class WifiChannelUtilizationTest extends WifiBaseTest { mWifiChannelUtilization.setUtilizationRatio(freq, utilizationRatio); assertEquals(utilizationRatio, mWifiChannelUtilization.getUtilizationRatio(freq)); } - - @Test - public void verifyOverridingUtilizationRatio() throws Exception { - mMockResources.setBoolean( - R.bool.config_wifiChannelUtilizationOverrideEnabled, - true); - mMockResources.setInteger( - R.integer.config_wifiChannelUtilizationOverride2g, - 60); - mMockResources.setInteger( - R.integer.config_wifiChannelUtilizationOverride5g, - 20); - mMockResources.setInteger( - R.integer.config_wifiChannelUtilizationOverride6g, - 10); - assertEquals(60, mWifiChannelUtilization.getUtilizationRatio(2412)); - assertEquals(20, mWifiChannelUtilization.getUtilizationRatio(5810)); - assertEquals(10, mWifiChannelUtilization.getUtilizationRatio(6710)); - } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java index de1e5cb4e..4ed08a3d1 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java @@ -212,7 +212,7 @@ public class WifiDataStallTest extends WifiBaseTest { } /** - * Verify throughput when Rx link speed is unavailable. + * Verify throughtput when Rx link speed is unavailable. * Also verify the logging of channel utilization and throughput. */ @Test -- cgit v1.2.3