Kaydet (Commit) d975f4aa authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add a JNI_OnLoad() to store the JavaVM* also from non-NativeActivity apps

üst c4f2c60c
......@@ -71,16 +71,22 @@ struct engine {
int dummy;
};
/* These vars are valid / used only when this library is used from
* NativeActivity-based apps.
*/
static struct android_app *app;
static const char *data_dir;
static const char **library_locations;
static void *apk_file;
static int apk_file_size;
static int (*lo_main)(int, const char **);
static int lo_main_argc;
static const char **lo_main_argv;
static int sleep_time = 0;
/* These are valid / used in all apps. */
static const char *data_dir;
static const char **library_locations;
static void *apk_file;
static int apk_file_size;
static JavaVM *the_java_vm;
/* Zip data structures */
/* compression methods */
......@@ -323,6 +329,20 @@ free_ptrarray(void **pa)
free(pa);
}
/* The lo-bootstrap shared library is always loaded from Java, so
* this is always called by JNI first.
*/
__attribute__ ((visibility("default")))
jint
JNI_OnLoad(JavaVM* vm, void* reserved)
{
(void) reserved;
the_java_vm = vm;
return JNI_VERSION_1_2;
}
__attribute__ ((visibility("default")))
jobjectArray
Java_org_libreoffice_android_Bootstrap_dlneeds(JNIEnv* env,
......@@ -1602,7 +1622,7 @@ __attribute__ ((visibility("default")))
JavaVM *
lo_get_javavm(void)
{
return app->activity->vm;
return the_java_vm;
}
__attribute__ ((visibility("default")))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment