summaryrefslogtreecommitdiff
path: root/core/java/android/os/UserHandle.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-11-11 12:45:44 -0800
committerDianne Hackborn <hackbod@google.com>2015-11-11 12:45:44 -0800
commit3cdb56efea044112bfe1b97b3ed78ee05e0dba46 (patch)
tree7ce08b219efec3083b9d7399ac5e795c06068724 /core/java/android/os/UserHandle.java
parent609b5b8c8e22ab0ea1caca1fed42cdf891c853c6 (diff)
Some debugging improvements.
- Fix dumping of package manager intent filters so the option to print the filter detail works again. - Extend dump resolvers to allow you to specify the specific types of resolvers you'd like to dump. - Add new package manager commands for querying activities, services, receivers. - Move the code for parsing a command line into an intent to the framework, so it can be used by the new package manager commands and later elsewhere. Change-Id: I56ea2bb8c3dd0e5198ee333be8f41ad9dcdb626f
Diffstat (limited to 'core/java/android/os/UserHandle.java')
-rw-r--r--core/java/android/os/UserHandle.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 95da438bc869..f946ca7ed415 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -256,6 +256,23 @@ public final class UserHandle implements Parcelable {
}
}
+ /** @hide */
+ public static int parseUserArg(String arg) {
+ int userId;
+ if ("all".equals(arg)) {
+ userId = UserHandle.USER_ALL;
+ } else if ("current".equals(arg) || "cur".equals(arg)) {
+ userId = UserHandle.USER_CURRENT;
+ } else {
+ try {
+ userId = Integer.parseInt(arg);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Bad user number: " + arg);
+ }
+ }
+ return userId;
+ }
+
/**
* Returns the user id of the current process
* @return user id of the current process