From 64ec3641ad110eb5e2875c50e2797ead0932fa2c Mon Sep 17 00:00:00 2001 From: Jordan Jozwiak Date: Thu, 15 Oct 2020 15:30:30 -0700 Subject: Move constants from service to manager These constants must be in the Manager so that they can be accessed by CarUserManagerService. They are @hide since they are not meant to be exposed publicly. Bug: 155913815 Test: atest UserManagerTest Change-Id: I62922c1487e2eb0d66f38ac7b0b8d58f31d3ec90 --- core/java/android/os/UserManager.java | 46 +++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 42ae93030f38..33524c92b9f5 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -1467,6 +1467,48 @@ public class UserManager { }) public @interface UserSwitchabilityResult {} + /** + * A response code from {@link #removeUserOrSetEphemeral(int)} indicating that the specified + * user has been successfully removed. + * @hide + */ + public static final int REMOVE_RESULT_REMOVED = 0; + + /** + * A response code from {@link #removeUserOrSetEphemeral(int)} indicating that the specified + * user has had its {@link UserInfo#FLAG_EPHEMERAL} flag set to {@code true}, so that it will be + * removed when the user is stopped or on boot. + * @hide + */ + public static final int REMOVE_RESULT_SET_EPHEMERAL = 1; + + /** + * A response code from {@link #removeUserOrSetEphemeral(int)} indicating that the specified + * user is already in the process of being removed. + * @hide + */ + public static final int REMOVE_RESULT_ALREADY_BEING_REMOVED = 2; + + /** + * A response code from {@link #removeUserOrSetEphemeral(int)} indicating that an error occurred + * that prevented the user from being removed or set as ephemeral. + * @hide + */ + public static final int REMOVE_RESULT_ERROR = 3; + + /** + * Possible response codes from {@link #removeUserOrSetEphemeral(int)}. + * @hide + */ + @IntDef(prefix = { "REMOVE_RESULT_" }, value = { + REMOVE_RESULT_REMOVED, + REMOVE_RESULT_SET_EPHEMERAL, + REMOVE_RESULT_ALREADY_BEING_REMOVED, + REMOVE_RESULT_ERROR, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface RemoveResult {} + /** * Indicates user operation is successful. */ @@ -3982,11 +4024,11 @@ public class UserManager { * the current user, then set the user as ephemeral so that it will be removed when it is * stopped. * - * @return the {@link com.android.server.pm.UserManagerService.RemoveResult} code + * @return the {@link RemoveResult} code * @hide */ @RequiresPermission(android.Manifest.permission.MANAGE_USERS) - public int removeUserOrSetEphemeral(@UserIdInt int userId) { + public @RemoveResult int removeUserOrSetEphemeral(@UserIdInt int userId) { try { return mService.removeUserOrSetEphemeral(userId); } catch (RemoteException re) { -- cgit v1.2.3