diff options
author | Kai Shi <kaishi@google.com> | 2019-12-14 00:12:03 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-12-14 00:12:03 +0000 |
commit | ffb79a8b7811dda7f21cc1253d77395f29642f6f (patch) | |
tree | f44c33880ba4adbcb0c67f15b371aacd7905a08c | |
parent | fa5c4f437e6d73ae837b5829677b7e3b9e25dff8 (diff) | |
parent | a9fe56f7afda25ccaf77f90de8fc5a61f4afd9eb (diff) |
Merge "Wifi: enable ThroughputScorer by default to collect Tx/RxSpeed stats."
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkSelector.java | 2 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java | 30 |
2 files changed, 24 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java index e794ef7bc..426a81424 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSelector.java +++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java @@ -93,7 +93,7 @@ public class WifiNetworkSelector { /** * The identifier string of the CandidateScorer to use (in the absence of overrides). */ - public static final String PRESET_CANDIDATE_SCORER_NAME = "CompatibilityScorer"; + public static final String PRESET_CANDIDATE_SCORER_NAME = "ThroughputScorer"; /** * Experiment ID for the legacy scorer. diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java index ac49f1d25..7653e1a30 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java @@ -100,7 +100,12 @@ public class WifiNetworkSelectorTest extends WifiBaseTest { mScoreCardBasedScorer = new ScoreCardBasedScorer(mScoringParams); mThroughputScorer = new ThroughputScorer(mScoringParams); when(mWifiNative.getClientInterfaceName()).thenReturn("wlan0"); - mWifiNetworkSelector.registerCandidateScorer(mCompatibilityScorer); + if (WifiNetworkSelector.PRESET_CANDIDATE_SCORER_NAME.equals( + mThroughputScorer.getIdentifier())) { + mWifiNetworkSelector.registerCandidateScorer(mThroughputScorer); + } else { + mWifiNetworkSelector.registerCandidateScorer(mCompatibilityScorer); + } } /** Cleans up test. */ @@ -1452,7 +1457,7 @@ public class WifiNetworkSelectorTest extends WifiBaseTest { } /** - * Tests that metrics are recorded for 3 scorers (legacy, compat, and null scorer). + * Tests that metrics are recorded for 3 scorers. */ @Test public void testCandidateScorerMetrics_threeScorers() { @@ -1481,11 +1486,16 @@ public class WifiNetworkSelectorTest extends WifiBaseTest { } /** - * Tests that metrics are recorded for legacy scorer and throughput scorer. + * Tests that metrics are recorded for two scorers. */ @Test - public void testCandidateScorerMetricsThrougputScorer() { - mWifiNetworkSelector.registerCandidateScorer(mThroughputScorer); + public void testCandidateScorerMetricsThroughputScorer() { + if (WifiNetworkSelector.PRESET_CANDIDATE_SCORER_NAME.equals( + mThroughputScorer.getIdentifier())) { + mWifiNetworkSelector.registerCandidateScorer(mCompatibilityScorer); + } else { + mWifiNetworkSelector.registerCandidateScorer(mThroughputScorer); + } // add a second NetworkEvaluator that returns the second network in the scan list mWifiNetworkSelector.registerNetworkNominator( @@ -1498,8 +1508,14 @@ public class WifiNetworkSelectorTest extends WifiBaseTest { // Wanted 2 times since test2GhzHighQuality5GhzAvailable() calls // WifiNetworkSelector.selectNetwork() twice - verify(mWifiMetrics, times(2)).logNetworkSelectionDecision(throughputExpId, - compatibilityExpId, true, 2); + if (WifiNetworkSelector.PRESET_CANDIDATE_SCORER_NAME.equals( + mThroughputScorer.getIdentifier())) { + verify(mWifiMetrics, times(2)).logNetworkSelectionDecision( + compatibilityExpId, throughputExpId, true, 2); + } else { + verify(mWifiMetrics, times(2)).logNetworkSelectionDecision(throughputExpId, + compatibilityExpId, true, 2); + } } /** |