summaryrefslogtreecommitdiff
path: root/core/java/android/os/UserHandle.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/os/UserHandle.java')
-rw-r--r--core/java/android/os/UserHandle.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 6381b56a6503..5be72bc5c54b 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -126,7 +126,10 @@ public final class UserHandle implements Parcelable {
return getAppId(uid1) == getAppId(uid2);
}
- /** @hide */
+ /**
+ * Whether a UID is an "isolated" UID.
+ * @hide
+ */
public static boolean isIsolated(int uid) {
if (uid > 0) {
final int appId = getAppId(uid);
@@ -136,7 +139,11 @@ public final class UserHandle implements Parcelable {
}
}
- /** @hide */
+ /**
+ * Whether a UID belongs to a regular app. *Note* "Not a regular app" does not mean
+ * "it's system", because of isolated UIDs. Use {@link #isCore} for that.
+ * @hide
+ */
public static boolean isApp(int uid) {
if (uid > 0) {
final int appId = getAppId(uid);
@@ -147,6 +154,19 @@ public final class UserHandle implements Parcelable {
}
/**
+ * Whether a UID belongs to a system core component or not.
+ * @hide
+ */
+ public static boolean isCore(int uid) {
+ if (uid > 0) {
+ final int appId = getAppId(uid);
+ return appId < Process.FIRST_APPLICATION_UID;
+ } else {
+ return false;
+ }
+ }
+
+ /**
* Returns the user for a given uid.
* @param uid A uid for an application running in a particular user.
* @return A {@link UserHandle} for that user.