summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-07-10 01:43:13 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-10 01:43:13 +0000
commitedb87e0f55153ee1b8203097332c3af5b458b947 (patch)
tree924b68779eb6b54f2843d9c292029a70d4f42b92
parent64e6a592206dffe0c57724552a40656d9adb5d35 (diff)
parent2022b51e1bf7fb88a409998b2bd31eaabe227e03 (diff)
Merge "wifi: remove cached hal data on updating a network" into rvc-dev am: 2022b51e1b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/12084866 Change-Id: I9de9dd0b3d8f2a63416d833c0279f3d340cc9b38
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java14
2 files changed, 17 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 678defbf2..6c31185da 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -1109,6 +1109,9 @@ public class ClientModeImpl extends StateMachine {
@Override
public void onNetworkUpdated(WifiConfiguration newConfig, WifiConfiguration oldConfig) {
+ // Clear invalid cached data.
+ mWifiNative.removeNetworkCachedData(oldConfig.networkId);
+
// Check if user/app change meteredOverride for connected network.
if (newConfig.networkId != mLastNetworkId
|| newConfig.meteredOverride == oldConfig.meteredOverride) {
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 11ee5cd7c..23726786d 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -5237,6 +5237,20 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiNative, never()).removeNetworkCachedData(anyInt());
}
+ /**
+ * Verify that network cached data is cleared on updating a network.
+ */
+ @Test
+ public void testNetworkCachedDataIsClearedOnUpdatingNetwork() throws Exception {
+ WifiConfiguration oldConfig = new WifiConfiguration(mConnectedNetwork);
+ mConnectedNetwork.meteredOverride = METERED_OVERRIDE_METERED;
+
+ mConfigUpdateListenerCaptor.getValue().onNetworkUpdated(mConnectedNetwork, oldConfig);
+ mLooper.dispatchAll();
+ verify(mWifiNative).removeNetworkCachedData(eq(oldConfig.networkId));
+ }
+
+
@Test
public void testIpReachabilityLostAndRoamEventsRace() throws Exception {
connect();