Loading api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31658,6 +31658,7 @@ package android.os { method public android.os.Bundle getUserRestrictions(android.os.UserHandle); method public boolean hasUserRestriction(java.lang.String); method public boolean isManagedProfile(); method public boolean isManagedProfile(int); method public boolean isQuietModeEnabled(android.os.UserHandle); method public boolean isSystemUser(); method public boolean isUserAGoat(); core/java/android/app/ApplicationPackageManager.java +6 −9 Original line number Diff line number Diff line Loading @@ -1147,8 +1147,7 @@ public class ApplicationPackageManager extends PackageManager { } private Drawable getManagedProfileIconForDensity(UserHandle user, int drawableId, int density) { UserInfo userInfo = getUserInfo(user.getIdentifier()); if (userInfo != null && userInfo.isManagedProfile()) { if (isManagedProfile(user.getIdentifier())) { return getDrawableForDensity(drawableId, density); } return null; Loading @@ -1156,8 +1155,7 @@ public class ApplicationPackageManager extends PackageManager { @Override public CharSequence getUserBadgedLabel(CharSequence label, UserHandle user) { UserInfo userInfo = getUserInfo(user.getIdentifier()); if (userInfo != null && userInfo.isManagedProfile()) { if (isManagedProfile(user.getIdentifier())) { return Resources.getSystem().getString( com.android.internal.R.string.managed_profile_label_badge, label); } Loading Loading @@ -2259,17 +2257,16 @@ public class ApplicationPackageManager extends PackageManager { return drawable; } private int getBadgeResIdForUser(int userHandle) { private int getBadgeResIdForUser(int userId) { // Return the framework-provided badge. UserInfo userInfo = getUserInfo(userHandle); if (userInfo != null && userInfo.isManagedProfile()) { if (isManagedProfile(userId)) { return com.android.internal.R.drawable.ic_corp_icon_badge; } return 0; } private UserInfo getUserInfo(int userHandle) { return getUserManager().getUserInfo(userHandle); private boolean isManagedProfile(int userId) { return getUserManager().isManagedProfile(userId); } /** {@hide} */ Loading core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -76,4 +76,5 @@ interface IUserManager { PersistableBundle getSeedAccountOptions(); void clearSeedAccountData(); boolean someUserHasSeedAccount(in String accountName, in String accountType); boolean isManagedProfile(int userId); } core/java/android/os/UserManager.java +23 −4 Original line number Diff line number Diff line Loading @@ -822,8 +822,28 @@ public class UserManager { */ @SystemApi public boolean isManagedProfile() { UserInfo user = getUserInfo(UserHandle.myUserId()); return user != null ? user.isManagedProfile() : false; try { return mService.isManagedProfile(UserHandle.myUserId()); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Checks if the specified user is a managed profile. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission, otherwise the caller * must be in the same profile group of specified user. * * @return whether the specified user is a managed profile. * @hide */ @SystemApi public boolean isManagedProfile(@UserIdInt int userId) { try { return mService.isManagedProfile(userId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading Loading @@ -964,8 +984,7 @@ public class UserManager { /** * Returns the UserInfo object describing a specific user. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission or the caller is * in the same profile group of target user. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * @param userHandle the user handle of the user whose information is being requested. * @return the UserInfo object for a specific user. * @hide Loading services/core/java/com/android/server/pm/UserManagerService.java +13 −3 Original line number Diff line number Diff line /* * Copyright (C) 2011 The Android Open Source Project * Loading Loading @@ -650,18 +651,27 @@ public class UserManagerService extends IUserManager.Stub { @Override public UserInfo getUserInfo(int userId) { checkManageUsersPermission("query user"); synchronized (mUsersLock) { return getUserInfoLU(userId); } } @Override public boolean isManagedProfile(int 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: check if specified user a " + "managed profile outside your profile group"); } } } synchronized (mUsersLock) { return getUserInfoLU(userId); UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isManagedProfile(); } } Loading Loading
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31658,6 +31658,7 @@ package android.os { method public android.os.Bundle getUserRestrictions(android.os.UserHandle); method public boolean hasUserRestriction(java.lang.String); method public boolean isManagedProfile(); method public boolean isManagedProfile(int); method public boolean isQuietModeEnabled(android.os.UserHandle); method public boolean isSystemUser(); method public boolean isUserAGoat();
core/java/android/app/ApplicationPackageManager.java +6 −9 Original line number Diff line number Diff line Loading @@ -1147,8 +1147,7 @@ public class ApplicationPackageManager extends PackageManager { } private Drawable getManagedProfileIconForDensity(UserHandle user, int drawableId, int density) { UserInfo userInfo = getUserInfo(user.getIdentifier()); if (userInfo != null && userInfo.isManagedProfile()) { if (isManagedProfile(user.getIdentifier())) { return getDrawableForDensity(drawableId, density); } return null; Loading @@ -1156,8 +1155,7 @@ public class ApplicationPackageManager extends PackageManager { @Override public CharSequence getUserBadgedLabel(CharSequence label, UserHandle user) { UserInfo userInfo = getUserInfo(user.getIdentifier()); if (userInfo != null && userInfo.isManagedProfile()) { if (isManagedProfile(user.getIdentifier())) { return Resources.getSystem().getString( com.android.internal.R.string.managed_profile_label_badge, label); } Loading Loading @@ -2259,17 +2257,16 @@ public class ApplicationPackageManager extends PackageManager { return drawable; } private int getBadgeResIdForUser(int userHandle) { private int getBadgeResIdForUser(int userId) { // Return the framework-provided badge. UserInfo userInfo = getUserInfo(userHandle); if (userInfo != null && userInfo.isManagedProfile()) { if (isManagedProfile(userId)) { return com.android.internal.R.drawable.ic_corp_icon_badge; } return 0; } private UserInfo getUserInfo(int userHandle) { return getUserManager().getUserInfo(userHandle); private boolean isManagedProfile(int userId) { return getUserManager().isManagedProfile(userId); } /** {@hide} */ Loading
core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -76,4 +76,5 @@ interface IUserManager { PersistableBundle getSeedAccountOptions(); void clearSeedAccountData(); boolean someUserHasSeedAccount(in String accountName, in String accountType); boolean isManagedProfile(int userId); }
core/java/android/os/UserManager.java +23 −4 Original line number Diff line number Diff line Loading @@ -822,8 +822,28 @@ public class UserManager { */ @SystemApi public boolean isManagedProfile() { UserInfo user = getUserInfo(UserHandle.myUserId()); return user != null ? user.isManagedProfile() : false; try { return mService.isManagedProfile(UserHandle.myUserId()); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Checks if the specified user is a managed profile. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission, otherwise the caller * must be in the same profile group of specified user. * * @return whether the specified user is a managed profile. * @hide */ @SystemApi public boolean isManagedProfile(@UserIdInt int userId) { try { return mService.isManagedProfile(userId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading Loading @@ -964,8 +984,7 @@ public class UserManager { /** * Returns the UserInfo object describing a specific user. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission or the caller is * in the same profile group of target user. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * @param userHandle the user handle of the user whose information is being requested. * @return the UserInfo object for a specific user. * @hide Loading
services/core/java/com/android/server/pm/UserManagerService.java +13 −3 Original line number Diff line number Diff line /* * Copyright (C) 2011 The Android Open Source Project * Loading Loading @@ -650,18 +651,27 @@ public class UserManagerService extends IUserManager.Stub { @Override public UserInfo getUserInfo(int userId) { checkManageUsersPermission("query user"); synchronized (mUsersLock) { return getUserInfoLU(userId); } } @Override public boolean isManagedProfile(int 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: check if specified user a " + "managed profile outside your profile group"); } } } synchronized (mUsersLock) { return getUserInfoLU(userId); UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isManagedProfile(); } } Loading