diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-21 00:15:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-21 00:15:13 +0000 |
commit | 0a0b43885adfb3b286f072338fbc02abac869646 (patch) | |
tree | db2bc36f2e58a4de2534b326496ae5c5c2a8e1f2 | |
parent | 8ad8c284ca31abac1a538f06205441937a4d6ded (diff) | |
parent | dc03a42f583af38731589078844de40f74c2cc9e (diff) |
Merge "[WifiScoreReport] Forget the NetworkAgent on disconnect" into rvc-dev
-rw-r--r-- | service/java/com/android/server/wifi/WifiScoreReport.java | 1 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiScoreReport.java b/service/java/com/android/server/wifi/WifiScoreReport.java index 5561a9104..fa0ba6a3c 100644 --- a/service/java/com/android/server/wifi/WifiScoreReport.java +++ b/service/java/com/android/server/wifi/WifiScoreReport.java @@ -617,6 +617,7 @@ public class WifiScoreReport { * Stop the registered Wi-Fi connected network scorer. */ public void stopConnectedNetworkScorer() { + mNetworkAgent = null; if (mWifiConnectedNetworkScorerHolder == null) { return; } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 5fe8eaac7..674ff8c9d 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -661,8 +661,12 @@ public class WifiScoreReportTest extends WifiBaseTest { mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, mWifiConnectedNetworkScorer); when(mNetwork.getNetId()).thenReturn(TEST_NETWORK_ID); mWifiScoreReport.startConnectedNetworkScorer(TEST_NETWORK_ID); + verify(mWifiConnectedNetworkScorer).onStart(TEST_SESSION_ID); mWifiScoreReport.stopConnectedNetworkScorer(); verify(mWifiConnectedNetworkScorer).onStop(TEST_SESSION_ID); + // After the session stops, it should not start again (without a new NetworkAgent) + mWifiScoreReport.startConnectedNetworkScorer(TEST_NETWORK_ID); + verify(mWifiConnectedNetworkScorer).onStart(anyInt()); } /** |