diff options
Diffstat (limited to 'core/jni/AndroidRuntime.cpp')
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index bae2cde..bcf20c9 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -535,7 +535,7 @@ bool AndroidRuntime::parseCompilerRuntimeOption(const char* property, * * Returns 0 on success. */ -int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) +int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) { JavaVMInitArgs initArgs; char propBuf[PROPERTY_VALUE_MAX]; @@ -671,9 +671,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) parseRuntimeOption("dalvik.vm.gctype", gctypeOptsBuf, "-Xgc:"); parseRuntimeOption("dalvik.vm.backgroundgctype", backgroundgcOptsBuf, "-XX:BackgroundGC="); - /* enable debugging; set suspend=y to pause during VM init */ - /* use android ADB transport */ - addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y"); + /* + * Enable debugging only for apps forked from zygote. + * Set suspend=y to pause during VM init and use android ADB transport. + */ + if (zygote) { + addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y"); + } parseRuntimeOption("dalvik.vm.lockprof.threshold", lockProfThresholdBuf, @@ -968,7 +972,7 @@ jstring AndroidRuntime::NewStringLatin1(JNIEnv* env, const char* bytes) { * Passes the main function two arguments, the class name and the specified * options string. */ -void AndroidRuntime::start(const char* className, const Vector<String8>& options) +void AndroidRuntime::start(const char* className, const Vector<String8>& options, bool zygote) { ALOGD(">>>>>> START %s uid %d <<<<<<\n", className != NULL ? className : "(unknown)", getuid()); @@ -1004,7 +1008,7 @@ void AndroidRuntime::start(const char* className, const Vector<String8>& options JniInvocation jni_invocation; jni_invocation.Init(NULL); JNIEnv* env; - if (startVm(&mJavaVM, &env) != 0) { + if (startVm(&mJavaVM, &env, zygote) != 0) { return; } onVmCreated(env); |