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

Commit fa92c2a5 authored by Ayush Sharma's avatar Ayush Sharma Committed by Automerger Merge Worker
Browse files

Merge "Refactor permission checks removeActiveAdmin" into sc-v2-dev am: 0f08cc37

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15951642

Change-Id: I39c94dce6eec5b81c793d5b02526d5e95b8393f1
parents ac255031 0f08cc37
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));
        }