summaryrefslogtreecommitdiffstats
path: root/core/java/android/os/Process.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/os/Process.java')
-rw-r--r--core/java/android/os/Process.java52
1 files changed, 46 insertions, 6 deletions
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 6ab4dc1..05099fb 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -116,6 +116,12 @@ public class Process {
public static final int NFC_UID = 1027;
/**
+ * Defines the UID/GID for the Bluetooth service process.
+ * @hide
+ */
+ public static final int BLUETOOTH_UID = 1002;
+
+ /**
* Defines the GID for the group that allows write access to the internal media storage.
* @hide
*/
@@ -146,10 +152,24 @@ public class Process {
public static final int LAST_ISOLATED_UID = 99999;
/**
+ * 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
+ */
+ public static final int FIRST_SHARED_APPLICATION_GID = 50000;
+
+ /**
+ * Last gid for applications to share resources. Used when forward-locking
+ * is enabled but all UserHandles need to be able to read the resources.
+ * @hide
+ */
+ public static final int LAST_SHARED_APPLICATION_GID = 59999;
+
+ /**
* Defines a secondary group id for access to the bluetooth hardware.
*/
public static final int BLUETOOTH_GID = 2000;
-
+
/**
* Standard priority of application threads.
* Use with {@link #setThreadPriority(int)} and
@@ -370,12 +390,13 @@ public class Process {
public static final ProcessStartResult start(final String processClass,
final String niceName,
int uid, int gid, int[] gids,
- int debugFlags, int targetSdkVersion,
+ int debugFlags, int mountExternal,
+ int targetSdkVersion,
String seInfo,
String[] zygoteArgs) {
try {
return startViaZygote(processClass, niceName, uid, gid, gids,
- debugFlags, targetSdkVersion, seInfo, zygoteArgs);
+ debugFlags, mountExternal, targetSdkVersion, seInfo, zygoteArgs);
} catch (ZygoteStartFailedEx ex) {
Log.e(LOG_TAG,
"Starting VM process through Zygote failed");
@@ -547,7 +568,8 @@ public class Process {
final String niceName,
final int uid, final int gid,
final int[] gids,
- int debugFlags, int targetSdkVersion,
+ int debugFlags, int mountExternal,
+ int targetSdkVersion,
String seInfo,
String[] extraArgs)
throws ZygoteStartFailedEx {
@@ -574,6 +596,11 @@ public class Process {
if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) {
argsForZygote.add("--enable-assert");
}
+ if (mountExternal == Zygote.MOUNT_EXTERNAL_MULTIUSER) {
+ argsForZygote.add("--mount-external-multiuser");
+ } else if (mountExternal == Zygote.MOUNT_EXTERNAL_MULTIUSER_ALL) {
+ argsForZygote.add("--mount-external-multiuser-all");
+ }
argsForZygote.add("--target-sdk-version=" + targetSdkVersion);
//TODO optionally enable debuger
@@ -634,16 +661,29 @@ public class Process {
public static final native int myTid();
/**
- * Returns the identifier of this process's user.
+ * Returns the identifier of this process's uid. This is the kernel uid
+ * that the process is running under, which is the identity of its
+ * app-specific sandbox. It is different from {@link #myUserHandle} in that
+ * a uid identifies a specific app sandbox in a specific user.
*/
public static final native int myUid();
/**
+ * Returns this process's user handle. This is the
+ * user the process is running under. It is distinct from
+ * {@link #myUid()} in that a particular user will have multiple
+ * distinct apps running under it each with their own uid.
+ */
+ public static final UserHandle myUserHandle() {
+ return new UserHandle(UserHandle.getUserId(myUid()));
+ }
+
+ /**
* Returns whether the current process is in an isolated sandbox.
* @hide
*/
public static final boolean isIsolated() {
- int uid = UserId.getAppId(myUid());
+ int uid = UserHandle.getAppId(myUid());
return uid >= FIRST_ISOLATED_UID && uid <= LAST_ISOLATED_UID;
}