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

Commit 678dfa10 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Clear calling identity when accessing isProfileOwner and listAllOwners"...

Merge "Clear calling identity when accessing isProfileOwner and listAllOwners" into sc-dev am: 0c2d1458

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

Change-Id: Ie3b94bedfdd967e3f8ed953bfb0bbddb2c031fcb
parents a7b51b67 0c2d1458
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -1207,7 +1207,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    List<OwnerDto> listAllOwners() {
        Preconditions.checkCallAuthorization(
                hasCallingOrSelfPermission(permission.MANAGE_DEVICE_ADMINS));
        return mInjector.binderWithCleanCallingIdentity(() -> {
            List<OwnerDto> owners = mOwners.listAllOwners();
            synchronized (getLockObject()) {
                for (int i = 0; i < owners.size(); i++) {
@@ -1215,8 +1215,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                    owner.isAffiliated = isUserAffiliatedWithDeviceLocked(owner.userId);
                }
            }
            return owners;
        });
    }
    /**
@@ -8342,7 +8342,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    public boolean isProfileOwner(ComponentName who, int userId) {
        final ComponentName profileOwner = getProfileOwnerAsUser(userId);
        final ComponentName profileOwner = mInjector.binderWithCleanCallingIdentity(() ->
                getProfileOwnerAsUser(userId));
        return who != null && who.equals(profileOwner);
    }
@@ -8359,7 +8360,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
     */
    public boolean isProfileOwner(CallerIdentity caller) {
        synchronized (getLockObject()) {
            final ComponentName profileOwner = getProfileOwnerAsUser(caller.getUserId());
            final ComponentName profileOwner = mInjector.binderWithCleanCallingIdentity(() ->
                    getProfileOwnerAsUser(caller.getUserId()));
            // No profile owner.
            if (profileOwner == null) {
                return false;
@@ -8982,7 +8984,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        Preconditions.checkArgumentNonnegative(userId, "Invalid userId");
        CallerIdentity caller = getCallerIdentity();
        Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId));
        Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId)
                || hasFullCrossUsersPermission(caller, userId));
        synchronized (getLockObject()) {
            return mOwners.getProfileOwnerComponent(userId);