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

Commit e235e7f5 authored by Antoan Angelov's avatar Antoan Angelov Committed by Android (Google) Code Review
Browse files

Merge "Check the managed profile for PO" into tm-dev

parents 0581af17 a107680e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -18842,14 +18842,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    public List<UserHandle> getPolicyManagedProfiles(@NonNull UserHandle user) {
        Preconditions.checkCallAuthorization(hasCallingOrSelfPermission(
                android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS));
        int userId = user.getIdentifier();
        return mInjector.binderWithCleanCallingIdentity(() -> {
            List<UserInfo> userProfiles = mUserManager.getProfiles(userId);
            List<UserHandle> result = new ArrayList<>();
            for (int i = 0; i < userProfiles.size(); i++) {
                if (userProfiles.get(i).isManagedProfile() && hasProfileOwner(userId)) {
                    result.add(new UserHandle(userProfiles.get(i).id));
                UserInfo userInfo = userProfiles.get(i);
                if (userInfo.isManagedProfile() && hasProfileOwner(userInfo.id)) {
                    result.add(new UserHandle(userInfo.id));
                }
            }
            return result;