diff --git a/api/current.xml b/api/current.xml index c91c2b5e469b8..d3d3e3d696d0d 100644 --- a/api/current.xml +++ b/api/current.xml @@ -23853,11 +23853,11 @@ -ReleaseStringUTFChars(path, pathStr); if (handle != NULL) { + const char* funcStr = env->GetStringUTFChars(funcName, NULL); code = new NativeCode(handle, (ANativeActivity_createFunc*) - dlsym(handle, "ANativeActivity_onCreate")); + dlsym(handle, funcStr)); + env->ReleaseStringUTFChars(funcName, funcStr); + if (code->createActivityFunc == NULL) { LOGW("ANativeActivity_onCreate not found"); delete code; @@ -999,7 +1003,7 @@ finishPreDispatchKeyEvent_native(JNIEnv* env, jobject clazz, jint handle, } static const JNINativeMethod g_methods[] = { - { "loadNativeCode", "(Ljava/lang/String;Landroid/os/MessageQueue;Ljava/lang/String;Ljava/lang/String;ILandroid/content/res/AssetManager;[B)I", + { "loadNativeCode", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/MessageQueue;Ljava/lang/String;Ljava/lang/String;ILandroid/content/res/AssetManager;[B)I", (void*)loadNativeCode_native }, { "unloadNativeCode", "(I)V", (void*)unloadNativeCode_native }, { "onStartNative", "(I)V", (void*)onStart_native }, diff --git a/native/include/android/native_activity.h b/native/include/android/native_activity.h index a8f11c97ec824..d89bc8b9b6d3a 100644 --- a/native/include/android/native_activity.h +++ b/native/include/android/native_activity.h @@ -223,18 +223,34 @@ typedef void ANativeActivity_createFunc(ANativeActivity* activity, /** * The name of the function that NativeInstance looks for when launching its - * native code. + * native code. This is the default function that is used, you can specify + * "android.app.func_name" string meta-data in your manifest to use a different + * function. */ extern ANativeActivity_createFunc ANativeActivity_onCreate; /** * Finish the given activity. Its finish() method will be called, causing it - * to be stopped and destroyed. + * to be stopped and destroyed. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. */ void ANativeActivity_finish(ANativeActivity* activity); +/** + * Change the window format of the given activity. Calls getWindow().setFormat() + * of the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ void ANativeActivity_setWindowFormat(ANativeActivity* activity, int32_t format); +/** + * Change the window flags of the given activity. Calls getWindow().setFlags() + * of the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. See window.h for flag constants. + */ void ANativeActivity_setWindowFlags(ANativeActivity* activity, uint32_t addFlags, uint32_t removeFlags); @@ -247,6 +263,12 @@ enum { ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002, }; +/** + * Show the IME while in the given activity. Calls InputMethodManager.showSoftInput() + * for the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ void ANativeActivity_showSoftInput(ANativeActivity* activity, uint32_t flags); /** @@ -258,6 +280,12 @@ enum { ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002, }; +/** + * Hide the IME while in the given activity. Calls InputMethodManager.hideSoftInput() + * for the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ void ANativeActivity_hideSoftInput(ANativeActivity* activity, uint32_t flags); #ifdef __cplusplus