summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Lee <rgl@google.com>2014-06-04 20:51:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-04 20:51:55 +0000
commite46e60041215249a285384cd2282de9f4d956a04 (patch)
treedf7c12f8807c449754f8d23de7d77b66a622a1f7
parentfdb15a76a30de169aac63d4c2260aa293477557e (diff)
parente66b6890ee59d108ae5c608f6ec8d4ad20cb06a8 (diff)
downloadbase-e46e60041215249a285384cd2282de9f4d956a04.tar.gz
Merge "Assign AID_EVERYONE gid to newly-created processes"
-rw-r--r--core/java/android/os/Process.java6
-rw-r--r--core/java/android/os/UserHandle.java8
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java11
3 files changed, 20 insertions, 5 deletions
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 28797cebde14..5b9b5b051def 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -156,6 +156,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.
* @hide
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 6e693a41230f..914c170881c3 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -145,6 +145,14 @@ public final class UserHandle implements Parcelable {
}
/**
+ * 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
*/
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 17a4d90ec03e..baeced713fbd 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -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