Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b35f19c7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use CS identity to update setting while performing factory reset" into sc-dev am: 1dc89984

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14674293

Change-Id: I77eba9e12795cc32f04073c3d18dc67dc1e3074b
parents 8a98acb1 1dc89984
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -8655,28 +8655,32 @@ public class ConnectivityService extends IConnectivityManager.Stub
    public void factoryReset() {
        enforceSettingsPermission();

        if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) {
        final int uid = mDeps.getCallingUid();
        final long token = Binder.clearCallingIdentity();
        try {
            if (mUserManager.hasUserRestrictionForUser(UserManager.DISALLOW_NETWORK_RESET,
                    UserHandle.getUserHandleForUid(uid))) {
                return;
            }

        final long token = Binder.clearCallingIdentity();
        try {
            final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
            ipMemoryStore.factoryReset();
        } finally {
            Binder.restoreCallingIdentity(token);
        }

            // Turn airplane mode off
            setAirplaneMode(false);

            // restore private DNS settings to default mode (opportunistic)
        if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_PRIVATE_DNS)) {
            ConnectivitySettingsManager.setPrivateDnsMode(mContext, PRIVATE_DNS_MODE_OPPORTUNISTIC);
            if (!mUserManager.hasUserRestrictionForUser(UserManager.DISALLOW_CONFIG_PRIVATE_DNS,
                    UserHandle.getUserHandleForUid(uid))) {
                ConnectivitySettingsManager.setPrivateDnsMode(mContext,
                        PRIVATE_DNS_MODE_OPPORTUNISTIC);
            }

            Settings.Global.putString(mContext.getContentResolver(),
                    ConnectivitySettingsManager.NETWORK_AVOID_BAD_WIFI, null);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    @Override