summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java12
2 files changed, 14 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java b/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
index 98664d0fc..a9c99ae54 100644
--- a/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
+++ b/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
@@ -28,6 +28,7 @@ import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -92,6 +93,7 @@ public class ImsiPrivacyProtectionExemptionStoreData implements WifiConfigStore.
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
+ mDataSource.fromDeserialized(Collections.emptyMap());
return;
}
diff --git a/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
index ec2142dbf..77d5c1933 100644
--- a/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
@@ -17,6 +17,7 @@
package com.android.server.wifi;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -102,6 +103,17 @@ public class ImsiPrivacyProtectionExemptionStoreDataTest {
assertSerializeDeserialize(imsiPrivacyProtectionExemptionMap);
}
+ @Test
+ public void testDeserializeOnNewDeviceOrNewUser() throws Exception {
+ ArgumentCaptor<Map> deserializedNetworkSuggestionsMap =
+ ArgumentCaptor.forClass(Map.class);
+ mImsiPrivacyProtectionExemptionStoreData.deserializeData(null, 0,
+ WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION, null);
+ verify(mDataSource).fromDeserialized(deserializedNetworkSuggestionsMap.capture());
+ assertTrue(deserializedNetworkSuggestionsMap.getValue().isEmpty());
+ }
+
+
private Map<Integer, Boolean> assertSerializeDeserialize(
Map<Integer, Boolean> mImsiPrivacyProtectionExemptionMap) throws Exception {
// Setup the data to serialize.