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

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

Merge "Fixed DPMS.listForegroundAffiliatedUsers()." into sc-dev

parents 2e2e0a8c f4710f6f
Loading
Loading
Loading
Loading
+17 −16
Original line number Original line Diff line number Diff line
@@ -8903,17 +8903,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    }
    @Override
    @Override
    public ComponentName getProfileOwnerAsUser(int userHandle) {
    public ComponentName getProfileOwnerAsUser(int userId) {
        if (!mHasFeature) {
        if (!mHasFeature) {
            return null;
            return null;
        }
        }
        Preconditions.checkArgumentNonnegative(userHandle, "Invalid userId");
        Preconditions.checkArgumentNonnegative(userId, "Invalid userId");
        final CallerIdentity caller = getCallerIdentity();
        CallerIdentity caller = getCallerIdentity();
        Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userHandle));
        Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId));
        synchronized (getLockObject()) {
        synchronized (getLockObject()) {
            return mOwners.getProfileOwnerComponent(userHandle);
            return mOwners.getProfileOwnerComponent(userId);
        }
        }
    }
    }
@@ -9357,8 +9357,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    public List<UserHandle> listForegroundAffiliatedUsers() {
    public List<UserHandle> listForegroundAffiliatedUsers() {
        checkIsDeviceOwner(getCallerIdentity());
        checkIsDeviceOwner(getCallerIdentity());
        int userId = mInjector.binderWithCleanCallingIdentity(() -> getCurrentForegroundUserId());
        return mInjector.binderWithCleanCallingIdentity(() -> {
            int userId = getCurrentForegroundUserId();
            boolean isAffiliated;
            boolean isAffiliated;
            synchronized (getLockObject()) {
            synchronized (getLockObject()) {
                isAffiliated = isUserAffiliatedWithDeviceLocked(userId);
                isAffiliated = isUserAffiliatedWithDeviceLocked(userId);
@@ -9370,6 +9370,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            users.add(UserHandle.of(userId));
            users.add(UserHandle.of(userId));
            return users;
            return users;
        });
    }
    }
    protected int getProfileParentId(int userHandle) {
    protected int getProfileParentId(int userHandle) {
@@ -14129,7 +14130,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        }
    }
    }
    private boolean isUserAffiliatedWithDeviceLocked(int userId) {
    private boolean isUserAffiliatedWithDeviceLocked(@UserIdInt int userId) {
        if (!mOwners.hasDeviceOwner()) {
        if (!mOwners.hasDeviceOwner()) {
            return false;
            return false;
        }
        }