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

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

Merge "Refactor permission checks removeActiveAdmin" into sc-v2-dev

parents 2103430b c0681c01
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3796,7 +3796,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);
@@ -3813,8 +3814,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                        + adminReceiver);
                return;
            }
            Preconditions.checkCallAuthorization(admin.getUid() == caller.getUid()
                    || hasCallingOrSelfPermission(permission.MANAGE_DEVICE_ADMINS));
            mInjector.binderWithCleanCallingIdentity(() ->
                    removeActiveAdminLocked(adminReceiver, userHandle));
        }