am 49a2a698: Merge "Add helper function to extract app ID from shared app gid." into mnc-dev

* commit '49a2a6985d49b7356fd319266dd502f27964e69d':
  Add helper function to extract app ID from shared app gid.
This commit is contained in:
Adam Lesinski
2015-06-30 23:25:51 +00:00
committed by Android Git Automerger

View File

@@ -178,6 +178,19 @@ public final class UserHandle implements Parcelable {
- Process.FIRST_APPLICATION_UID;
}
/**
* 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.