diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-01-27 14:50:21 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-01-27 14:50:21 +0000 |
commit | 51741668593d23a1b35beb6971e92ba648974f31 (patch) | |
tree | 084a5d681ac7ee22009ec478bfe6083584ed976d /sal | |
parent | 76bdcb53a57234cbd2d05acc557935e8175c7884 (diff) |
android: attach as daemon with given JNI version, and don't exit.
Diffstat (limited to 'sal')
-rw-r--r-- | sal/android/lo-bootstrap.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 9c2c3da8de15..eee5f1f07cef 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -47,7 +47,7 @@ #include <android/log.h> #include "uthash.h" - +#include <osl/thread.h> #include "osl/detail/android-bootstrap.h" #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" @@ -1482,16 +1482,25 @@ __attribute__ ((visibility("default"))) void android_main(struct android_app* state) { - JNIEnv *env; + jint nRet; + JNIEnv *pEnv = NULL; struct engine engine; Dl_info lo_main_info; + JavaVMAttachArgs aArgs = { + JNI_VERSION_1_2, + "LibreOfficeThread", + NULL + }; + + fprintf (stderr, "android_main in thread: %d\n", (int)pthread_self()); if (sleep_time != 0) { LOGI("android_main: Sleeping for %d seconds, start ndk-gdb NOW if that is your intention", sleep_time); sleep(sleep_time); } - (*(*state->activity->vm)->AttachCurrentThread)(state->activity->vm, &env, 0); + nRet = (*(*state->activity->vm)->AttachCurrentThreadAsDaemon)(state->activity->vm, &pEnv, &aArgs); + fprintf (stderr, "attach thread returned %d %p\n", nRet, pEnv); app = state; @@ -1508,8 +1517,7 @@ android_main(struct android_app* state) extract_files(UNPACK_TREE); lo_main(lo_main_argc, lo_main_argv); - - exit(0); + fprintf (stderr, "exit android_main\n"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |