summaryrefslogtreecommitdiff
path: root/apps/hosted/android/yesno.c
diff options
context:
space:
mode:
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 @@
28#include "settings.h" 28#include "settings.h"
29#include "lang.h" 29#include "lang.h"
30#include "kernel.h" 30#include "kernel.h"
31#include "system.h"
32 31
32extern JNIEnv *env_ptr;
33static jobject RockboxYesno_instance = NULL; 33static jobject RockboxYesno_instance = NULL;
34static jmethodID yesno_func; 34static jmethodID yesno_func;
35static struct semaphore yesno_done; 35static struct semaphore yesno_done;
@@ -44,7 +44,7 @@ Java_org_rockbox_RockboxYesno_put_1result(JNIEnv *env, jobject this, jboolean re
44 semaphore_release(&yesno_done); 44 semaphore_release(&yesno_done);
45} 45}
46 46
47static void yesno_init(JNIEnv *env_ptr) 47static void yesno_init(void)
48{ 48{
49 JNIEnv e = *env_ptr; 49 JNIEnv e = *env_ptr;
50 static jmethodID yesno_is_usable; 50 static jmethodID yesno_is_usable;
@@ -74,7 +74,7 @@ static void yesno_init(JNIEnv *env_ptr)
74 sleep(HZ/10); 74 sleep(HZ/10);
75} 75}
76 76
77static jstring build_message(JNIEnv *env_ptr, const struct text_message *message) 77jstring build_message(const struct text_message *message)
78{ 78{
79 char msg[1024] = ""; 79 char msg[1024] = "";
80 JNIEnv e = *env_ptr; 80 JNIEnv e = *env_ptr;
@@ -98,12 +98,10 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
98{ 98{
99 (void)yes_message; 99 (void)yes_message;
100 (void)no_message; 100 (void)no_message;
101 JNIEnv *env_ptr = getJavaEnvironment(); 101 yesno_init();
102 102
103 yesno_init(env_ptr);
104
105 JNIEnv e = *env_ptr; 103 JNIEnv e = *env_ptr;
106 jstring message = build_message(env_ptr, main_message); 104 jstring message = build_message(main_message);
107 jstring yes = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_YES)); 105 jstring yes = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_YES));
108 jstring no = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_NO)); 106 jstring no = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_NO));
109 107