summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2015-08-18 07:41:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-18 07:41:50 +0000
commit9a010d0a4157f97870bc38bd3dd0a8f4fd18a172 (patch)
tree7338357decc0b41ed6ff73f7853b700c7790c0c2 /core
parent96695d2f5961cbfac2d5c5ea6a7c03612991d5fb (diff)
parent7a09b8322cab26d6e3da1362d3c74964ae66b5d4 (diff)
downloadframeworks_base-9a010d0a4157f97870bc38bd3dd0a8f4fd18a172.zip
frameworks_base-9a010d0a4157f97870bc38bd3dd0a8f4fd18a172.tar.gz
frameworks_base-9a010d0a4157f97870bc38bd3dd0a8f4fd18a172.tar.bz2
Merge "Allow debugging only for apps forked from zygote" into mnc-dev
Diffstat (limited to 'core')
-rw-r--r--core/jni/AndroidRuntime.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index a3d5b8a..2fad2f6 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -566,7 +566,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];
@@ -702,9 +702,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,
@@ -1000,7 +1004,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());
@@ -1036,7 +1040,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);