diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-05-16 17:08:42 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-05-24 12:01:25 -0700 |
commit | ebed7d6e35f7f960e6e6add2b8ab7c7a31a511c3 (patch) | |
tree | ae346479a6c069a3a57acecb18a0b0a563325e3f /core/jni/AndroidRuntime.cpp | |
parent | cbc38e74f028d9e337eba0f3ed7c435310cc10c2 (diff) | |
download | frameworks_base-ebed7d6e35f7f960e6e6add2b8ab7c7a31a511c3.zip frameworks_base-ebed7d6e35f7f960e6e6add2b8ab7c7a31a511c3.tar.gz frameworks_base-ebed7d6e35f7f960e6e6add2b8ab7c7a31a511c3.tar.bz2 |
Support wrapping app processes to inject debug instrumentation.
Bug: 4437846
Change-Id: I4552501c693716b14714afb5c5248edaca9547ab
Diffstat (limited to 'core/jni/AndroidRuntime.cpp')
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index b787e9f..e610640 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -808,8 +808,11 @@ char* AndroidRuntime::toSlashClassName(const char* className) * Start the Android runtime. This involves starting the virtual machine * and calling the "static void main(String[] args)" method in the class * named by "className". + * + * Passes the main function two arguments, the class name and the specified + * options string. */ -void AndroidRuntime::start(const char* className, const bool startSystemServer) +void AndroidRuntime::start(const char* className, const char* options) { LOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n", className != NULL ? className : "(unknown)"); @@ -820,7 +823,7 @@ void AndroidRuntime::start(const char* className, const bool startSystemServer) * 'startSystemServer == true' means runtime is obsolete and not run from * init.rc anymore, so we print out the boot start event here. */ - if (startSystemServer) { + if (strcmp(options, "start-system-server") == 0) { /* track our progress through the boot sequence */ const int LOG_BOOT_PROGRESS_START = 3000; LOG_EVENT_LONG(LOG_BOOT_PROGRESS_START, @@ -857,13 +860,13 @@ void AndroidRuntime::start(const char* className, const bool startSystemServer) /* * We want to call main() with a String array with arguments in it. - * At present we only have one argument, the class name. Create an - * array to hold it. + * At present we have two arguments, the class name and an option string. + * Create an array to hold them. */ jclass stringClass; jobjectArray strArray; jstring classNameStr; - jstring startSystemServerStr; + jstring optionsStr; stringClass = env->FindClass("java/lang/String"); assert(stringClass != NULL); @@ -872,9 +875,8 @@ void AndroidRuntime::start(const char* className, const bool startSystemServer) classNameStr = env->NewStringUTF(className); assert(classNameStr != NULL); env->SetObjectArrayElement(strArray, 0, classNameStr); - startSystemServerStr = env->NewStringUTF(startSystemServer ? - "true" : "false"); - env->SetObjectArrayElement(strArray, 1, startSystemServerStr); + optionsStr = env->NewStringUTF(options); + env->SetObjectArrayElement(strArray, 1, optionsStr); /* * Start VM. This thread becomes the main thread of the VM, and will @@ -909,12 +911,6 @@ void AndroidRuntime::start(const char* className, const bool startSystemServer) LOGW("Warning: VM did not shut down cleanly\n"); } -void AndroidRuntime::start() -{ - start("com.android.internal.os.RuntimeInit", - false /* Don't start the system server */); -} - void AndroidRuntime::onExit(int code) { LOGV("AndroidRuntime onExit calling exit(%d)", code); |