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

Commit 49a2a698 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android (Google) Code Review
Browse files

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

parents 2b64ec47 f4216d30
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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.