diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 11 | ||||
-rw-r--r-- | core/jni/android_util_Process.cpp | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 6afeb86..4759451 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -229,9 +229,10 @@ int register_com_android_internal_os_RuntimeInit(JNIEnv* env) /*static*/ JavaVM* AndroidRuntime::mJavaVM = NULL; - -AndroidRuntime::AndroidRuntime() : - mExitWithoutCleanup(false) +AndroidRuntime::AndroidRuntime(char* argBlockStart, const size_t argBlockLength) : + mExitWithoutCleanup(false), + mArgBlockStart(argBlockStart), + mArgBlockLength(argBlockLength) { SkGraphics::Init(); // this sets our preference for 16bit images during decode @@ -266,6 +267,10 @@ AndroidRuntime::~AndroidRuntime() return jniRegisterNativeMethods(env, className, gMethods, numMethods); } +void AndroidRuntime::setArgv0(const char* argv0) { + strlcpy(mArgBlockStart, argv0, mArgBlockLength); +} + status_t AndroidRuntime::callMain(const char* className, jclass clazz, int argc, const char* const argv[]) { diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index cbed99f..a4efed7 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -19,8 +19,8 @@ #include <utils/Log.h> #include <binder/IPCThreadState.h> -#include <binder/ProcessState.h> #include <binder/IServiceManager.h> +#include <cutils/process_name.h> #include <cutils/sched_policy.h> #include <utils/String8.h> #include <utils/Vector.h> @@ -385,7 +385,9 @@ void android_os_Process_setArgV0(JNIEnv* env, jobject clazz, jstring name) } if (name8.size() > 0) { - ProcessState::self()->setArgV0(name8.string()); + const char* procName = name8.string(); + set_process_name(procName); + AndroidRuntime::getRuntime()->setArgv0(procName); } } |