Fix bug in UserManager#getUserName
Fixed incorrect permission check in getUserName Fixes: 181814864 Test: Settings no longer crash when switching accounts Change-Id: Ic41da942c2e493cae5c29693bec5f7ecec885226
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user