Change factoryReset to succeed for Settings

Wrap a part of factoryReset with Binder.withCleanCallingIdentity() so
that it doesn't crash thinking that a different uid connected to the
network stack.

Test: build, manual
Change-Id: Iea246a4c1939a4e7e35434137051835ece81d92f
This commit is contained in:
Heemin Seog
2019-06-12 09:21:44 -07:00
parent fe8af96eba
commit db8489dc29

View File

@@ -6892,8 +6892,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
final int userId = UserHandle.getCallingUserId();
final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
ipMemoryStore.factoryReset();
Binder.withCleanCallingIdentity(() -> {
final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
ipMemoryStore.factoryReset();
});
// Turn airplane mode off
setAirplaneMode(false);