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

Commit 1cc84c99 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

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

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