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

Commit 5bd5cd94 authored by Ayush Sharma's avatar Ayush Sharma Committed by Android (Google) Code Review
Browse files

Merge "Refactor permission checks removeActiveAdmin"

parents 100c2c5f 11d2fb77
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3789,7 +3789,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        Preconditions.checkArgumentNonnegative(userHandle, "Invalid userId");
        final CallerIdentity caller = getCallerIdentity();
        final CallerIdentity caller = hasCallingOrSelfPermission(permission.MANAGE_DEVICE_ADMINS)
                ? getCallerIdentity() : getCallerIdentity(adminReceiver);
        Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle));
        checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_REMOVE_ACTIVE_ADMIN);
        enforceUserUnlocked(userHandle);
@@ -3806,8 +3807,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                        + adminReceiver);
                return;
            }
            Preconditions.checkCallAuthorization(admin.getUid() == caller.getUid()
                    || hasCallingOrSelfPermission(permission.MANAGE_DEVICE_ADMINS));
            mInjector.binderWithCleanCallingIdentity(() ->
                    removeActiveAdminLocked(adminReceiver, userHandle));
        }