summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJordan Jozwiak <jjoz@google.com>2020-10-20 17:21:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-10-20 17:21:24 +0000
commit2a4b6d802409dfb0f4e101fe2239b5700594e37c (patch)
treea16941ad6dce13526735027ce4df96bc84a415e7 /core/java
parentd44087303d29524d86e1e5385fb62b870e91ff53 (diff)
parent64ec3641ad110eb5e2875c50e2797ead0932fa2c (diff)
Merge "Move constants from service to manager"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/UserManager.java46
1 files changed, 44 insertions, 2 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 4b63f0f713a0..b0e76e3ea851 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.
*/
public static final int USER_OPERATION_SUCCESS = 0;
@@ -3981,11 +4023,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) {