From 7ac44dcfd673f0408ecfa668bf05dea637bad2a0 Mon Sep 17 00:00:00 2001 From: Kai Shi Date: Wed, 20 May 2020 14:54:16 -0700 Subject: Increase security bonus score to 40 and reduce rssi cap 1) Increase security bonus score from 10 to 40 to be more in favor of secure network. 2) Reduce rssi cap from good_rssi_threshold to low_rssi_threshold (also known as sufficient_rssi_threshold) so that the network with clean channel and higher BW is more likely to be selected at middle range/rssi. Bug: 157081384 Test: atest com.android.server.wifi Test: manual test with adb shell dumpsys wifi and check wifiNetworkSelector logs Change-Id: I791ed9c683358003bb8e264ebf5c72c2fb710a6c --- .../src/com/android/server/wifi/CandidateScorerTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java b/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java index 7562da206..7b45848f7 100644 --- a/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java @@ -156,8 +156,8 @@ public class CandidateScorerTest extends WifiBaseTest { */ @Test public void testPreferHigherRssi() throws Exception { - assertThat(evaluate(mCandidate1.setScanRssi(-63)), - greaterThan(evaluate(mCandidate2.setScanRssi(-64)))); + assertThat(evaluate(mCandidate1.setScanRssi(-70)), + greaterThan(evaluate(mCandidate2.setScanRssi(-71)))); } /** @@ -174,9 +174,9 @@ public class CandidateScorerTest extends WifiBaseTest { */ @Test public void testPreferTheCurrentNetworkEvenIfRssiDifferenceIsSignificant() throws Exception { - assertThat(evaluate(mCandidate1.setScanRssi(-65).setCurrentNetwork(true) + assertThat(evaluate(mCandidate1.setScanRssi(-76).setCurrentNetwork(true) .setPredictedThroughputMbps(433)), - greaterThan(evaluate(mCandidate2.setScanRssi(-57) + greaterThan(evaluate(mCandidate2.setScanRssi(-69) .setPredictedThroughputMbps(433)))); } @@ -248,12 +248,15 @@ public class CandidateScorerTest extends WifiBaseTest { */ @Test public void testAboveSaturationDoNotSwitchAwayEvenWithALargeRssiDifference() throws Exception { - int goodRssi = mScoringParams.getGoodRssi(mCandidate1.getFrequency()); + int currentRssi = (mExpectedExpId == ThroughputScorer.THROUGHPUT_SCORER_DEFAULT_EXPID) + ? mScoringParams.getSufficientRssi(mCandidate1.getFrequency()) : + mScoringParams.getGoodRssi(mCandidate1.getFrequency()); int unbelievablyGoodRssi = -1; - assertThat(evaluate(mCandidate1.setScanRssi(goodRssi).setCurrentNetwork(true)), + assertThat(evaluate(mCandidate1.setScanRssi(currentRssi).setCurrentNetwork(true)), greaterThan(evaluate(mCandidate2.setScanRssi(unbelievablyGoodRssi)))); } + /** * Prefer high throughput network. */ -- cgit v1.2.3