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

Commit 0db230cf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DPMS: Fix Device Admin-related caller identity checks"

parents 8c68af5d 3ebfd43e
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -4373,7 +4373,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            final int adminUser = admin.getUserHandle().getIdentifier();
            // Password complexity is only taken into account from DO/PO
            if (isDeviceOwner(adminComponent, adminUser)
                    || isProfileOwner(adminComponent, adminUser)) {
                    || isProfileOwnerUncheckedLocked(adminComponent, adminUser)) {
                maxRequiredComplexity = Math.max(maxRequiredComplexity, admin.mPasswordComplexity);
            }
        }
@@ -6216,7 +6216,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        Preconditions.checkArgumentNonnegative(userHandle, "Invalid userId");
        final CallerIdentity caller = getAdminCallerIdentity(comp);
        final CallerIdentity caller = getCallerIdentity();
        Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle));
        Preconditions.checkCallAuthorization(hasCallingOrSelfPermission(BIND_DEVICE_ADMIN));
@@ -7487,6 +7487,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        return who != null && who.equals(profileOwner);
    }
    private boolean isProfileOwnerUncheckedLocked(ComponentName who, int userId) {
        ensureLocked();
        final ComponentName profileOwner = mOwners.getProfileOwnerComponent(userId);
        return who != null && who.equals(profileOwner);
    }
    /**
     * Returns {@code true} if the provided caller identity is of a profile owner.
     * @param caller identity of caller.