Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -6544,6 +6544,7 @@ package android.app.admin { method public void setTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle); method public void setUninstallBlocked(android.content.ComponentName, java.lang.String, boolean); method public void setUserIcon(android.content.ComponentName, android.graphics.Bitmap); method public boolean startUserInBackground(android.content.ComponentName, android.os.UserHandle); method public boolean stopUser(android.content.ComponentName, android.os.UserHandle); method public boolean switchUser(android.content.ComponentName, android.os.UserHandle); method public void transferOwnership(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle); Loading Loading @@ -6656,7 +6657,6 @@ package android.app.admin { field public static final int RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT = 2; // 0x2 field public static final int RESET_PASSWORD_REQUIRE_ENTRY = 1; // 0x1 field public static final int SKIP_SETUP_WIZARD = 1; // 0x1 field public static final int START_USER_IN_BACKGROUND = 8; // 0x8 field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1 field public static final int WIPE_RESET_PROTECTION_DATA = 2; // 0x2 } core/java/android/app/ActivityManagerInternal.java +5 −0 Original line number Diff line number Diff line Loading @@ -319,4 +319,9 @@ public abstract class ActivityManagerInternal { } public abstract void registerScreenObserver(ScreenObserver observer); /** * Returns if more users can be started without stopping currently running users. */ public abstract boolean canStartMoreUsers(); } core/java/android/app/admin/DevicePolicyManager.java +35 −22 Original line number Diff line number Diff line Loading @@ -6505,12 +6505,6 @@ public class DevicePolicyManager { */ public static final int MAKE_USER_DEMO = 0x0004; /** * Flag used by {@link #createAndManageUser} to specify that the newly created user should be * started in the background as part of the user creation. */ public static final int START_USER_IN_BACKGROUND = 0x0008; /** * Flag used by {@link #createAndManageUser} to specify that the newly created user should skip * the disabling of system apps during provisioning. Loading @@ -6524,7 +6518,6 @@ public class DevicePolicyManager { SKIP_SETUP_WIZARD, MAKE_USER_EPHEMERAL, MAKE_USER_DEMO, START_USER_IN_BACKGROUND, LEAVE_ALL_SYSTEM_APPS_ENABLED }) @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -6553,7 +6546,8 @@ public class DevicePolicyManager { * IllegalArgumentException is thrown. * @param adminExtras Extras that will be passed to onEnable of the admin receiver on the new * user. * @param flags {@link #SKIP_SETUP_WIZARD} is supported. * @param flags {@link #SKIP_SETUP_WIZARD}, {@link #MAKE_USER_EPHEMERAL} and * {@link #LEAVE_ALL_SYSTEM_APPS_ENABLED} are supported. * @see UserHandle * @return the {@link android.os.UserHandle} object for the created user, or {@code null} if the * user could not be created. Loading @@ -6572,8 +6566,8 @@ public class DevicePolicyManager { } /** * Called by a device owner to remove a user and all associated data. The primary user can not * be removed. * Called by a device owner to remove a user/profile and all associated data. The primary user * can not be removed. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to remove. Loading @@ -6590,14 +6584,14 @@ public class DevicePolicyManager { } /** * Called by a device owner to switch the specified user to the foreground. * <p> This cannot be used to switch to a managed profile. * Called by a device owner to switch the specified secondary user to the foreground. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to switch to; null will switch to primary. * @return {@code true} if the switch was successful, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @see Intent#ACTION_USER_FOREGROUND * @see #getSecondaryUsers(ComponentName) */ public boolean switchUser(@NonNull ComponentName admin, @Nullable UserHandle userHandle) { throwIfParentInstance("switchUser"); Loading @@ -6608,14 +6602,33 @@ public class DevicePolicyManager { } } /** * Called by a device owner to start the specified secondary user in background. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to be stopped. * @return {@code true} if the user can be started, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @see #getSecondaryUsers(ComponentName) */ public boolean startUserInBackground( @NonNull ComponentName admin, @NonNull UserHandle userHandle) { throwIfParentInstance("startUserInBackground"); try { return mService.startUserInBackground(admin, userHandle); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Called by a device owner to stop the specified secondary user. * <p> This cannot be used to stop the primary user or a managed profile. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to be stopped. * @return {@code true} if the user can be stopped, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @see #getSecondaryUsers(ComponentName) */ public boolean stopUser(@NonNull ComponentName admin, @NonNull UserHandle userHandle) { throwIfParentInstance("stopUser"); Loading @@ -6627,14 +6640,13 @@ public class DevicePolicyManager { } /** * Called by a profile owner that is affiliated with the device to stop the calling user * and switch back to primary. * <p> This has no effect when called on a managed profile. * Called by a profile owner of secondary user that is affiliated with the device to stop the * calling user and switch back to primary. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return {@code true} if the exit was successful, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a profile owner affiliated with the device. * @see #isAffiliatedUser * @see #getSecondaryUsers(ComponentName) */ public boolean logoutUser(@NonNull ComponentName admin) { throwIfParentInstance("logoutUser"); Loading @@ -6646,17 +6658,18 @@ public class DevicePolicyManager { } /** * Called by a device owner to list all secondary users on the device, excluding managed * profiles. * Called by a device owner to list all secondary users on the device. Managed profiles are not * considered as secondary users. * <p> Used for various user management APIs, including {@link #switchUser}, {@link #removeUser} * and {@link #stopUser}. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return list of other {@link UserHandle}s on the device. * @throws SecurityException if {@code admin} is not a device owner. * @see #switchUser * @see #removeUser * @see #stopUser * @see #removeUser(ComponentName, UserHandle) * @see #switchUser(ComponentName, UserHandle) * @see #startUserInBackground(ComponentName, UserHandle) * @see #stopUser(ComponentName, UserHandle) */ public List<UserHandle> getSecondaryUsers(@NonNull ComponentName admin) { throwIfParentInstance("getSecondaryUsers"); Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ interface IDevicePolicyManager { UserHandle createAndManageUser(in ComponentName who, in String name, in ComponentName profileOwner, in PersistableBundle adminExtras, in int flags); boolean removeUser(in ComponentName who, in UserHandle userHandle); boolean switchUser(in ComponentName who, in UserHandle userHandle); boolean startUserInBackground(in ComponentName who, in UserHandle userHandle); boolean stopUser(in ComponentName who, in UserHandle userHandle); boolean logoutUser(in ComponentName who); List<UserHandle> getSecondaryUsers(in ComponentName who); Loading services/core/java/com/android/server/am/ActivityManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -25130,6 +25130,11 @@ public class ActivityManagerService extends IActivityManager.Stub public void registerScreenObserver(ScreenObserver observer) { mScreenObservers.add(observer); } @Override public boolean canStartMoreUsers() { return mUserController.canStartMoreUsers(); } } /** Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -6544,6 +6544,7 @@ package android.app.admin { method public void setTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle); method public void setUninstallBlocked(android.content.ComponentName, java.lang.String, boolean); method public void setUserIcon(android.content.ComponentName, android.graphics.Bitmap); method public boolean startUserInBackground(android.content.ComponentName, android.os.UserHandle); method public boolean stopUser(android.content.ComponentName, android.os.UserHandle); method public boolean switchUser(android.content.ComponentName, android.os.UserHandle); method public void transferOwnership(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle); Loading Loading @@ -6656,7 +6657,6 @@ package android.app.admin { field public static final int RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT = 2; // 0x2 field public static final int RESET_PASSWORD_REQUIRE_ENTRY = 1; // 0x1 field public static final int SKIP_SETUP_WIZARD = 1; // 0x1 field public static final int START_USER_IN_BACKGROUND = 8; // 0x8 field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1 field public static final int WIPE_RESET_PROTECTION_DATA = 2; // 0x2 }
core/java/android/app/ActivityManagerInternal.java +5 −0 Original line number Diff line number Diff line Loading @@ -319,4 +319,9 @@ public abstract class ActivityManagerInternal { } public abstract void registerScreenObserver(ScreenObserver observer); /** * Returns if more users can be started without stopping currently running users. */ public abstract boolean canStartMoreUsers(); }
core/java/android/app/admin/DevicePolicyManager.java +35 −22 Original line number Diff line number Diff line Loading @@ -6505,12 +6505,6 @@ public class DevicePolicyManager { */ public static final int MAKE_USER_DEMO = 0x0004; /** * Flag used by {@link #createAndManageUser} to specify that the newly created user should be * started in the background as part of the user creation. */ public static final int START_USER_IN_BACKGROUND = 0x0008; /** * Flag used by {@link #createAndManageUser} to specify that the newly created user should skip * the disabling of system apps during provisioning. Loading @@ -6524,7 +6518,6 @@ public class DevicePolicyManager { SKIP_SETUP_WIZARD, MAKE_USER_EPHEMERAL, MAKE_USER_DEMO, START_USER_IN_BACKGROUND, LEAVE_ALL_SYSTEM_APPS_ENABLED }) @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -6553,7 +6546,8 @@ public class DevicePolicyManager { * IllegalArgumentException is thrown. * @param adminExtras Extras that will be passed to onEnable of the admin receiver on the new * user. * @param flags {@link #SKIP_SETUP_WIZARD} is supported. * @param flags {@link #SKIP_SETUP_WIZARD}, {@link #MAKE_USER_EPHEMERAL} and * {@link #LEAVE_ALL_SYSTEM_APPS_ENABLED} are supported. * @see UserHandle * @return the {@link android.os.UserHandle} object for the created user, or {@code null} if the * user could not be created. Loading @@ -6572,8 +6566,8 @@ public class DevicePolicyManager { } /** * Called by a device owner to remove a user and all associated data. The primary user can not * be removed. * Called by a device owner to remove a user/profile and all associated data. The primary user * can not be removed. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to remove. Loading @@ -6590,14 +6584,14 @@ public class DevicePolicyManager { } /** * Called by a device owner to switch the specified user to the foreground. * <p> This cannot be used to switch to a managed profile. * Called by a device owner to switch the specified secondary user to the foreground. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to switch to; null will switch to primary. * @return {@code true} if the switch was successful, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @see Intent#ACTION_USER_FOREGROUND * @see #getSecondaryUsers(ComponentName) */ public boolean switchUser(@NonNull ComponentName admin, @Nullable UserHandle userHandle) { throwIfParentInstance("switchUser"); Loading @@ -6608,14 +6602,33 @@ public class DevicePolicyManager { } } /** * Called by a device owner to start the specified secondary user in background. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to be stopped. * @return {@code true} if the user can be started, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @see #getSecondaryUsers(ComponentName) */ public boolean startUserInBackground( @NonNull ComponentName admin, @NonNull UserHandle userHandle) { throwIfParentInstance("startUserInBackground"); try { return mService.startUserInBackground(admin, userHandle); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Called by a device owner to stop the specified secondary user. * <p> This cannot be used to stop the primary user or a managed profile. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param userHandle the user to be stopped. * @return {@code true} if the user can be stopped, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @see #getSecondaryUsers(ComponentName) */ public boolean stopUser(@NonNull ComponentName admin, @NonNull UserHandle userHandle) { throwIfParentInstance("stopUser"); Loading @@ -6627,14 +6640,13 @@ public class DevicePolicyManager { } /** * Called by a profile owner that is affiliated with the device to stop the calling user * and switch back to primary. * <p> This has no effect when called on a managed profile. * Called by a profile owner of secondary user that is affiliated with the device to stop the * calling user and switch back to primary. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return {@code true} if the exit was successful, {@code false} otherwise. * @throws SecurityException if {@code admin} is not a profile owner affiliated with the device. * @see #isAffiliatedUser * @see #getSecondaryUsers(ComponentName) */ public boolean logoutUser(@NonNull ComponentName admin) { throwIfParentInstance("logoutUser"); Loading @@ -6646,17 +6658,18 @@ public class DevicePolicyManager { } /** * Called by a device owner to list all secondary users on the device, excluding managed * profiles. * Called by a device owner to list all secondary users on the device. Managed profiles are not * considered as secondary users. * <p> Used for various user management APIs, including {@link #switchUser}, {@link #removeUser} * and {@link #stopUser}. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return list of other {@link UserHandle}s on the device. * @throws SecurityException if {@code admin} is not a device owner. * @see #switchUser * @see #removeUser * @see #stopUser * @see #removeUser(ComponentName, UserHandle) * @see #switchUser(ComponentName, UserHandle) * @see #startUserInBackground(ComponentName, UserHandle) * @see #stopUser(ComponentName, UserHandle) */ public List<UserHandle> getSecondaryUsers(@NonNull ComponentName admin) { throwIfParentInstance("getSecondaryUsers"); Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ interface IDevicePolicyManager { UserHandle createAndManageUser(in ComponentName who, in String name, in ComponentName profileOwner, in PersistableBundle adminExtras, in int flags); boolean removeUser(in ComponentName who, in UserHandle userHandle); boolean switchUser(in ComponentName who, in UserHandle userHandle); boolean startUserInBackground(in ComponentName who, in UserHandle userHandle); boolean stopUser(in ComponentName who, in UserHandle userHandle); boolean logoutUser(in ComponentName who); List<UserHandle> getSecondaryUsers(in ComponentName who); Loading
services/core/java/com/android/server/am/ActivityManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -25130,6 +25130,11 @@ public class ActivityManagerService extends IActivityManager.Stub public void registerScreenObserver(ScreenObserver observer) { mScreenObservers.add(observer); } @Override public boolean canStartMoreUsers() { return mUserController.canStartMoreUsers(); } } /**