DO NOT MERGE Do not call RecoverySystem with DPMS lock held
am: 4ffe72dcc8
Change-Id: Ic7b9ef6484df0b57c8f1ee7a483ef3bda05c7cc7
This commit is contained in:
@@ -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) {
|
if (wipeExtRequested) {
|
||||||
StorageManager sm = (StorageManager) mContext.getSystemService(
|
StorageManager sm = (StorageManager) mContext.getSystemService(
|
||||||
Context.STORAGE_SERVICE);
|
Context.STORAGE_SERVICE);
|
||||||
@@ -3340,13 +3340,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
enforceCrossUserPermission(userHandle);
|
enforceCrossUserPermission(userHandle);
|
||||||
|
final String source;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// This API can only be called by an active device admin,
|
// This API can only be called by an active device admin,
|
||||||
// so try to retrieve it to check that the caller is one.
|
// so try to retrieve it to check that the caller is one.
|
||||||
final ActiveAdmin admin = getActiveAdminForCallerLocked(null,
|
final ActiveAdmin admin = getActiveAdminForCallerLocked(null,
|
||||||
DeviceAdminInfo.USES_POLICY_WIPE_DATA);
|
DeviceAdminInfo.USES_POLICY_WIPE_DATA);
|
||||||
|
|
||||||
final String source;
|
|
||||||
final ComponentName cname = admin.info.getComponent();
|
final ComponentName cname = admin.info.getComponent();
|
||||||
if (cname != null) {
|
if (cname != null) {
|
||||||
source = cname.flattenToShortString();
|
source = cname.flattenToShortString();
|
||||||
@@ -3371,39 +3371,44 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
manager.wipe();
|
manager.wipe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean wipeExtRequested = (flags & WIPE_EXTERNAL_STORAGE) != 0;
|
|
||||||
wipeDeviceOrUserLocked(wipeExtRequested, userHandle,
|
|
||||||
"DevicePolicyManager.wipeData() from " + source);
|
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(ident);
|
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) {
|
||||||
if (userHandle == UserHandle.USER_OWNER) {
|
long ident = Binder.clearCallingIdentity();
|
||||||
wipeDataLocked(wipeExtRequested, reason);
|
try {
|
||||||
} else {
|
if (userHandle == UserHandle.USER_OWNER) {
|
||||||
mHandler.post(new Runnable() {
|
wipeDataNoLock(wipeExtRequested, reason);
|
||||||
@Override
|
} else {
|
||||||
public void run() {
|
mHandler.post(new Runnable() {
|
||||||
try {
|
@Override
|
||||||
IActivityManager am = ActivityManagerNative.getDefault();
|
public void run() {
|
||||||
if (am.getCurrentUser().id == userHandle) {
|
try {
|
||||||
am.switchUser(UserHandle.USER_OWNER);
|
IActivityManager am = ActivityManagerNative.getDefault();
|
||||||
}
|
if (am.getCurrentUser().id == userHandle) {
|
||||||
|
am.switchUser(UserHandle.USER_OWNER);
|
||||||
|
}
|
||||||
|
|
||||||
boolean isManagedProfile = isManagedProfile(userHandle);
|
boolean isManagedProfile = isManagedProfile(userHandle);
|
||||||
if (!mUserManager.removeUser(userHandle)) {
|
if (!mUserManager.removeUser(userHandle)) {
|
||||||
Slog.w(LOG_TAG, "Couldn't remove user " + userHandle);
|
Slog.w(LOG_TAG, "Couldn't remove user " + userHandle);
|
||||||
} else if (isManagedProfile) {
|
} else if (isManagedProfile) {
|
||||||
sendWipeProfileNotification();
|
sendWipeProfileNotification();
|
||||||
|
}
|
||||||
|
} catch (RemoteException re) {
|
||||||
|
// Shouldn't happen
|
||||||
}
|
}
|
||||||
} catch (RemoteException re) {
|
|
||||||
// Shouldn't happen
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3561,7 +3566,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
if (wipeData) {
|
if (wipeData) {
|
||||||
// Call without holding lock.
|
// Call without holding lock.
|
||||||
wipeDeviceOrUserLocked(false, identifier,
|
wipeDeviceNoLock(false, identifier,
|
||||||
"reportFailedPasswordAttempt()");
|
"reportFailedPasswordAttempt()");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user