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

Commit db968d20 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Add getProfileParentId (1/2)" am: 7a2c6635 am: b6946d85

am: 447e453e

Change-Id: Idd087f45d5fba325f347a8bb0391745ccd0593a0
parents 2f4c9843 447e453e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@ interface IUserManager {
     * DO NOT MOVE - UserManager.h depends on the ordering of this function.
     */
    int getCredentialOwnerProfile(int userHandle);
    int getProfileParentId(int userHandle);
    /*
     * END OF DO NOT MOVE
     */

    UserInfo createUser(in String name, int flags);
    UserInfo createProfileForUser(in String name, int flags, int userHandle,
+13 −0
Original line number Diff line number Diff line
@@ -717,6 +717,19 @@ public class UserManagerService extends IUserManager.Stub {
        }
    }

    @Override
    public int getProfileParentId(int userHandle) {
        checkManageUsersPermission("get the profile parent");
        synchronized (mUsersLock) {
            UserInfo profileParent = getProfileParentLU(userHandle);
            if (profileParent == null) {
                return userHandle;
            }

            return profileParent.id;
        }
    }

    private UserInfo getProfileParentLU(int userHandle) {
        UserInfo profile = getUserInfoLU(userHandle);
        if (profile == null) {