Merge "Allow initializers to clear reset protection data during device setup."

This commit is contained in:
Julia Reynolds
2015-03-17 22:13:30 +00:00
committed by Android (Google) Code Review

View File

@@ -3079,8 +3079,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
long ident = Binder.clearCallingIdentity();
try {
if ((flags & WIPE_RESET_PROTECTION_DATA) != 0) {
boolean ownsInitialization = isDeviceInitializer(admin.info.getPackageName())
&& !hasUserSetupCompleted(userHandle);
if (userHandle != UserHandle.USER_OWNER
|| !isDeviceOwner(admin.info.getPackageName())) {
|| !(isDeviceOwner(admin.info.getPackageName())
|| ownsInitialization)) {
throw new SecurityException(
"Only device owner admins can set WIPE_RESET_PROTECTION_DATA");
}