Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c852a3e3 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android Git Automerger
Browse files

am eb694bb6: am 546909c9: am 479c482c: am 504600bb: Merge "Fix...

am eb694bb6: am 546909c9: am 479c482c: am 504600bb: Merge "Fix UserHandle.getAppIdFromSharedAppGid to allow system UIDs" into mnc-dev

* commit 'eb694bb6':
  Fix UserHandle.getAppIdFromSharedAppGid to allow system UIDs
parents c0455509 eb694bb6
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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;
    }

    /**