diff options
Diffstat (limited to 'apps/hosted/android')
-rw-r--r-- | apps/hosted/android/keyboard.c | 5 | ||||
-rw-r--r-- | apps/hosted/android/notification.c | 5 | ||||
-rw-r--r-- | apps/hosted/android/yesno.c | 14 |
3 files changed, 8 insertions, 16 deletions
diff --git a/apps/hosted/android/keyboard.c b/apps/hosted/android/keyboard.c index f9bbcbb261..9407d970fd 100644 --- a/apps/hosted/android/keyboard.c +++ b/apps/hosted/android/keyboard.c | |||
@@ -26,8 +26,8 @@ | |||
26 | #include "string-extra.h" | 26 | #include "string-extra.h" |
27 | #include "kernel.h" | 27 | #include "kernel.h" |
28 | #include "lang.h" | 28 | #include "lang.h" |
29 | #include "system.h" | ||
30 | 29 | ||
30 | extern JNIEnv *env_ptr; | ||
31 | static jclass RockboxKeyboardInput_class; | 31 | static jclass RockboxKeyboardInput_class; |
32 | static jobject RockboxKeyboardInput_instance; | 32 | static jobject RockboxKeyboardInput_instance; |
33 | static jmethodID kbd_inputfunc; | 33 | static jmethodID kbd_inputfunc; |
@@ -53,9 +53,7 @@ Java_org_rockbox_RockboxKeyboardInput_put_1result(JNIEnv *env, jobject this, | |||
53 | 53 | ||
54 | static void kdb_init(void) | 54 | static void kdb_init(void) |
55 | { | 55 | { |
56 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
57 | JNIEnv e = *env_ptr; | 56 | JNIEnv e = *env_ptr; |
58 | |||
59 | static jmethodID kbd_is_usable; | 57 | static jmethodID kbd_is_usable; |
60 | if (RockboxKeyboardInput_class == NULL) | 58 | if (RockboxKeyboardInput_class == NULL) |
61 | { | 59 | { |
@@ -86,7 +84,6 @@ static void kdb_init(void) | |||
86 | 84 | ||
87 | int kbd_input(char* text, int buflen) | 85 | int kbd_input(char* text, int buflen) |
88 | { | 86 | { |
89 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
90 | JNIEnv e = *env_ptr; | 87 | JNIEnv e = *env_ptr; |
91 | jstring str = e->NewStringUTF(env_ptr, text); | 88 | jstring str = e->NewStringUTF(env_ptr, text); |
92 | jstring ok_text = e->NewStringUTF(env_ptr, str(LANG_KBD_OK)); | 89 | jstring ok_text = e->NewStringUTF(env_ptr, str(LANG_KBD_OK)); |
diff --git a/apps/hosted/android/notification.c b/apps/hosted/android/notification.c index e7c425b7c1..443200698c 100644 --- a/apps/hosted/android/notification.c +++ b/apps/hosted/android/notification.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include "misc.h" | 29 | #include "misc.h" |
30 | #include "thread.h" | 30 | #include "thread.h" |
31 | #include "debug.h" | 31 | #include "debug.h" |
32 | #include "system.h" | ||
33 | 32 | ||
33 | extern JNIEnv *env_ptr; | ||
34 | extern jclass RockboxService_class; | 34 | extern jclass RockboxService_class; |
35 | extern jobject RockboxService_instance; | 35 | extern jobject RockboxService_instance; |
36 | 36 | ||
@@ -47,7 +47,6 @@ static const struct dim dim = { .width = 200, .height = 200 }; | |||
47 | static void track_changed_callback(void *param) | 47 | static void track_changed_callback(void *param) |
48 | { | 48 | { |
49 | struct mp3entry* id3 = (struct mp3entry*)param; | 49 | struct mp3entry* id3 = (struct mp3entry*)param; |
50 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
51 | JNIEnv e = *env_ptr; | 50 | JNIEnv e = *env_ptr; |
52 | if (id3) | 51 | if (id3) |
53 | { | 52 | { |
@@ -110,7 +109,6 @@ static void track_changed_callback(void *param) | |||
110 | static void track_finished_callback(void *param) | 109 | static void track_finished_callback(void *param) |
111 | { | 110 | { |
112 | (void)param; | 111 | (void)param; |
113 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
114 | JNIEnv e = *env_ptr; | 112 | JNIEnv e = *env_ptr; |
115 | e->CallVoidMethod(env_ptr, NotificationManager_instance, | 113 | e->CallVoidMethod(env_ptr, NotificationManager_instance, |
116 | finishNotification); | 114 | finishNotification); |
@@ -124,7 +122,6 @@ static void track_finished_callback(void *param) | |||
124 | 122 | ||
125 | void notification_init(void) | 123 | void notification_init(void) |
126 | { | 124 | { |
127 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
128 | JNIEnv e = *env_ptr; | 125 | JNIEnv e = *env_ptr; |
129 | jfieldID nNM = e->GetFieldID(env_ptr, RockboxService_class, | 126 | jfieldID nNM = e->GetFieldID(env_ptr, RockboxService_class, |
130 | "fg_runner", "Lorg/rockbox/Helper/RunForegroundManager;"); | 127 | "fg_runner", "Lorg/rockbox/Helper/RunForegroundManager;"); |
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 | ||
32 | extern JNIEnv *env_ptr; | ||
33 | static jobject RockboxYesno_instance = NULL; | 33 | static jobject RockboxYesno_instance = NULL; |
34 | static jmethodID yesno_func; | 34 | static jmethodID yesno_func; |
35 | static struct semaphore yesno_done; | 35 | static 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 | ||
47 | static void yesno_init(JNIEnv *env_ptr) | 47 | static 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 | ||
77 | static jstring build_message(JNIEnv *env_ptr, const struct text_message *message) | 77 | jstring 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 | ||