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

Commit e46e6004 authored by Robin Lee's avatar Robin Lee Committed by Gerrit Code Review
Browse files

Merge "Assign AID_EVERYONE gid to newly-created processes"

parents fdb15a76 e66b6890
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -155,6 +155,12 @@ public class Process {
     */
    public static final int LAST_ISOLATED_UID = 99999;

    /**
     * Defines the gid shared by all applications running under the same profile.
     * @hide
     */
    public static final int SHARED_USER_GID = 9997;

    /**
     * First gid for applications to share resources. Used when forward-locking
     * is enabled but all UserHandles need to be able to read the resources.
+8 −0
Original line number Diff line number Diff line
@@ -144,6 +144,14 @@ public final class UserHandle implements Parcelable {
        return uid % PER_USER_RANGE;
    }

    /**
     * Returns the gid shared between all apps with this userId.
     * @hide
     */
    public static final int getUserGid(int userId) {
        return getUid(userId, Process.SHARED_USER_GID);
    }

    /**
     * Returns the shared app gid for a given uid or appId.
     * @hide
+6 −5
Original line number Diff line number Diff line
@@ -2735,16 +2735,17 @@ public final class ActivityManagerService extends ActivityManagerNative
                }
                /*
                 * Add shared application GID so applications can share some
                 * resources like shared libraries
                 * Add shared application and profile GIDs so applications can share some
                 * resources like shared libraries and access user-wide resources
                 */
                if (permGids == null) {
                    gids = new int[1];
                    gids = new int[2];
                } else {
                    gids = new int[permGids.length + 1];
                    System.arraycopy(permGids, 0, gids, 1, permGids.length);
                    gids = new int[permGids.length + 2];
                    System.arraycopy(permGids, 0, gids, 2, permGids.length);
                }
                gids[0] = UserHandle.getSharedAppGid(UserHandle.getAppId(uid));
                gids[1] = UserHandle.getUserGid(UserHandle.getUserId(uid));
            }
            if (mFactoryTest != SystemServer.FACTORY_TEST_OFF) {
                if (mFactoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL