diff options
-rw-r--r-- | service/java/com/android/server/wifi/WifiScoreReport.java | 1 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiScoreReport.java b/service/java/com/android/server/wifi/WifiScoreReport.java index fa0ba6a3c..7819bba15 100644 --- a/service/java/com/android/server/wifi/WifiScoreReport.java +++ b/service/java/com/android/server/wifi/WifiScoreReport.java @@ -609,6 +609,7 @@ public class WifiScoreReport { + " sessionId=" + sessionId); return; } + mWifiInfo.setScore(ConnectedScore.WIFI_MAX_SCORE); mWifiConnectedNetworkScorerHolder.startSession(sessionId); mLastScoreBreachLowTimeMillis = INVALID_WALL_CLOCK_MILLIS; } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 674ff8c9d..3c752f97a 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -833,4 +833,15 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong()); } + + /** + * Verify that the initial score value in WifiInfo is the max when onStart is called. + */ + @Test + public void testOnStartInitialScoreInWifiInfoIsMaxScore() throws Exception { + when(mNetwork.getNetId()).thenReturn(TEST_NETWORK_ID); + mWifiScoreReport.startConnectedNetworkScorer(TEST_NETWORK_ID); + mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, mWifiConnectedNetworkScorer); + assertEquals(ConnectedScore.WIFI_MAX_SCORE, mWifiInfo.getScore()); + } } |