summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-06-30 23:16:18 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-30 23:16:20 +0000
commit49a2a6985d49b7356fd319266dd502f27964e69d (patch)
tree18a45db2ec0d4ccb924ab282e80bba911326d67e /core/java/android
parent2b64ec470c7f18a2e8995d6131d99c58849f9938 (diff)
parentf4216d30cd768638eebdb4124abae95bdf5b3597 (diff)
downloadframeworks_base-49a2a6985d49b7356fd319266dd502f27964e69d.zip
frameworks_base-49a2a6985d49b7356fd319266dd502f27964e69d.tar.gz
frameworks_base-49a2a6985d49b7356fd319266dd502f27964e69d.tar.bz2
Merge "Add helper function to extract app ID from shared app gid." into mnc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/UserHandle.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 6874e77..511bd5f 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -179,6 +179,19 @@ public final class UserHandle implements Parcelable {
}
/**
+ * Returns the app id for a given shared app gid.
+ * @hide
+ */
+ public static final int getAppIdFromSharedAppGid(int gid) {
+ final int noUserGid = getAppId(gid);
+ if (noUserGid < Process.FIRST_SHARED_APPLICATION_GID ||
+ noUserGid > Process.LAST_SHARED_APPLICATION_GID) {
+ throw new IllegalArgumentException(Integer.toString(gid) + " is not a shared app gid");
+ }
+ return (noUserGid + Process.FIRST_APPLICATION_UID) - Process.FIRST_SHARED_APPLICATION_GID;
+ }
+
+ /**
* Generate a text representation of the uid, breaking out its individual
* components -- user, app, isolated, etc.
* @hide