static jboolean NVEventJNIInit(JNIEnv* env, jobject thiz) { NVEventInit(env, thiz); __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Calling NVEventAppInit"); if (NVEventAppInit(0, NULL)) { __android_log_print(ANDROID_LOG_DEBUG, MODULE, "NVEventAppInit error"); return JNI_FALSE; } jclass k = (env)->FindClass ("com/nvidia/devtech/NvEventQueueActivity"); jmethodID id = env->GetMethodID(k, "getSupportPauseResume", "()Z"); if(id) { s_supportPauseResume = env->CallBooleanMethod(s_globalThiz, id); } __android_log_print(ANDROID_LOG_DEBUG, MODULE, "spawning thread"); s_alreadyFinishing = false; /* Launch thread with main loop */ NVThreadSpawnJNIThread(&s_mainThread, NULL, NVEventMainLoopThreadFunc, NULL); __android_log_print(ANDROID_LOG_DEBUG, MODULE, "thread spawned"); return JNI_TRUE; }
static jboolean onCreateNative(JNIEnv* env, jobject thiz) { if (s_globalThiz) onDestroyNative(env, thiz); ZeroAppFlags(); if (!s_globalThiz) { s_globalThiz = env->NewGlobalRef(thiz); if (!s_globalThiz) { __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Error: Thiz NewGlobalRef failed!"); } __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Thiz NewGlobalRef: 0x%p", s_globalThiz); } __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Init KeyCode Map"); s_keyMapping.Init(env, thiz); NVEventInitInputFields(env); s_eventQueue.Init(); s_javaPostedQuit = false; __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Calling NVEventAppInit"); if (NVEventAppInit(0, NULL)) { __android_log_print(ANDROID_LOG_DEBUG, MODULE, "NVEventAppInit error"); return JNI_FALSE; } __android_log_print(ANDROID_LOG_DEBUG, MODULE, "spawning thread"); s_appThreadExited = false; SetAppFlag(NVEVENT_STATUS_RUNNING); /* Launch thread with main loop */ NVThreadSpawnJNIThread(&s_mainThread, NULL, NVEventMainLoopThreadFunc, NULL); __android_log_print(ANDROID_LOG_DEBUG, MODULE, "thread spawned"); return JNI_TRUE; }