Loading services/core/java/com/android/server/pm/UserManagerService.java +18 −19 Original line number Diff line number Diff line Loading @@ -1300,14 +1300,15 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean hasBadge(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "hasBadge"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "hasBadge"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); return userTypeDetails != null && userTypeDetails.hasBadge(); } @Override public @StringRes int getUserBadgeLabelResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserBadgeLabelResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeLabelResId"); final UserInfo userInfo = getUserInfoNoChecks(userId); final UserTypeDetails userTypeDetails = getUserTypeDetails(userInfo); if (userInfo == null || userTypeDetails == null || !userTypeDetails.hasBadge()) { Loading @@ -1320,7 +1321,8 @@ public class UserManagerService extends IUserManager.Stub { @Override public @ColorRes int getUserBadgeColorResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserBadgeColorResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeColorResId"); final UserInfo userInfo = getUserInfoNoChecks(userId); final UserTypeDetails userTypeDetails = getUserTypeDetails(userInfo); if (userInfo == null || userTypeDetails == null || !userTypeDetails.hasBadge()) { Loading @@ -1333,7 +1335,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public @DrawableRes int getUserIconBadgeResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserIconBadgeResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserIconBadgeResId"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); if (userTypeDetails == null || !userTypeDetails.hasBadge()) { Slog.e(LOG_TAG, "Requested icon badge for non-badged user " + userId); Loading @@ -1344,7 +1346,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public @DrawableRes int getUserBadgeResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserBadgeResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeResId"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); if (userTypeDetails == null || !userTypeDetails.hasBadge()) { Slog.e(LOG_TAG, "Requested badge for non-badged user " + userId); Loading @@ -1355,7 +1357,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public @DrawableRes int getUserBadgeNoBackgroundResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeNoBackgroundResId"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); if (userTypeDetails == null || !userTypeDetails.hasBadge()) { Loading @@ -1367,7 +1369,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isProfile(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isProfile"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isProfile"); synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isProfile(); Loading @@ -1376,7 +1378,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isManagedProfile(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isManagedProfile"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isManagedProfile"); synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isManagedProfile(); Loading @@ -1385,19 +1387,20 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isUserUnlockingOrUnlocked(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isUserUnlockingOrUnlocked"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isUserUnlockingOrUnlocked"); return mLocalService.isUserUnlockingOrUnlocked(userId); } @Override public boolean isUserUnlocked(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isUserUnlocked"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isUserUnlocked"); return mLocalService.isUserUnlocked(userId); } @Override public boolean isUserRunning(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isUserRunning"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isUserRunning"); return mLocalService.isUserRunning(userId); } Loading Loading @@ -1437,7 +1440,7 @@ public class UserManagerService extends IUserManager.Stub { } } private void checkManageOrInteractPermIfCallerInOtherProfileGroup(@UserIdInt int userId, private void checkManageOrInteractPermissionIfCallerInOtherProfileGroup(@UserIdInt int userId, String name) { final int callingUserId = UserHandle.getCallingUserId(); if (callingUserId == userId || isSameProfileGroupNoChecks(callingUserId, userId) || Loading Loading @@ -1466,11 +1469,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isPreCreated(@UserIdInt int userId) { final int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId && !hasManageUsersPermission()) { throw new SecurityException("You need MANAGE_USERS permission to query if u=" + userId + " is pre-created"); } checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isPreCreated"); synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.preCreated; Loading Loading @@ -1826,7 +1825,7 @@ public class UserManagerService extends IUserManager.Stub { /** @return a specific user restriction that's in effect currently. */ @Override public boolean hasUserRestriction(String restrictionKey, @UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "hasUserRestriction"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "hasUserRestriction"); return mLocalService.hasUserRestriction(restrictionKey, userId); } Loading Loading @@ -1951,7 +1950,7 @@ public class UserManagerService extends IUserManager.Stub { */ @Override public Bundle getUserRestrictions(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserRestrictions"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserRestrictions"); return UserRestrictionsUtils.clone(getEffectiveUserRestrictions(userId)); } Loading Loading
services/core/java/com/android/server/pm/UserManagerService.java +18 −19 Original line number Diff line number Diff line Loading @@ -1300,14 +1300,15 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean hasBadge(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "hasBadge"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "hasBadge"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); return userTypeDetails != null && userTypeDetails.hasBadge(); } @Override public @StringRes int getUserBadgeLabelResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserBadgeLabelResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeLabelResId"); final UserInfo userInfo = getUserInfoNoChecks(userId); final UserTypeDetails userTypeDetails = getUserTypeDetails(userInfo); if (userInfo == null || userTypeDetails == null || !userTypeDetails.hasBadge()) { Loading @@ -1320,7 +1321,8 @@ public class UserManagerService extends IUserManager.Stub { @Override public @ColorRes int getUserBadgeColorResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserBadgeColorResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeColorResId"); final UserInfo userInfo = getUserInfoNoChecks(userId); final UserTypeDetails userTypeDetails = getUserTypeDetails(userInfo); if (userInfo == null || userTypeDetails == null || !userTypeDetails.hasBadge()) { Loading @@ -1333,7 +1335,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public @DrawableRes int getUserIconBadgeResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserIconBadgeResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserIconBadgeResId"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); if (userTypeDetails == null || !userTypeDetails.hasBadge()) { Slog.e(LOG_TAG, "Requested icon badge for non-badged user " + userId); Loading @@ -1344,7 +1346,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public @DrawableRes int getUserBadgeResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserBadgeResId"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeResId"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); if (userTypeDetails == null || !userTypeDetails.hasBadge()) { Slog.e(LOG_TAG, "Requested badge for non-badged user " + userId); Loading @@ -1355,7 +1357,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public @DrawableRes int getUserBadgeNoBackgroundResId(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserBadgeNoBackgroundResId"); final UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); if (userTypeDetails == null || !userTypeDetails.hasBadge()) { Loading @@ -1367,7 +1369,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isProfile(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isProfile"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isProfile"); synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isProfile(); Loading @@ -1376,7 +1378,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isManagedProfile(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isManagedProfile"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isManagedProfile"); synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isManagedProfile(); Loading @@ -1385,19 +1387,20 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isUserUnlockingOrUnlocked(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isUserUnlockingOrUnlocked"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isUserUnlockingOrUnlocked"); return mLocalService.isUserUnlockingOrUnlocked(userId); } @Override public boolean isUserUnlocked(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isUserUnlocked"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isUserUnlocked"); return mLocalService.isUserUnlocked(userId); } @Override public boolean isUserRunning(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "isUserRunning"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isUserRunning"); return mLocalService.isUserRunning(userId); } Loading Loading @@ -1437,7 +1440,7 @@ public class UserManagerService extends IUserManager.Stub { } } private void checkManageOrInteractPermIfCallerInOtherProfileGroup(@UserIdInt int userId, private void checkManageOrInteractPermissionIfCallerInOtherProfileGroup(@UserIdInt int userId, String name) { final int callingUserId = UserHandle.getCallingUserId(); if (callingUserId == userId || isSameProfileGroupNoChecks(callingUserId, userId) || Loading Loading @@ -1466,11 +1469,7 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean isPreCreated(@UserIdInt int userId) { final int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId && !hasManageUsersPermission()) { throw new SecurityException("You need MANAGE_USERS permission to query if u=" + userId + " is pre-created"); } checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "isPreCreated"); synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.preCreated; Loading Loading @@ -1826,7 +1825,7 @@ public class UserManagerService extends IUserManager.Stub { /** @return a specific user restriction that's in effect currently. */ @Override public boolean hasUserRestriction(String restrictionKey, @UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "hasUserRestriction"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "hasUserRestriction"); return mLocalService.hasUserRestriction(restrictionKey, userId); } Loading Loading @@ -1951,7 +1950,7 @@ public class UserManagerService extends IUserManager.Stub { */ @Override public Bundle getUserRestrictions(@UserIdInt int userId) { checkManageOrInteractPermIfCallerInOtherProfileGroup(userId, "getUserRestrictions"); checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserRestrictions"); return UserRestrictionsUtils.clone(getEffectiveUserRestrictions(userId)); } Loading