diff options
author | Mingguang Xu <mingguangxu@google.com> | 2020-09-03 10:43:08 -0700 |
---|---|---|
committer | Mingguang Xu <mingguangxu@google.com> | 2020-09-09 21:25:44 -0700 |
commit | d8f20d663f99203a51fa92dd0cba31712f68e650 (patch) | |
tree | 1be5fd184f93145fe5076a4acec2c637358ff558 /tests | |
parent | edc209e114cb84977b592bd4ef2fe8203a68951c (diff) |
Do not allow default network to be switched from WiFi to Cellular when RSSI is high
Under the two conditions:
When external scorer takes action;
The overlay to enable time hysteresis (config_wifiMinConfirmationDurationSendNetworkScoreEnabled) is enabled,
on top of the minimum confirmation duration added for sending low score to Connectivity Service, add a check on RSSI: If RSSI is higher than or equal to a configurable threshold (default -67dBm), then donot send any low score to Connectivity Service. This guarantees that default network will not be switched from WiFi to Cellular when RSSI is high (user is seeing three or four bars on WiFi icon).
The reason for adding RSSI check is that users are trained to look at high RSSI (e.g., three bars) as indication of good WiFi. This will certainly reduce any false alarms (especially for some IOT APs).
Bug: 167643965
Test: atest com.android.server.wifi
Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Change-Id: I31f1802a569603bbf4c50df2fbd73d71935e0f9d
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java | 5 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java index 43a16fe4c..a570d2948 100644 --- a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java @@ -209,6 +209,8 @@ public class DeviceConfigFacadeTest extends WifiBaseTest { mDeviceConfigFacade.getMinConfirmationDurationSendLowScoreMs()); assertEquals(DeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_HIGH_SCORE_MS, mDeviceConfigFacade.getMinConfirmationDurationSendHighScoreMs()); + assertEquals(DeviceConfigFacade.DEFAULT_RSSI_THRESHOLD_NOT_SEND_LOW_SCORE_TO_CS_DBM, + mDeviceConfigFacade.getRssiThresholdNotSendLowScoreToCsDbm()); } /** @@ -315,6 +317,8 @@ public class DeviceConfigFacadeTest extends WifiBaseTest { anyInt())).thenReturn(4000); when(DeviceConfig.getInt(anyString(), eq("min_confirmation_duration_send_high_score_ms"), anyInt())).thenReturn(1000); + when(DeviceConfig.getInt(anyString(), eq("rssi_threshold_not_send_low_score_to_cs_dbm"), + anyInt())).thenReturn(-70); mOnPropertiesChangedListenerCaptor.getValue().onPropertiesChanged(null); // Verifying fields are updated to the new values @@ -373,5 +377,6 @@ public class DeviceConfigFacadeTest extends WifiBaseTest { assertEquals(1000, mDeviceConfigFacade.getHealthMonitorFwAlertValidTimeMs()); assertEquals(4000, mDeviceConfigFacade.getMinConfirmationDurationSendLowScoreMs()); assertEquals(1000, mDeviceConfigFacade.getMinConfirmationDurationSendHighScoreMs()); + assertEquals(-70, mDeviceConfigFacade.getRssiThresholdNotSendLowScoreToCsDbm()); } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 82dbbe941..fb2d128cc 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -208,6 +208,8 @@ public class WifiScoreReportTest extends WifiBaseTest { DeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_LOW_SCORE_MS); when(mDeviceConfigFacade.getMinConfirmationDurationSendHighScoreMs()).thenReturn( DeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_HIGH_SCORE_MS); + when(mDeviceConfigFacade.getRssiThresholdNotSendLowScoreToCsDbm()).thenReturn( + DeviceConfigFacade.DEFAULT_RSSI_THRESHOLD_NOT_SEND_LOW_SCORE_TO_CS_DBM); } /** @@ -870,6 +872,7 @@ public class WifiScoreReportTest extends WifiBaseTest { mClock.mStepMillis = 0; mClock.mWallClockMillis = 10; + mWifiInfo.setRssi(-65); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 49); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(anyInt()); @@ -891,9 +894,11 @@ public class WifiScoreReportTest extends WifiBaseTest { mClock.mWallClockMillis = 10; scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 60); + mWifiInfo.setRssi(-70); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(60); mClock.mWallClockMillis = 3010; + mWifiInfo.setRssi(-65); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 59); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(59); @@ -904,11 +909,11 @@ public class WifiScoreReportTest extends WifiBaseTest { } /** - * Verify confirmation duration is added for reporting low score when it is enabled in - * config overlay + * Verify confirmation duration and RSSI check is added for reporting low score when it is + * enabled in config overlay */ @Test - public void confirmationDurationIsAddedForSendingLowScore() throws Exception { + public void confirmationDurationAndRssiCheckIsAddedForSendingLowScore() throws Exception { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); @@ -929,11 +934,13 @@ public class WifiScoreReportTest extends WifiBaseTest { verify(mNetworkAgent, never()).sendNetworkScore(anyInt()); mClock.mWallClockMillis = 10 + mDeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_LOW_SCORE_MS; + mWifiInfo.setRssi(-65); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 47); mLooper.dispatchAll(); - verify(mNetworkAgent).sendNetworkScore(47); + verify(mNetworkAgent, never()).sendNetworkScore(47); mClock.mWallClockMillis = 10 + mDeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_LOW_SCORE_MS + 3000; + mWifiInfo.setRssi(-68); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 46); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(46); @@ -958,6 +965,7 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mNetworkAgent, never()).sendNetworkScore(anyInt()); mClock.mWallClockMillis = 3000; + mWifiInfo.setRssi(-70); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 51); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(51); |