diff options
Diffstat (limited to 'core/jni')
| -rw-r--r-- | core/jni/AndroidRuntime.cpp | 41 | ||||
| -rw-r--r-- | core/jni/android_util_EventLog.cpp | 8 | ||||
| -rw-r--r-- | core/jni/android_view_ThreadedRenderer.cpp | 15 |
3 files changed, 41 insertions, 23 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 4759451..aa635c6 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -271,13 +271,13 @@ 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[]) +status_t AndroidRuntime::callMain(const String8& className, jclass clazz, + const Vector<String8>& args) { JNIEnv* env; jmethodID methodId; - ALOGD("Calling main entry %s", className); + ALOGD("Calling main entry %s", className.string()); env = getJNIEnv(); if (clazz == NULL || env == NULL) { @@ -286,7 +286,7 @@ status_t AndroidRuntime::callMain(const char* className, methodId = env->GetStaticMethodID(clazz, "main", "([Ljava/lang/String;)V"); if (methodId == NULL) { - ALOGE("ERROR: could not find method %s.main(String[])\n", className); + ALOGE("ERROR: could not find method %s.main(String[])\n", className.string()); return UNKNOWN_ERROR; } @@ -297,11 +297,12 @@ status_t AndroidRuntime::callMain(const char* className, jclass stringClass; jobjectArray strArray; + const size_t numArgs = args.size(); stringClass = env->FindClass("java/lang/String"); - strArray = env->NewObjectArray(argc, stringClass, NULL); + strArray = env->NewObjectArray(numArgs, stringClass, NULL); - for (int i = 0; i < argc; i++) { - jstring argStr = env->NewStringUTF(argv[i]); + for (size_t i = 0; i < numArgs; i++) { + jstring argStr = env->NewStringUTF(args[i].string()); env->SetObjectArrayElement(strArray, i, argStr); } @@ -873,20 +874,23 @@ char* AndroidRuntime::toSlashClassName(const char* className) * Passes the main function two arguments, the class name and the specified * options string. */ -void AndroidRuntime::start(const char* className, const char* options) +void AndroidRuntime::start(const char* className, const Vector<String8>& options) { ALOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n", className != NULL ? className : "(unknown)"); + static const String8 startSystemServer("start-system-server"); + /* * 'startSystemServer == true' means runtime is obsolete and not run from * init.rc anymore, so we print out the boot start event here. */ - 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, - ns2ms(systemTime(SYSTEM_TIME_MONOTONIC))); + for (size_t i = 0; i < options.size(); ++i) { + if (options[i] == startSystemServer) { + /* track our progress through the boot sequence */ + const int LOG_BOOT_PROGRESS_START = 3000; + LOG_EVENT_LONG(LOG_BOOT_PROGRESS_START, ns2ms(systemTime(SYSTEM_TIME_MONOTONIC))); + } } const char* rootDir = getenv("ANDROID_ROOT"); @@ -927,17 +931,20 @@ void AndroidRuntime::start(const char* className, const char* options) jclass stringClass; jobjectArray strArray; jstring classNameStr; - jstring optionsStr; stringClass = env->FindClass("java/lang/String"); assert(stringClass != NULL); - strArray = env->NewObjectArray(2, stringClass, NULL); + strArray = env->NewObjectArray(options.size() + 1, stringClass, NULL); assert(strArray != NULL); classNameStr = env->NewStringUTF(className); assert(classNameStr != NULL); env->SetObjectArrayElement(strArray, 0, classNameStr); - optionsStr = env->NewStringUTF(options); - env->SetObjectArrayElement(strArray, 1, optionsStr); + + for (size_t i = 0; i < options.size(); ++i) { + jstring optionsStr = env->NewStringUTF(options.itemAt(i).string()); + assert(optionsStr != NULL); + env->SetObjectArrayElement(strArray, i + 1, optionsStr); + } /* * Start VM. This thread becomes the main thread of the VM, and will diff --git a/core/jni/android_util_EventLog.cpp b/core/jni/android_util_EventLog.cpp index 2593420..8a0eaa2 100644 --- a/core/jni/android_util_EventLog.cpp +++ b/core/jni/android_util_EventLog.cpp @@ -177,13 +177,13 @@ static void android_util_EventLog_readEvents(JNIEnv* env, jobject clazz UNUSED, break; } if (ret < 0) { - if (errno == EINTR) { + if (ret == -EINTR) { continue; } - if (errno == EINVAL) { + if (ret == -EINVAL) { jniThrowException(env, "java/io/IOException", "Event too short"); - } else if (errno != EAGAIN) { - jniThrowIOException(env, errno); // Will throw on return + } else if (ret != -EAGAIN) { + jniThrowIOException(env, -ret); // Will throw on return } break; } diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp index 32890cf..20a61bf 100644 --- a/core/jni/android_view_ThreadedRenderer.cpp +++ b/core/jni/android_view_ThreadedRenderer.cpp @@ -84,7 +84,7 @@ static jboolean android_view_ThreadedRenderer_initialize(JNIEnv* env, jobject cl jlong proxyPtr, jobject jsurface) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); sp<ANativeWindow> window = android_view_Surface_getNativeWindow(env, jsurface); - return proxy->initialize(window.get()); + return proxy->initialize(window); } static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject clazz, @@ -94,7 +94,17 @@ static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject cla if (jsurface) { window = android_view_Surface_getNativeWindow(env, jsurface); } - proxy->updateSurface(window.get()); + proxy->updateSurface(window); +} + +static void android_view_ThreadedRenderer_pauseSurface(JNIEnv* env, jobject clazz, + jlong proxyPtr, jobject jsurface) { + RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); + sp<ANativeWindow> window; + if (jsurface) { + window = android_view_Surface_getNativeWindow(env, jsurface); + } + proxy->pauseSurface(window); } static void android_view_ThreadedRenderer_setup(JNIEnv* env, jobject clazz, @@ -203,6 +213,7 @@ static JNINativeMethod gMethods[] = { { "nDeleteProxy", "(J)V", (void*) android_view_ThreadedRenderer_deleteProxy }, { "nInitialize", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_initialize }, { "nUpdateSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_updateSurface }, + { "nPauseSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_pauseSurface }, { "nSetup", "(JII)V", (void*) android_view_ThreadedRenderer_setup }, { "nSetDisplayListData", "(JJJ)V", (void*) android_view_ThreadedRenderer_setDisplayListData }, { "nDrawDisplayList", "(JJIIII)V", (void*) android_view_ThreadedRenderer_drawDisplayList }, |
