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

Commit 588411fc authored by Suprabh Shukla's avatar Suprabh Shukla Committed by android-build-merger
Browse files

DO NOT MERGE Do not call RecoverySystem with DPMS lock held am: 4ffe72dc am: ab8d3feb

am: 2e6bdbea

Change-Id: I7e286445a887e467a7de42ce9b27a9dc009e47fd
parents 1d84f619 2e6bdbea
Loading
Loading
Loading
Loading
+32 −27
Original line number Diff line number Diff line
@@ -3321,7 +3321,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
    }

    private void wipeDataLocked(boolean wipeExtRequested, String reason) {
    private void wipeDataNoLock(boolean wipeExtRequested, String reason) {
        if (wipeExtRequested) {
            StorageManager sm = (StorageManager) mContext.getSystemService(
                    Context.STORAGE_SERVICE);
@@ -3340,13 +3340,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            return;
        }
        enforceCrossUserPermission(userHandle);
        final String source;
        synchronized (this) {
            // This API can only be called by an active device admin,
            // so try to retrieve it to check that the caller is one.
            final ActiveAdmin admin = getActiveAdminForCallerLocked(null,
                    DeviceAdminInfo.USES_POLICY_WIPE_DATA);

            final String source;
            final ComponentName cname = admin.info.getComponent();
            if (cname != null) {
                source = cname.flattenToShortString();
@@ -3371,18 +3371,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                        manager.wipe();
                    }
                }
                boolean wipeExtRequested = (flags & WIPE_EXTERNAL_STORAGE) != 0;
                wipeDeviceOrUserLocked(wipeExtRequested, userHandle,
                        "DevicePolicyManager.wipeData() from " + source);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
        boolean wipeExtRequested = (flags & WIPE_EXTERNAL_STORAGE) != 0;
        wipeDeviceNoLock(wipeExtRequested, userHandle,
                "DevicePolicyManager.wipeData() from " + source);
    }

    private void wipeDeviceOrUserLocked(boolean wipeExtRequested, final int userHandle, String reason) {
    private void wipeDeviceNoLock(boolean wipeExtRequested, final int userHandle, String reason) {
        long ident = Binder.clearCallingIdentity();
        try {
            if (userHandle == UserHandle.USER_OWNER) {
            wipeDataLocked(wipeExtRequested, reason);
                wipeDataNoLock(wipeExtRequested, reason);
            } else {
                mHandler.post(new Runnable() {
                    @Override
@@ -3405,6 +3407,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    }
                });
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    private void sendWipeProfileNotification() {
@@ -3561,7 +3566,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            }
            if (wipeData) {
                // Call without holding lock.
                wipeDeviceOrUserLocked(false, identifier,
                wipeDeviceNoLock(false, identifier,
                        "reportFailedPasswordAttempt()");
            }
        } finally {