From b404ef5816a176d7575bee9bfad2dd8151c3edb2 Mon Sep 17 00:00:00 2001 From: Hai Shalom Date: Wed, 19 Feb 2020 15:31:57 -0800 Subject: [Passpoint] Clear ANQP cache and requests during factory reset Clear ANQP cache and requests during factory reset. Bug: 149866949 Test: atest WifiServiceImplTest AnqpCacheTest Test: Perform factory reset and confirm ANQP cache and requests are emptied. Change-Id: I3cf7c9bda3a0cd51944aa384a50fe14d6370a612 --- .../src/com/android/server/wifi/WifiServiceImplTest.java | 1 + .../src/com/android/server/wifi/hotspot2/AnqpCacheTest.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index edd1a5ee8..08380614d 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -4021,6 +4021,7 @@ public class WifiServiceImplTest extends WifiBaseTest { network.networkId, Binder.getCallingUid(), TEST_PACKAGE_NAME); verify(mPasspointManager).removeProvider(anyInt(), anyBoolean(), eq(config.getUniqueId()), isNull()); + verify(mPasspointManager).clearAnqpRequestsAndFlushCache(); verify(mWifiConfigManager).clearDeletedEphemeralNetworks(); verify(mClientModeImpl).clearNetworkRequestUserApprovedAccessPoints(); verify(mWifiNetworkSuggestionsManager).clear(); diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/AnqpCacheTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/AnqpCacheTest.java index 1e3fdae39..c3c96cde5 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/AnqpCacheTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/AnqpCacheTest.java @@ -100,4 +100,16 @@ public class AnqpCacheTest extends WifiBaseTest { mCache.sweep(); assertNull(mCache.getEntry(ENTRY_KEY)); } + + /** + * Verify the expectation for the flush function (all entries will be removed). + * + * @throws Exception + */ + @Test + public void testCacheFlush() throws Exception { + mCache.addEntry(ENTRY_KEY, null); + mCache.flush(); + assertNull(mCache.getEntry(ENTRY_KEY)); + } } -- cgit v1.2.3