diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-08-14 19:47:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-14 19:47:54 +0000 |
commit | 479c482ca1788235afc776125eb6a79f1d9281c8 (patch) | |
tree | bce98be6376dbb79b8fc3169c5dc8d568a47ff55 | |
parent | ac5f962898de5a00fa2067e987b94bc28c5bb096 (diff) | |
parent | 504600bb09e51f0187d81cacb1dc2de77c6256b6 (diff) | |
download | frameworks_base-479c482ca1788235afc776125eb6a79f1d9281c8.zip frameworks_base-479c482ca1788235afc776125eb6a79f1d9281c8.tar.gz frameworks_base-479c482ca1788235afc776125eb6a79f1d9281c8.tar.bz2 |
am 504600bb: Merge "Fix UserHandle.getAppIdFromSharedAppGid to allow system UIDs" into mnc-dev
* commit '504600bb09e51f0187d81cacb1dc2de77c6256b6':
Fix UserHandle.getAppIdFromSharedAppGid to allow system UIDs
-rw-r--r-- | core/java/android/os/UserHandle.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java index 20bcf62..bfca719 100644 --- a/core/java/android/os/UserHandle.java +++ b/core/java/android/os/UserHandle.java @@ -179,16 +179,16 @@ public final class UserHandle implements Parcelable { } /** - * Returns the app id for a given shared app gid. + * Returns the app id for a given shared app gid. Returns -1 if the ID is invalid. * @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"); + final int appId = getAppId(gid) + Process.FIRST_APPLICATION_UID + - Process.FIRST_SHARED_APPLICATION_GID; + if (appId < 0 || appId >= Process.FIRST_SHARED_APPLICATION_GID) { + return -1; } - return (noUserGid + Process.FIRST_APPLICATION_UID) - Process.FIRST_SHARED_APPLICATION_GID; + return appId; } /** |