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

Commit c34a6381 authored by kholoud mohamed's avatar kholoud mohamed
Browse files

Fix bug in UserManager#getUserName

Fixed incorrect permission check in getUserName

Fixes: 181814864
Test: Settings no longer crash when switching accounts
Change-Id: Ic41da942c2e493cae5c29693bec5f7ecec885226
parent cf82f60c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1544,7 +1544,7 @@ public class UserManagerService extends IUserManager.Stub {
    public String getUserName() {
        final int callingUid = Binder.getCallingUid();
        if (!hasManageOrCreateUsersPermission()
                || hasPermissionGranted(
                && !hasPermissionGranted(
                        android.Manifest.permission.GET_ACCOUNTS_PRIVILEGED, callingUid)) {
            throw new SecurityException("You need MANAGE_USERS or CREATE_USERS or "
                    + "GET_ACCOUNTS_PRIVILEGED permissions to: get user name");