Loading core/java/android/app/admin/DevicePolicyManager.java +1 −22 Original line number Diff line number Diff line Loading @@ -1788,7 +1788,7 @@ public class DevicePolicyManager { * Sets the enabled state of the profile. A profile should be enabled only once it is ready to * be used. Only the profile owner can call this. * * @see #isPRofileOwnerApp * @see #isProfileOwnerApp * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. */ Loading Loading @@ -1842,27 +1842,6 @@ 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 +0 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ 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/content/pm/UserInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ import android.os.UserHandle; */ public class UserInfo implements Parcelable { /** 6 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x0000003F; /** 8 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x000000FF; /** * *************************** NOTE *************************** Loading Loading @@ -70,6 +70,11 @@ public class UserInfo implements Parcelable { */ public static final int FLAG_MANAGED_PROFILE = 0x00000020; /** * Indicates that this user is disabled. */ public static final int FLAG_DISABLED = 0x00000040; public static final int NO_PROFILE_GROUP_ID = -1; Loading Loading @@ -117,6 +122,10 @@ public class UserInfo implements Parcelable { return (flags & FLAG_MANAGED_PROFILE) == FLAG_MANAGED_PROFILE; } public boolean isEnabled() { return (flags & FLAG_DISABLED) != FLAG_DISABLED; } /** * @return true if this user can be switched to. **/ Loading core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.graphics.Bitmap; interface IUserManager { UserInfo createUser(in String name, int flags); UserInfo createProfileForUser(in String name, int flags, int userHandle); void setUserEnabled(int userHandle); boolean removeUser(int userHandle); void setUserName(int userHandle, String name); void setUserIcon(int userHandle, in Bitmap icon); Loading core/java/android/os/UserManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,22 @@ public class UserManager { } } /** * Sets the user as enabled, if such an user exists. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * Note that the default is true, it's only that managed profiles might not be enabled. * * @param userHandle the id of the profile to enable * @hide */ public void setUserEnabled(int userHandle) { try { mService.setUserEnabled(userHandle); } catch (RemoteException e) { Log.w(TAG, "Could not enable the profile", e); } } /** * Return the number of users currently created on the device. */ Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +1 −22 Original line number Diff line number Diff line Loading @@ -1788,7 +1788,7 @@ public class DevicePolicyManager { * Sets the enabled state of the profile. A profile should be enabled only once it is ready to * be used. Only the profile owner can call this. * * @see #isPRofileOwnerApp * @see #isProfileOwnerApp * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. */ Loading Loading @@ -1842,27 +1842,6 @@ 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 +0 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ 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/content/pm/UserInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ import android.os.UserHandle; */ public class UserInfo implements Parcelable { /** 6 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x0000003F; /** 8 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x000000FF; /** * *************************** NOTE *************************** Loading Loading @@ -70,6 +70,11 @@ public class UserInfo implements Parcelable { */ public static final int FLAG_MANAGED_PROFILE = 0x00000020; /** * Indicates that this user is disabled. */ public static final int FLAG_DISABLED = 0x00000040; public static final int NO_PROFILE_GROUP_ID = -1; Loading Loading @@ -117,6 +122,10 @@ public class UserInfo implements Parcelable { return (flags & FLAG_MANAGED_PROFILE) == FLAG_MANAGED_PROFILE; } public boolean isEnabled() { return (flags & FLAG_DISABLED) != FLAG_DISABLED; } /** * @return true if this user can be switched to. **/ Loading
core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.graphics.Bitmap; interface IUserManager { UserInfo createUser(in String name, int flags); UserInfo createProfileForUser(in String name, int flags, int userHandle); void setUserEnabled(int userHandle); boolean removeUser(int userHandle); void setUserName(int userHandle, String name); void setUserIcon(int userHandle, in Bitmap icon); Loading
core/java/android/os/UserManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,22 @@ public class UserManager { } } /** * Sets the user as enabled, if such an user exists. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * Note that the default is true, it's only that managed profiles might not be enabled. * * @param userHandle the id of the profile to enable * @hide */ public void setUserEnabled(int userHandle) { try { mService.setUserEnabled(userHandle); } catch (RemoteException e) { Log.w(TAG, "Could not enable the profile", e); } } /** * Return the number of users currently created on the device. */ Loading