From daf17d415c1a99c515ffa75f3ec3bb0fb87627fe Mon Sep 17 00:00:00 2001 From: Alex Light Date: Mon, 29 Jan 2018 14:27:38 -0800 Subject: [PATCH] Make AndroidRuntime only start the debugger for zygote forked apps. This got changed unintentionally in commit fffb273. Restore the original behavior where JDWP will not be enabled for non-zygote apps. Bug: 72400560 Test: atest CtsJdwpSecurityHostTestCases Change-Id: I364a9d8b6e87efc1604741a7e5dd68221ed8e491 --- core/jni/AndroidRuntime.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index d7f725d03edfc..3784d4daa2e92 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -761,18 +761,17 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) /* * Enable debugging only for apps forked from zygote. - * Set suspend=y to pause during VM init and use android ADB transport. */ if (zygote) { + // Set the JDWP provider and required arguments. By default let the runtime choose how JDWP is + // implemented. When this is not set the runtime defaults to not allowing JDWP. addOption("-XjdwpOptions:suspend=n,server=y"); + parseRuntimeOption("dalvik.vm.jdwp-provider", + jdwpProviderBuf, + "-XjdwpProvider:", + "default"); } - // Set the JDWP provider. By default let the runtime choose. - parseRuntimeOption("dalvik.vm.jdwp-provider", - jdwpProviderBuf, - "-XjdwpProvider:", - "default"); - parseRuntimeOption("dalvik.vm.lockprof.threshold", lockProfThresholdBuf, "-Xlockprofthreshold:");