Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +34 −28 Original line number Diff line number Diff line Loading @@ -4750,7 +4750,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); Loading @@ -4770,13 +4770,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } final int userHandle = mInjector.userHandleGetCallingUserId(); enforceFullCrossUsersPermission(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 = admin.info.getComponent().flattenToShortString(); source = admin.info.getComponent().flattenToShortString(); long ident = mInjector.binderClearCallingIdentity(); try { Loading @@ -4791,18 +4792,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { manager.wipe(); } } boolean wipeExtRequested = (flags & WIPE_EXTERNAL_STORAGE) != 0; wipeDeviceOrUserLocked(wipeExtRequested, userHandle, "DevicePolicyManager.wipeData() from " + source); } finally { mInjector.binderRestoreCallingIdentity(ident); } } final 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) { final long ident = mInjector.binderClearCallingIdentity(); try { if (userHandle == UserHandle.USER_SYSTEM) { wipeDataLocked(wipeExtRequested, reason); wipeDataNoLock(wipeExtRequested, reason); } else { mHandler.post(new Runnable() { @Override Loading @@ -4825,6 +4828,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } }); } } finally { mInjector.binderRestoreCallingIdentity(ident); } } private void sendWipeProfileNotification() { Loading Loading @@ -5003,7 +5009,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } if (wipeData) { // Call without holding lock. wipeDeviceOrUserLocked(false, identifier, wipeDeviceNoLock(false, identifier, "reportFailedPasswordAttempt()"); } } finally { Loading Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +34 −28 Original line number Diff line number Diff line Loading @@ -4750,7 +4750,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); Loading @@ -4770,13 +4770,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } final int userHandle = mInjector.userHandleGetCallingUserId(); enforceFullCrossUsersPermission(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 = admin.info.getComponent().flattenToShortString(); source = admin.info.getComponent().flattenToShortString(); long ident = mInjector.binderClearCallingIdentity(); try { Loading @@ -4791,18 +4792,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { manager.wipe(); } } boolean wipeExtRequested = (flags & WIPE_EXTERNAL_STORAGE) != 0; wipeDeviceOrUserLocked(wipeExtRequested, userHandle, "DevicePolicyManager.wipeData() from " + source); } finally { mInjector.binderRestoreCallingIdentity(ident); } } final 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) { final long ident = mInjector.binderClearCallingIdentity(); try { if (userHandle == UserHandle.USER_SYSTEM) { wipeDataLocked(wipeExtRequested, reason); wipeDataNoLock(wipeExtRequested, reason); } else { mHandler.post(new Runnable() { @Override Loading @@ -4825,6 +4828,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } }); } } finally { mInjector.binderRestoreCallingIdentity(ident); } } private void sendWipeProfileNotification() { Loading Loading @@ -5003,7 +5009,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } if (wipeData) { // Call without holding lock. wipeDeviceOrUserLocked(false, identifier, wipeDeviceNoLock(false, identifier, "reportFailedPasswordAttempt()"); } } finally { Loading