summaryrefslogtreecommitdiffstats
path: root/apps/hosted/android/yesno.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-03-16 14:33:55 +0000
committerThomas Martitz <kugel@rockbox.org>2011-03-16 14:33:55 +0000
commit046cec3aa7fd58a9519cad8d693b47a2400e1742 (patch)
treecb0ba0773a3e8b3cef5d7690e2822f03d1425ddb /apps/hosted/android/yesno.c
parentefa9f13500d1672d0b631520e92e08f3ff61e45c (diff)
downloadrockbox-046cec3aa7fd58a9519cad8d693b47a2400e1742.tar.gz
rockbox-046cec3aa7fd58a9519cad8d693b47a2400e1742.tar.bz2
rockbox-046cec3aa7fd58a9519cad8d693b47a2400e1742.zip
Android: Partly revert r29569 and only call the new getJavaEnvironment() when needed.
The environment is fine to share in general, just not across OS threads, so it's only needed for functions which are possibly called from multiple OS threads (only 1 currently). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29601 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/hosted/android/yesno.c')
-rw-r--r--apps/hosted/android/yesno.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/apps/hosted/android/yesno.c b/apps/hosted/android/yesno.c
index 2e85ea2bc1..f08e7b2dfb 100644
--- a/apps/hosted/android/yesno.c
+++ b/apps/hosted/android/yesno.c
@@ -28,8 +28,8 @@
#include "settings.h"
#include "lang.h"
#include "kernel.h"
-#include "system.h"
+extern JNIEnv *env_ptr;
static jobject RockboxYesno_instance = NULL;
static jmethodID yesno_func;
static struct semaphore yesno_done;
@@ -44,7 +44,7 @@ Java_org_rockbox_RockboxYesno_put_1result(JNIEnv *env, jobject this, jboolean re
semaphore_release(&yesno_done);
}
-static void yesno_init(JNIEnv *env_ptr)
+static void yesno_init(void)
{
JNIEnv e = *env_ptr;
static jmethodID yesno_is_usable;
@@ -74,7 +74,7 @@ static void yesno_init(JNIEnv *env_ptr)
sleep(HZ/10);
}
-static jstring build_message(JNIEnv *env_ptr, const struct text_message *message)
+jstring build_message(const struct text_message *message)
{
char msg[1024] = "";
JNIEnv e = *env_ptr;
@@ -98,12 +98,10 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
{
(void)yes_message;
(void)no_message;
- JNIEnv *env_ptr = getJavaEnvironment();
-
- yesno_init(env_ptr);
-
+ yesno_init();
+
JNIEnv e = *env_ptr;
- jstring message = build_message(env_ptr, main_message);
+ jstring message = build_message(main_message);
jstring yes = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_YES));
jstring no = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_NO));