Loading core/java/android/app/admin/DevicePolicyManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -1814,6 +1814,27 @@ public class DevicePolicyManager { return null; } /** * @hide * @param userId the userId of a managed profile profile. * * @return whether or not the managed profile is enabled. * @throws IllegalArgumentException if the userId is invalid. */ public boolean isProfileEnabled(int userId) throws IllegalArgumentException { if (mService != null) { try { return mService.isProfileEnabled(userId); } catch (RemoteException re) { Log.w(TAG, "Failed to get status for owner profile."); throw new IllegalArgumentException( "Failed to get status for owner profile.", re); } } return true; } /** * @hide * @return the human readable name of the organisation associated with this DPM or null if Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ interface IDevicePolicyManager { String getProfileOwner(int userHandle); String getProfileOwnerName(int userHandle); void setProfileEnabled(in ComponentName who); boolean isProfileEnabled(int userHandle); boolean installCaCert(in byte[] certBuffer); void uninstallCaCert(in byte[] certBuffer); Loading core/java/android/os/IUserManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ interface IUserManager { void setUserIcon(int userHandle, in Bitmap icon); Bitmap getUserIcon(int userHandle); List<UserInfo> getUsers(boolean excludeDying); List<UserInfo> getProfiles(int userHandle); List<UserInfo> getProfiles(int userHandle, boolean enabledOnly); UserInfo getUserInfo(int userHandle); boolean isRestricted(); void setGuestEnabled(boolean enable); Loading core/java/android/os/UserManager.java +10 −2 Original line number Diff line number Diff line Loading @@ -466,6 +466,8 @@ public class UserManager { /** * Returns list of the profiles of userHandle including * userHandle itself. * Note that it this returns both enabled and not enabled profiles. See * {@link #getUserProfiles()} if you need only the enabled ones. * * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * @param userHandle profiles of this user will be returned. Loading @@ -474,7 +476,7 @@ public class UserManager { */ public List<UserInfo> getProfiles(int userHandle) { try { return mService.getProfiles(userHandle); return mService.getProfiles(userHandle, false /* enabledOnly */); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; Loading @@ -488,7 +490,13 @@ public class UserManager { */ public List<UserHandle> getUserProfiles() { ArrayList<UserHandle> profiles = new ArrayList<UserHandle>(); List<UserInfo> users = getProfiles(UserHandle.myUserId()); List<UserInfo> users = new ArrayList<UserInfo>(); try { users = mService.getProfiles(UserHandle.myUserId(), true /* enabledOnly */); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; } for (UserInfo info : users) { UserHandle userHandle = new UserHandle(info.id); profiles.add(userHandle); Loading services/core/java/com/android/server/am/ActivityManagerService.java +6 −3 Original line number Diff line number Diff line Loading @@ -16369,7 +16369,8 @@ public final class ActivityManagerService extends ActivityManagerNative * background. */ private void updateCurrentProfileIdsLocked() { final List<UserInfo> profiles = getUserManagerLocked().getProfiles(mCurrentUserId); final List<UserInfo> profiles = getUserManagerLocked().getProfiles( mCurrentUserId, false /* enabledOnly */); int[] currentProfileIds = new int[profiles.size()]; // profiles will not be null for (int i = 0; i < currentProfileIds.length; i++) { currentProfileIds[i] = profiles.get(i).id; Loading @@ -16379,7 +16380,8 @@ public final class ActivityManagerService extends ActivityManagerNative private Set getProfileIdsLocked(int userId) { Set userIds = new HashSet<Integer>(); final List<UserInfo> profiles = getUserManagerLocked().getProfiles(userId); final List<UserInfo> profiles = getUserManagerLocked().getProfiles( userId, false /* enabledOnly */); for (UserInfo user : profiles) { userIds.add(Integer.valueOf(user.id)); } Loading Loading @@ -16678,7 +16680,8 @@ public final class ActivityManagerService extends ActivityManagerNative void startProfilesLocked() { if (DEBUG_MU) Slog.i(TAG_MU, "startProfilesLocked"); List<UserInfo> profiles = getUserManagerLocked().getProfiles(mCurrentUserId); List<UserInfo> profiles = getUserManagerLocked().getProfiles( mCurrentUserId, false /* enabledOnly */); List<UserInfo> toStart = new ArrayList<UserInfo>(profiles.size()); for (UserInfo user : profiles) { if ((user.flags & UserInfo.FLAG_INITIALIZED) == UserInfo.FLAG_INITIALIZED Loading
core/java/android/app/admin/DevicePolicyManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -1814,6 +1814,27 @@ public class DevicePolicyManager { return null; } /** * @hide * @param userId the userId of a managed profile profile. * * @return whether or not the managed profile is enabled. * @throws IllegalArgumentException if the userId is invalid. */ public boolean isProfileEnabled(int userId) throws IllegalArgumentException { if (mService != null) { try { return mService.isProfileEnabled(userId); } catch (RemoteException re) { Log.w(TAG, "Failed to get status for owner profile."); throw new IllegalArgumentException( "Failed to get status for owner profile.", re); } } return true; } /** * @hide * @return the human readable name of the organisation associated with this DPM or null if Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ interface IDevicePolicyManager { String getProfileOwner(int userHandle); String getProfileOwnerName(int userHandle); void setProfileEnabled(in ComponentName who); boolean isProfileEnabled(int userHandle); boolean installCaCert(in byte[] certBuffer); void uninstallCaCert(in byte[] certBuffer); Loading
core/java/android/os/IUserManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ interface IUserManager { void setUserIcon(int userHandle, in Bitmap icon); Bitmap getUserIcon(int userHandle); List<UserInfo> getUsers(boolean excludeDying); List<UserInfo> getProfiles(int userHandle); List<UserInfo> getProfiles(int userHandle, boolean enabledOnly); UserInfo getUserInfo(int userHandle); boolean isRestricted(); void setGuestEnabled(boolean enable); Loading
core/java/android/os/UserManager.java +10 −2 Original line number Diff line number Diff line Loading @@ -466,6 +466,8 @@ public class UserManager { /** * Returns list of the profiles of userHandle including * userHandle itself. * Note that it this returns both enabled and not enabled profiles. See * {@link #getUserProfiles()} if you need only the enabled ones. * * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * @param userHandle profiles of this user will be returned. Loading @@ -474,7 +476,7 @@ public class UserManager { */ public List<UserInfo> getProfiles(int userHandle) { try { return mService.getProfiles(userHandle); return mService.getProfiles(userHandle, false /* enabledOnly */); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; Loading @@ -488,7 +490,13 @@ public class UserManager { */ public List<UserHandle> getUserProfiles() { ArrayList<UserHandle> profiles = new ArrayList<UserHandle>(); List<UserInfo> users = getProfiles(UserHandle.myUserId()); List<UserInfo> users = new ArrayList<UserInfo>(); try { users = mService.getProfiles(UserHandle.myUserId(), true /* enabledOnly */); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; } for (UserInfo info : users) { UserHandle userHandle = new UserHandle(info.id); profiles.add(userHandle); Loading
services/core/java/com/android/server/am/ActivityManagerService.java +6 −3 Original line number Diff line number Diff line Loading @@ -16369,7 +16369,8 @@ public final class ActivityManagerService extends ActivityManagerNative * background. */ private void updateCurrentProfileIdsLocked() { final List<UserInfo> profiles = getUserManagerLocked().getProfiles(mCurrentUserId); final List<UserInfo> profiles = getUserManagerLocked().getProfiles( mCurrentUserId, false /* enabledOnly */); int[] currentProfileIds = new int[profiles.size()]; // profiles will not be null for (int i = 0; i < currentProfileIds.length; i++) { currentProfileIds[i] = profiles.get(i).id; Loading @@ -16379,7 +16380,8 @@ public final class ActivityManagerService extends ActivityManagerNative private Set getProfileIdsLocked(int userId) { Set userIds = new HashSet<Integer>(); final List<UserInfo> profiles = getUserManagerLocked().getProfiles(userId); final List<UserInfo> profiles = getUserManagerLocked().getProfiles( userId, false /* enabledOnly */); for (UserInfo user : profiles) { userIds.add(Integer.valueOf(user.id)); } Loading Loading @@ -16678,7 +16680,8 @@ public final class ActivityManagerService extends ActivityManagerNative void startProfilesLocked() { if (DEBUG_MU) Slog.i(TAG_MU, "startProfilesLocked"); List<UserInfo> profiles = getUserManagerLocked().getProfiles(mCurrentUserId); List<UserInfo> profiles = getUserManagerLocked().getProfiles( mCurrentUserId, false /* enabledOnly */); List<UserInfo> toStart = new ArrayList<UserInfo>(profiles.size()); for (UserInfo user : profiles) { if ((user.flags & UserInfo.FLAG_INITIALIZED) == UserInfo.FLAG_INITIALIZED