resolve merge conflicts of e017dae587 to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution. Change-Id: I7008986501028ec9bee0505d41aae3ff27872b50
This commit is contained in:
@@ -19,8 +19,8 @@ package android.os;
|
|||||||
import android.annotation.TestApi;
|
import android.annotation.TestApi;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.system.OsConstants;
|
import android.system.OsConstants;
|
||||||
import android.util.Log;
|
|
||||||
import android.webkit.WebViewZygote;
|
import android.webkit.WebViewZygote;
|
||||||
|
|
||||||
import dalvik.system.VMRuntime;
|
import dalvik.system.VMRuntime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -423,7 +423,7 @@ public class Process {
|
|||||||
*
|
*
|
||||||
* When invokeWith is not null, the process will be started as a fresh app
|
* When invokeWith is not null, the process will be started as a fresh app
|
||||||
* and not a zygote fork. Note that this is only allowed for uid 0 or when
|
* and not a zygote fork. Note that this is only allowed for uid 0 or when
|
||||||
* debugFlags contains DEBUG_ENABLE_DEBUGGER.
|
* runtimeFlags contains DEBUG_ENABLE_DEBUGGER.
|
||||||
*
|
*
|
||||||
* @param processClass The class to use as the process's main entry
|
* @param processClass The class to use as the process's main entry
|
||||||
* point.
|
* point.
|
||||||
@@ -431,7 +431,7 @@ public class Process {
|
|||||||
* @param uid The user-id under which the process will run.
|
* @param uid The user-id under which the process will run.
|
||||||
* @param gid The group-id under which the process will run.
|
* @param gid The group-id under which the process will run.
|
||||||
* @param gids Additional group-ids associated with the process.
|
* @param gids Additional group-ids associated with the process.
|
||||||
* @param debugFlags Additional flags.
|
* @param runtimeFlags Additional flags for the runtime.
|
||||||
* @param targetSdkVersion The target SDK version for the app.
|
* @param targetSdkVersion The target SDK version for the app.
|
||||||
* @param seInfo null-ok SELinux information for the new process.
|
* @param seInfo null-ok SELinux information for the new process.
|
||||||
* @param abi non-null the ABI this app should be started with.
|
* @param abi non-null the ABI this app should be started with.
|
||||||
@@ -448,7 +448,7 @@ public class Process {
|
|||||||
public static final ProcessStartResult start(final String processClass,
|
public static final ProcessStartResult start(final String processClass,
|
||||||
final String niceName,
|
final String niceName,
|
||||||
int uid, int gid, int[] gids,
|
int uid, int gid, int[] gids,
|
||||||
int debugFlags, int mountExternal,
|
int runtimeFlags, int mountExternal,
|
||||||
int targetSdkVersion,
|
int targetSdkVersion,
|
||||||
String seInfo,
|
String seInfo,
|
||||||
String abi,
|
String abi,
|
||||||
@@ -457,7 +457,7 @@ public class Process {
|
|||||||
String invokeWith,
|
String invokeWith,
|
||||||
String[] zygoteArgs) {
|
String[] zygoteArgs) {
|
||||||
return zygoteProcess.start(processClass, niceName, uid, gid, gids,
|
return zygoteProcess.start(processClass, niceName, uid, gid, gids,
|
||||||
debugFlags, mountExternal, targetSdkVersion, seInfo,
|
runtimeFlags, mountExternal, targetSdkVersion, seInfo,
|
||||||
abi, instructionSet, appDataDir, invokeWith, zygoteArgs);
|
abi, instructionSet, appDataDir, invokeWith, zygoteArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ public class Process {
|
|||||||
public static final ProcessStartResult startWebView(final String processClass,
|
public static final ProcessStartResult startWebView(final String processClass,
|
||||||
final String niceName,
|
final String niceName,
|
||||||
int uid, int gid, int[] gids,
|
int uid, int gid, int[] gids,
|
||||||
int debugFlags, int mountExternal,
|
int runtimeFlags, int mountExternal,
|
||||||
int targetSdkVersion,
|
int targetSdkVersion,
|
||||||
String seInfo,
|
String seInfo,
|
||||||
String abi,
|
String abi,
|
||||||
@@ -474,7 +474,7 @@ public class Process {
|
|||||||
String invokeWith,
|
String invokeWith,
|
||||||
String[] zygoteArgs) {
|
String[] zygoteArgs) {
|
||||||
return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids,
|
return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids,
|
||||||
debugFlags, mountExternal, targetSdkVersion, seInfo,
|
runtimeFlags, mountExternal, targetSdkVersion, seInfo,
|
||||||
abi, instructionSet, appDataDir, invokeWith, zygoteArgs);
|
abi, instructionSet, appDataDir, invokeWith, zygoteArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ import android.net.LocalSocket;
|
|||||||
import android.net.LocalSocketAddress;
|
import android.net.LocalSocketAddress;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.os.Zygote;
|
import com.android.internal.os.Zygote;
|
||||||
import com.android.internal.util.Preconditions;
|
import com.android.internal.util.Preconditions;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -173,7 +175,7 @@ public class ZygoteProcess {
|
|||||||
*
|
*
|
||||||
* When invokeWith is not null, the process will be started as a fresh app
|
* When invokeWith is not null, the process will be started as a fresh app
|
||||||
* and not a zygote fork. Note that this is only allowed for uid 0 or when
|
* and not a zygote fork. Note that this is only allowed for uid 0 or when
|
||||||
* debugFlags contains DEBUG_ENABLE_DEBUGGER.
|
* runtimeFlags contains DEBUG_ENABLE_DEBUGGER.
|
||||||
*
|
*
|
||||||
* @param processClass The class to use as the process's main entry
|
* @param processClass The class to use as the process's main entry
|
||||||
* point.
|
* point.
|
||||||
@@ -181,7 +183,7 @@ public class ZygoteProcess {
|
|||||||
* @param uid The user-id under which the process will run.
|
* @param uid The user-id under which the process will run.
|
||||||
* @param gid The group-id under which the process will run.
|
* @param gid The group-id under which the process will run.
|
||||||
* @param gids Additional group-ids associated with the process.
|
* @param gids Additional group-ids associated with the process.
|
||||||
* @param debugFlags Additional flags.
|
* @param runtimeFlags Additional flags.
|
||||||
* @param targetSdkVersion The target SDK version for the app.
|
* @param targetSdkVersion The target SDK version for the app.
|
||||||
* @param seInfo null-ok SELinux information for the new process.
|
* @param seInfo null-ok SELinux information for the new process.
|
||||||
* @param abi non-null the ABI this app should be started with.
|
* @param abi non-null the ABI this app should be started with.
|
||||||
@@ -196,7 +198,7 @@ public class ZygoteProcess {
|
|||||||
public final Process.ProcessStartResult start(final String processClass,
|
public final Process.ProcessStartResult start(final String processClass,
|
||||||
final String niceName,
|
final String niceName,
|
||||||
int uid, int gid, int[] gids,
|
int uid, int gid, int[] gids,
|
||||||
int debugFlags, int mountExternal,
|
int runtimeFlags, int mountExternal,
|
||||||
int targetSdkVersion,
|
int targetSdkVersion,
|
||||||
String seInfo,
|
String seInfo,
|
||||||
String abi,
|
String abi,
|
||||||
@@ -206,7 +208,7 @@ public class ZygoteProcess {
|
|||||||
String[] zygoteArgs) {
|
String[] zygoteArgs) {
|
||||||
try {
|
try {
|
||||||
return startViaZygote(processClass, niceName, uid, gid, gids,
|
return startViaZygote(processClass, niceName, uid, gid, gids,
|
||||||
debugFlags, mountExternal, targetSdkVersion, seInfo,
|
runtimeFlags, mountExternal, targetSdkVersion, seInfo,
|
||||||
abi, instructionSet, appDataDir, invokeWith, zygoteArgs);
|
abi, instructionSet, appDataDir, invokeWith, zygoteArgs);
|
||||||
} catch (ZygoteStartFailedEx ex) {
|
} catch (ZygoteStartFailedEx ex) {
|
||||||
Log.e(LOG_TAG,
|
Log.e(LOG_TAG,
|
||||||
@@ -317,7 +319,7 @@ public class ZygoteProcess {
|
|||||||
* @param gid a POSIX gid that the new process shuold setgid() to
|
* @param gid a POSIX gid that the new process shuold setgid() to
|
||||||
* @param gids null-ok; a list of supplementary group IDs that the
|
* @param gids null-ok; a list of supplementary group IDs that the
|
||||||
* new process should setgroup() to.
|
* new process should setgroup() to.
|
||||||
* @param debugFlags Additional flags.
|
* @param runtimeFlags Additional flags for the runtime.
|
||||||
* @param targetSdkVersion The target SDK version for the app.
|
* @param targetSdkVersion The target SDK version for the app.
|
||||||
* @param seInfo null-ok SELinux information for the new process.
|
* @param seInfo null-ok SELinux information for the new process.
|
||||||
* @param abi the ABI the process should use.
|
* @param abi the ABI the process should use.
|
||||||
@@ -331,7 +333,7 @@ public class ZygoteProcess {
|
|||||||
final String niceName,
|
final String niceName,
|
||||||
final int uid, final int gid,
|
final int uid, final int gid,
|
||||||
final int[] gids,
|
final int[] gids,
|
||||||
int debugFlags, int mountExternal,
|
int runtimeFlags, int mountExternal,
|
||||||
int targetSdkVersion,
|
int targetSdkVersion,
|
||||||
String seInfo,
|
String seInfo,
|
||||||
String abi,
|
String abi,
|
||||||
@@ -347,33 +349,7 @@ public class ZygoteProcess {
|
|||||||
argsForZygote.add("--runtime-args");
|
argsForZygote.add("--runtime-args");
|
||||||
argsForZygote.add("--setuid=" + uid);
|
argsForZygote.add("--setuid=" + uid);
|
||||||
argsForZygote.add("--setgid=" + gid);
|
argsForZygote.add("--setgid=" + gid);
|
||||||
if ((debugFlags & Zygote.DEBUG_ENABLE_JNI_LOGGING) != 0) {
|
argsForZygote.add("--runtime-flags=" + runtimeFlags);
|
||||||
argsForZygote.add("--enable-jni-logging");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_ENABLE_SAFEMODE) != 0) {
|
|
||||||
argsForZygote.add("--enable-safemode");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_ENABLE_JDWP) != 0) {
|
|
||||||
argsForZygote.add("--enable-jdwp");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_ENABLE_CHECKJNI) != 0) {
|
|
||||||
argsForZygote.add("--enable-checkjni");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_GENERATE_DEBUG_INFO) != 0) {
|
|
||||||
argsForZygote.add("--generate-debug-info");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_ALWAYS_JIT) != 0) {
|
|
||||||
argsForZygote.add("--always-jit");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_NATIVE_DEBUGGABLE) != 0) {
|
|
||||||
argsForZygote.add("--native-debuggable");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_JAVA_DEBUGGABLE) != 0) {
|
|
||||||
argsForZygote.add("--java-debuggable");
|
|
||||||
}
|
|
||||||
if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) {
|
|
||||||
argsForZygote.add("--enable-assert");
|
|
||||||
}
|
|
||||||
if (mountExternal == Zygote.MOUNT_EXTERNAL_DEFAULT) {
|
if (mountExternal == Zygote.MOUNT_EXTERNAL_DEFAULT) {
|
||||||
argsForZygote.add("--mount-external-default");
|
argsForZygote.add("--mount-external-default");
|
||||||
} else if (mountExternal == Zygote.MOUNT_EXTERNAL_READ) {
|
} else if (mountExternal == Zygote.MOUNT_EXTERNAL_READ) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.lang.reflect.Method;
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public final class Zygote {
|
public final class Zygote {
|
||||||
/*
|
/*
|
||||||
* Bit values for "debugFlags" argument. The definitions are duplicated
|
* Bit values for "runtimeFlags" argument. The definitions are duplicated
|
||||||
* in the native code.
|
* in the native code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ public final class Zygote {
|
|||||||
* fork()ing and and before spawning any threads.
|
* fork()ing and and before spawning any threads.
|
||||||
* @param gids null-ok; a list of UNIX gids that the new process should
|
* @param gids null-ok; a list of UNIX gids that the new process should
|
||||||
* setgroups() to after fork and before spawning any threads.
|
* setgroups() to after fork and before spawning any threads.
|
||||||
* @param debugFlags bit flags that enable debugging features.
|
* @param runtimeFlags bit flags that enable ART features.
|
||||||
* @param rlimits null-ok an array of rlimit tuples, with the second
|
* @param rlimits null-ok an array of rlimit tuples, with the second
|
||||||
* dimension having a length of 3 and representing
|
* dimension having a length of 3 and representing
|
||||||
* (resource, rlim_cur, rlim_max). These are set via the posix
|
* (resource, rlim_cur, rlim_max). These are set via the posix
|
||||||
@@ -96,14 +96,14 @@ public final class Zygote {
|
|||||||
* @return 0 if this is the child, pid of the child
|
* @return 0 if this is the child, pid of the child
|
||||||
* if this is the parent, or -1 on error.
|
* if this is the parent, or -1 on error.
|
||||||
*/
|
*/
|
||||||
public static int forkAndSpecialize(int uid, int gid, int[] gids, int debugFlags,
|
public static int forkAndSpecialize(int uid, int gid, int[] gids, int runtimeFlags,
|
||||||
int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
|
int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
|
||||||
int[] fdsToIgnore, String instructionSet, String appDataDir) {
|
int[] fdsToIgnore, String instructionSet, String appDataDir) {
|
||||||
VM_HOOKS.preFork();
|
VM_HOOKS.preFork();
|
||||||
// Resets nice priority for zygote process.
|
// Resets nice priority for zygote process.
|
||||||
resetNicePriority();
|
resetNicePriority();
|
||||||
int pid = nativeForkAndSpecialize(
|
int pid = nativeForkAndSpecialize(
|
||||||
uid, gid, gids, debugFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose,
|
uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose,
|
||||||
fdsToIgnore, instructionSet, appDataDir);
|
fdsToIgnore, instructionSet, appDataDir);
|
||||||
// Enable tracing as soon as possible for the child process.
|
// Enable tracing as soon as possible for the child process.
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
@@ -116,7 +116,7 @@ public final class Zygote {
|
|||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
native private static int nativeForkAndSpecialize(int uid, int gid, int[] gids,int debugFlags,
|
native private static int nativeForkAndSpecialize(int uid, int gid, int[] gids,int runtimeFlags,
|
||||||
int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
|
int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
|
||||||
int[] fdsToIgnore, String instructionSet, String appDataDir);
|
int[] fdsToIgnore, String instructionSet, String appDataDir);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public final class Zygote {
|
|||||||
* fork()ing and and before spawning any threads.
|
* fork()ing and and before spawning any threads.
|
||||||
* @param gids null-ok; a list of UNIX gids that the new process should
|
* @param gids null-ok; a list of UNIX gids that the new process should
|
||||||
* setgroups() to after fork and before spawning any threads.
|
* setgroups() to after fork and before spawning any threads.
|
||||||
* @param debugFlags bit flags that enable debugging features.
|
* @param runtimeFlags bit flags that enable ART features.
|
||||||
* @param rlimits null-ok an array of rlimit tuples, with the second
|
* @param rlimits null-ok an array of rlimit tuples, with the second
|
||||||
* dimension having a length of 3 and representing
|
* dimension having a length of 3 and representing
|
||||||
* (resource, rlim_cur, rlim_max). These are set via the posix
|
* (resource, rlim_cur, rlim_max). These are set via the posix
|
||||||
@@ -148,13 +148,13 @@ public final class Zygote {
|
|||||||
* @return 0 if this is the child, pid of the child
|
* @return 0 if this is the child, pid of the child
|
||||||
* if this is the parent, or -1 on error.
|
* if this is the parent, or -1 on error.
|
||||||
*/
|
*/
|
||||||
public static int forkSystemServer(int uid, int gid, int[] gids, int debugFlags,
|
public static int forkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
|
||||||
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities) {
|
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities) {
|
||||||
VM_HOOKS.preFork();
|
VM_HOOKS.preFork();
|
||||||
// Resets nice priority for zygote process.
|
// Resets nice priority for zygote process.
|
||||||
resetNicePriority();
|
resetNicePriority();
|
||||||
int pid = nativeForkSystemServer(
|
int pid = nativeForkSystemServer(
|
||||||
uid, gid, gids, debugFlags, rlimits, permittedCapabilities, effectiveCapabilities);
|
uid, gid, gids, runtimeFlags, rlimits, permittedCapabilities, effectiveCapabilities);
|
||||||
// Enable tracing as soon as we enter the system_server.
|
// Enable tracing as soon as we enter the system_server.
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
Trace.setTracingEnabled(true, debugFlags);
|
Trace.setTracingEnabled(true, debugFlags);
|
||||||
@@ -163,7 +163,7 @@ public final class Zygote {
|
|||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
native private static int nativeForkSystemServer(int uid, int gid, int[] gids, int debugFlags,
|
native private static int nativeForkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
|
||||||
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities);
|
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,9 +177,9 @@ public final class Zygote {
|
|||||||
*/
|
*/
|
||||||
native protected static void nativeUnmountStorageOnInit();
|
native protected static void nativeUnmountStorageOnInit();
|
||||||
|
|
||||||
private static void callPostForkChildHooks(int debugFlags, boolean isSystemServer,
|
private static void callPostForkChildHooks(int runtimeFlags, boolean isSystemServer,
|
||||||
String instructionSet) {
|
String instructionSet) {
|
||||||
VM_HOOKS.postForkChild(debugFlags, isSystemServer, instructionSet);
|
VM_HOOKS.postForkChild(runtimeFlags, isSystemServer, instructionSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class ZygoteConnection {
|
|||||||
fd = null;
|
fd = null;
|
||||||
|
|
||||||
pid = Zygote.forkAndSpecialize(parsedArgs.uid, parsedArgs.gid, parsedArgs.gids,
|
pid = Zygote.forkAndSpecialize(parsedArgs.uid, parsedArgs.gid, parsedArgs.gids,
|
||||||
parsedArgs.debugFlags, rlimits, parsedArgs.mountExternal, parsedArgs.seInfo,
|
parsedArgs.runtimeFlags, rlimits, parsedArgs.mountExternal, parsedArgs.seInfo,
|
||||||
parsedArgs.niceName, fdsToClose, fdsToIgnore, parsedArgs.instructionSet,
|
parsedArgs.niceName, fdsToClose, fdsToIgnore, parsedArgs.instructionSet,
|
||||||
parsedArgs.appDataDir);
|
parsedArgs.appDataDir);
|
||||||
} catch (ErrnoException ex) {
|
} catch (ErrnoException ex) {
|
||||||
@@ -367,11 +367,9 @@ class ZygoteConnection {
|
|||||||
int[] gids;
|
int[] gids;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From --enable-jdwp, --enable-checkjni, --enable-assert,
|
* From --runtime-flags.
|
||||||
* --enable-safemode, --generate-debug-info, --enable-jni-logging,
|
|
||||||
* --java-debuggable, and --native-debuggable.
|
|
||||||
*/
|
*/
|
||||||
int debugFlags;
|
int runtimeFlags;
|
||||||
|
|
||||||
/** From --mount-external */
|
/** From --mount-external */
|
||||||
int mountExternal = Zygote.MOUNT_EXTERNAL_NONE;
|
int mountExternal = Zygote.MOUNT_EXTERNAL_NONE;
|
||||||
@@ -487,26 +485,11 @@ class ZygoteConnection {
|
|||||||
targetSdkVersionSpecified = true;
|
targetSdkVersionSpecified = true;
|
||||||
targetSdkVersion = Integer.parseInt(
|
targetSdkVersion = Integer.parseInt(
|
||||||
arg.substring(arg.indexOf('=') + 1));
|
arg.substring(arg.indexOf('=') + 1));
|
||||||
} else if (arg.equals("--enable-jdwp")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
|
||||||
} else if (arg.equals("--enable-safemode")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_SAFEMODE;
|
|
||||||
} else if (arg.equals("--enable-checkjni")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
|
|
||||||
} else if (arg.equals("--generate-debug-info")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO;
|
|
||||||
} else if (arg.equals("--always-jit")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_ALWAYS_JIT;
|
|
||||||
} else if (arg.equals("--native-debuggable")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_NATIVE_DEBUGGABLE;
|
|
||||||
} else if (arg.equals("--java-debuggable")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_JAVA_DEBUGGABLE;
|
|
||||||
} else if (arg.equals("--enable-jni-logging")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING;
|
|
||||||
} else if (arg.equals("--enable-assert")) {
|
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_ASSERT;
|
|
||||||
} else if (arg.equals("--runtime-args")) {
|
} else if (arg.equals("--runtime-args")) {
|
||||||
seenRuntimeArgs = true;
|
seenRuntimeArgs = true;
|
||||||
|
} else if (arg.startsWith("--runtime-flags=")) {
|
||||||
|
runtimeFlags = Integer.parseInt(
|
||||||
|
arg.substring(arg.indexOf('=') + 1));
|
||||||
} else if (arg.startsWith("--seinfo=")) {
|
} else if (arg.startsWith("--seinfo=")) {
|
||||||
if (seInfoSpecified) {
|
if (seInfoSpecified) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
@@ -722,7 +705,7 @@ class ZygoteConnection {
|
|||||||
*/
|
*/
|
||||||
public static void applyDebuggerSystemProperty(Arguments args) {
|
public static void applyDebuggerSystemProperty(Arguments args) {
|
||||||
if (RoSystemProperties.DEBUGGABLE) {
|
if (RoSystemProperties.DEBUGGABLE) {
|
||||||
args.debugFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
args.runtimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,7 +727,7 @@ class ZygoteConnection {
|
|||||||
int peerUid = peer.getUid();
|
int peerUid = peer.getUid();
|
||||||
|
|
||||||
if (args.invokeWith != null && peerUid != 0 &&
|
if (args.invokeWith != null && peerUid != 0 &&
|
||||||
(args.debugFlags & Zygote.DEBUG_ENABLE_JDWP) == 0) {
|
(args.runtimeFlags & Zygote.DEBUG_ENABLE_JDWP) == 0) {
|
||||||
throw new ZygoteSecurityException("Peer is permitted to specify an"
|
throw new ZygoteSecurityException("Peer is permitted to specify an"
|
||||||
+ "explicit invoke-with wrapper command only for debuggable"
|
+ "explicit invoke-with wrapper command only for debuggable"
|
||||||
+ "applications.");
|
+ "applications.");
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ public class ZygoteInit {
|
|||||||
pid = Zygote.forkSystemServer(
|
pid = Zygote.forkSystemServer(
|
||||||
parsedArgs.uid, parsedArgs.gid,
|
parsedArgs.uid, parsedArgs.gid,
|
||||||
parsedArgs.gids,
|
parsedArgs.gids,
|
||||||
parsedArgs.debugFlags,
|
parsedArgs.runtimeFlags,
|
||||||
null,
|
null,
|
||||||
parsedArgs.permittedCapabilities,
|
parsedArgs.permittedCapabilities,
|
||||||
parsedArgs.effectiveCapabilities);
|
parsedArgs.effectiveCapabilities);
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ static void FillFileDescriptorVector(JNIEnv* env,
|
|||||||
|
|
||||||
// Utility routine to fork zygote and specialize the child process.
|
// Utility routine to fork zygote and specialize the child process.
|
||||||
static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGids,
|
static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGids,
|
||||||
jint debug_flags, jobjectArray javaRlimits,
|
jint runtime_flags, jobjectArray javaRlimits,
|
||||||
jlong permittedCapabilities, jlong effectiveCapabilities,
|
jlong permittedCapabilities, jlong effectiveCapabilities,
|
||||||
jint mount_external,
|
jint mount_external,
|
||||||
jstring java_se_info, jstring java_se_name,
|
jstring java_se_info, jstring java_se_name,
|
||||||
@@ -658,7 +658,7 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra
|
|||||||
|
|
||||||
UnsetSigChldHandler();
|
UnsetSigChldHandler();
|
||||||
|
|
||||||
env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, debug_flags,
|
env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, runtime_flags,
|
||||||
is_system_server, instructionSet);
|
is_system_server, instructionSet);
|
||||||
if (env->ExceptionCheck()) {
|
if (env->ExceptionCheck()) {
|
||||||
RuntimeAbort(env, __LINE__, "Error calling post fork hooks.");
|
RuntimeAbort(env, __LINE__, "Error calling post fork hooks.");
|
||||||
@@ -700,7 +700,7 @@ static void com_android_internal_os_Zygote_nativePreApplicationInit(JNIEnv*, jcl
|
|||||||
|
|
||||||
static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
|
static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
|
||||||
JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
|
JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
|
||||||
jint debug_flags, jobjectArray rlimits,
|
jint runtime_flags, jobjectArray rlimits,
|
||||||
jint mount_external, jstring se_info, jstring se_name,
|
jint mount_external, jstring se_info, jstring se_name,
|
||||||
jintArray fdsToClose,
|
jintArray fdsToClose,
|
||||||
jintArray fdsToIgnore,
|
jintArray fdsToIgnore,
|
||||||
@@ -744,17 +744,17 @@ static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
|
|||||||
// available.
|
// available.
|
||||||
capabilities &= GetEffectiveCapabilityMask(env);
|
capabilities &= GetEffectiveCapabilityMask(env);
|
||||||
|
|
||||||
return ForkAndSpecializeCommon(env, uid, gid, gids, debug_flags,
|
return ForkAndSpecializeCommon(env, uid, gid, gids, runtime_flags,
|
||||||
rlimits, capabilities, capabilities, mount_external, se_info,
|
rlimits, capabilities, capabilities, mount_external, se_info,
|
||||||
se_name, false, fdsToClose, fdsToIgnore, instructionSet, appDataDir);
|
se_name, false, fdsToClose, fdsToIgnore, instructionSet, appDataDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint com_android_internal_os_Zygote_nativeForkSystemServer(
|
static jint com_android_internal_os_Zygote_nativeForkSystemServer(
|
||||||
JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
|
JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
|
||||||
jint debug_flags, jobjectArray rlimits, jlong permittedCapabilities,
|
jint runtime_flags, jobjectArray rlimits, jlong permittedCapabilities,
|
||||||
jlong effectiveCapabilities) {
|
jlong effectiveCapabilities) {
|
||||||
pid_t pid = ForkAndSpecializeCommon(env, uid, gid, gids,
|
pid_t pid = ForkAndSpecializeCommon(env, uid, gid, gids,
|
||||||
debug_flags, rlimits,
|
runtime_flags, rlimits,
|
||||||
permittedCapabilities, effectiveCapabilities,
|
permittedCapabilities, effectiveCapabilities,
|
||||||
MOUNT_EXTERNAL_DEFAULT, NULL, NULL, true, NULL,
|
MOUNT_EXTERNAL_DEFAULT, NULL, NULL, true, NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|||||||
@@ -3821,38 +3821,38 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
uid = 0;
|
uid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int debugFlags = 0;
|
int runtimeFlags = 0;
|
||||||
if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
||||||
debugFlags |= Zygote.DEBUG_JAVA_DEBUGGABLE;
|
runtimeFlags |= Zygote.DEBUG_JAVA_DEBUGGABLE;
|
||||||
// Also turn on CheckJNI for debuggable apps. It's quite
|
// Also turn on CheckJNI for debuggable apps. It's quite
|
||||||
// awkward to turn on otherwise.
|
// awkward to turn on otherwise.
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
|
||||||
}
|
}
|
||||||
// Run the app in safe mode if its manifest requests so or the
|
// Run the app in safe mode if its manifest requests so or the
|
||||||
// system is booted in safe mode.
|
// system is booted in safe mode.
|
||||||
if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0 ||
|
if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0 ||
|
||||||
mSafeMode == true) {
|
mSafeMode == true) {
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_SAFEMODE;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_SAFEMODE;
|
||||||
}
|
}
|
||||||
if ("1".equals(SystemProperties.get("debug.checkjni"))) {
|
if ("1".equals(SystemProperties.get("debug.checkjni"))) {
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
|
||||||
}
|
}
|
||||||
String genDebugInfoProperty = SystemProperties.get("debug.generate-debug-info");
|
String genDebugInfoProperty = SystemProperties.get("debug.generate-debug-info");
|
||||||
if ("true".equals(genDebugInfoProperty)) {
|
if ("true".equals(genDebugInfoProperty)) {
|
||||||
debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO;
|
runtimeFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO;
|
||||||
}
|
}
|
||||||
if ("1".equals(SystemProperties.get("debug.jni.logging"))) {
|
if ("1".equals(SystemProperties.get("debug.jni.logging"))) {
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING;
|
||||||
}
|
}
|
||||||
if ("1".equals(SystemProperties.get("debug.assert"))) {
|
if ("1".equals(SystemProperties.get("debug.assert"))) {
|
||||||
debugFlags |= Zygote.DEBUG_ENABLE_ASSERT;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_ASSERT;
|
||||||
}
|
}
|
||||||
if (mNativeDebuggingApp != null && mNativeDebuggingApp.equals(app.processName)) {
|
if (mNativeDebuggingApp != null && mNativeDebuggingApp.equals(app.processName)) {
|
||||||
// Enable all debug flags required by the native debugger.
|
// Enable all debug flags required by the native debugger.
|
||||||
debugFlags |= Zygote.DEBUG_ALWAYS_JIT; // Don't interpret anything
|
runtimeFlags |= Zygote.DEBUG_ALWAYS_JIT; // Don't interpret anything
|
||||||
debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO; // Generate debug info
|
runtimeFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO; // Generate debug info
|
||||||
debugFlags |= Zygote.DEBUG_NATIVE_DEBUGGABLE; // Disbale optimizations
|
runtimeFlags |= Zygote.DEBUG_NATIVE_DEBUGGABLE; // Disbale optimizations
|
||||||
mNativeDebuggingApp = null;
|
mNativeDebuggingApp = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3902,12 +3902,12 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
ProcessStartResult startResult;
|
ProcessStartResult startResult;
|
||||||
if (hostingType.equals("webview_service")) {
|
if (hostingType.equals("webview_service")) {
|
||||||
startResult = startWebView(entryPoint,
|
startResult = startWebView(entryPoint,
|
||||||
app.processName, uid, uid, gids, debugFlags, mountExternal,
|
app.processName, uid, uid, gids, runtimeFlags, mountExternal,
|
||||||
app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
|
app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
|
||||||
app.info.dataDir, null, entryPointArgs);
|
app.info.dataDir, null, entryPointArgs);
|
||||||
} else {
|
} else {
|
||||||
startResult = Process.start(entryPoint,
|
startResult = Process.start(entryPoint,
|
||||||
app.processName, uid, uid, gids, debugFlags, mountExternal,
|
app.processName, uid, uid, gids, runtimeFlags, mountExternal,
|
||||||
app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
|
app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
|
||||||
app.info.dataDir, invokeWith, entryPointArgs);
|
app.info.dataDir, invokeWith, entryPointArgs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user