Merge "Wipe the data in IpMemoryStore database upon network factory reset."

This commit is contained in:
Xiao Ma 2019-05-28 00:52:00 +00:00 • committed by Gerrit Code Review
commit 5ad000a641
2 changed files with 11 additions and 0 deletions

View file

@ -77,6 +77,7 @@ import android.net.INetworkStatsService;
import android.net.ISocketKeepaliveCallback;
import android.net.ITetheringEventCallback;
import android.net.InetAddresses;
import android.net.IpMemoryStore;
import android.net.IpPrefix;
import android.net.LinkProperties;
import android.net.LinkProperties.CompareResult;
@ -6893,6 +6894,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
final int userId = UserHandle.getCallingUserId();
final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
ipMemoryStore.factoryReset();
// Turn airplane mode off
setAirplaneMode(false);

View file

@ -321,4 +321,11 @@ public class IpMemoryStoreTest {
eq(TEST_OTHER_DATA_NAME), any());
assertEquals(TEST_NETWORK_ATTRIBUTES, new NetworkAttributes(mNapCaptor.getValue()));
}
@Test
public void testFactoryReset() throws RemoteException {
startIpMemoryStore(true /* supplyService */);
mStore.factoryReset();
verify(mMockService, times(1)).factoryReset();
}
}