Merge "Assign AID_EVERYONE gid to newly-created processes"

This commit is contained in:
Robin Lee
2014-06-04 20:51:53 +00:00
committed by Gerrit Code Review
3 changed files with 20 additions and 5 deletions

View File

@ -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.

View File

@ -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

View File

@ -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