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

Commit 961b0269 authored by Tony Mak's avatar Tony Mak Committed by android-build-merger
Browse files

getUserInfo fail when app trying to get self user info am: b531d086

am: a7f3c574

* commit 'a7f3c574':
  getUserInfo fail when app trying to get self user info
parents a0d29867 a7f3c574
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -641,12 +641,16 @@ public class UserManagerService extends IUserManager.Stub {

    @Override
    public UserInfo getUserInfo(int userId) {
        if (!hasManageUsersPermission()
                && !isSameProfileGroupLP(UserHandle.getCallingUserId(), userId)) {
        int callingUserId = UserHandle.getCallingUserId();
        if (callingUserId != userId && !hasManageUsersPermission()) {
            synchronized (mPackagesLock) {
                if (!isSameProfileGroupLP(callingUserId, userId)) {
                    throw new SecurityException(
                    "You need MANAGE_USERS permission to: query users outside profile group");
                            "You need MANAGE_USERS permission to: query users outside profile" +
                                    " group");
                }
            }
        }

        synchronized (mUsersLock) {
            return getUserInfoLU(userId);
        }