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

Commit fd7286ae authored by Pavel Grafov's avatar Pavel Grafov Committed by Android (Google) Code Review
Browse files

Merge "Clear calling identity before calling into UserManager"

parents 9d7d8264 2f44f8fe
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -8336,13 +8336,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                throw new IllegalArgumentException("Not active admin: " + who);
            }
            UserInfo parentUser = mUserManager.getProfileParent(userHandle);
            final int parentUserId = getProfileParentId(userHandle);
            // When trying to set a profile owner on a new user, it may be that this user is
            // a profile - but it may not be a managed profile if there's a restriction on the
            // parent to add managed profiles (e.g. if the device has a device owner).
            if (parentUser != null && mUserManager.hasUserRestriction(
            if (parentUserId != userHandle && mUserManager.hasUserRestriction(
                    UserManager.DISALLOW_ADD_MANAGED_PROFILE,
                    UserHandle.of(parentUser.id))) {
                    UserHandle.of(parentUserId))) {
                Slog.i(LOG_TAG, "Cannot set profile owner because of restriction.");
                return false;
            }