summaryrefslogtreecommitdiffstats
path: root/apps/hosted
diff options
context:
space:
mode:
Diffstat (limited to 'apps/hosted')
-rw-r--r--apps/hosted/android/keyboard.c5
-rw-r--r--apps/hosted/android/notification.c5
-rw-r--r--apps/hosted/android/yesno.c14
3 files changed, 16 insertions, 8 deletions
diff --git a/apps/hosted/android/keyboard.c b/apps/hosted/android/keyboard.c
index 7c16cff079..460011c4f7 100644
--- a/apps/hosted/android/keyboard.c
+++ b/apps/hosted/android/keyboard.c
@@ -26,8 +26,8 @@
#include "string-extra.h"
#include "kernel.h"
#include "lang.h"
+#include "system.h"
-extern JNIEnv *env_ptr;
static jclass RockboxKeyboardInput_class;
static jobject RockboxKeyboardInput_instance;
static jmethodID kbd_inputfunc;
@@ -53,7 +53,9 @@ Java_org_rockbox_RockboxKeyboardInput_put_1result(JNIEnv *env, jobject this,
static void kdb_init(void)
{
+ JNIEnv *env_ptr = getJavaEnvironment();
JNIEnv e = *env_ptr;
+
static jmethodID kbd_is_usable;
if (RockboxKeyboardInput_class == NULL)
{
@@ -87,6 +89,7 @@ static void kdb_init(void)
int kbd_input(char* text, int buflen)
{
+ JNIEnv *env_ptr = getJavaEnvironment();
JNIEnv e = *env_ptr;
jstring str = e->NewStringUTF(env_ptr, text);
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 33a7717012..1c89c51357 100644
--- a/apps/hosted/android/notification.c
+++ b/apps/hosted/android/notification.c
@@ -29,8 +29,8 @@
#include "misc.h"
#include "thread.h"
#include "debug.h"
+#include "system.h"
-extern JNIEnv *env_ptr;
extern jclass RockboxService_class;
extern jobject RockboxService_instance;
@@ -47,6 +47,7 @@ static const struct dim dim = { .width = 200, .height = 200 };
static void track_changed_callback(void *param)
{
struct mp3entry* id3 = (struct mp3entry*)param;
+ JNIEnv *env_ptr = getJavaEnvironment();
JNIEnv e = *env_ptr;
if (id3)
{
@@ -109,6 +110,7 @@ static void track_changed_callback(void *param)
static void track_finished_callback(void *param)
{
(void)param;
+ JNIEnv *env_ptr = getJavaEnvironment();
JNIEnv e = *env_ptr;
e->CallVoidMethod(env_ptr, NotificationManager_instance,
finishNotification);
@@ -122,6 +124,7 @@ static void track_finished_callback(void *param)
void notification_init(void)
{
+ JNIEnv *env_ptr = getJavaEnvironment();
JNIEnv e = *env_ptr;
jfieldID nNM = e->GetFieldID(env_ptr, RockboxService_class,
"fg_runner", "Lorg/rockbox/Helper/RunForegroundManager;");
diff --git a/apps/hosted/android/yesno.c b/apps/hosted/android/yesno.c
index 7aca3f7f79..de6ec99a3c 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(void)
+static void yesno_init(JNIEnv *env_ptr)
{
JNIEnv e = *env_ptr;
static jmethodID yesno_is_usable;
@@ -75,7 +75,7 @@ static void yesno_init(void)
sleep(HZ/10);
}
-jstring build_message(const struct text_message *message)
+static jstring build_message(JNIEnv *env_ptr, const struct text_message *message)
{
char msg[1024] = "";
JNIEnv e = *env_ptr;
@@ -99,10 +99,12 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
{
(void)yes_message;
(void)no_message;
- yesno_init();
-
+ JNIEnv *env_ptr = getJavaEnvironment();
+
+ yesno_init(env_ptr);
+
JNIEnv e = *env_ptr;
- jstring message = build_message(main_message);
+ jstring message = build_message(env_ptr, 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));