am 4891a9f9: am e46e6004: Merge "Assign AID_EVERYONE gid to newly-created processes"

* commit '4891a9f9cfee569c0d362f1781f44493f5e320c0':
  Assign AID_EVERYONE gid to newly-created processes
This commit is contained in:
Robin Lee
2014-06-04 21:09:52 +00:00
committed by Android Git Automerger
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

@@ -2693,16 +2693,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 != FactoryTest.FACTORY_TEST_OFF) {
if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL