summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/android/powermgmt-android.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2011-03-11 18:34:35 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2011-03-11 18:34:35 +0000
commit66f2a08f8a37933b9eff79ceabdc2cb42706e48c (patch)
tree704cd88300e33a99335adf1d5e3e4ff6b71a2aed /firmware/target/hosted/android/powermgmt-android.c
parent2e5b7aebde6426058ea7b69424b0335a844a6a18 (diff)
downloadrockbox-66f2a08f8a37933b9eff79ceabdc2cb42706e48c.tar.gz
rockbox-66f2a08f8a37933b9eff79ceabdc2cb42706e48c.zip
Android: Don't share the JNI environment across threads, but obtain it the
correct way git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29569 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/hosted/android/powermgmt-android.c')
-rw-r--r--firmware/target/hosted/android/powermgmt-android.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/firmware/target/hosted/android/powermgmt-android.c b/firmware/target/hosted/android/powermgmt-android.c
index d23fece39a..222212f9c8 100644
--- a/firmware/target/hosted/android/powermgmt-android.c
+++ b/firmware/target/hosted/android/powermgmt-android.c
@@ -23,8 +23,8 @@
#include <jni.h>
#include <stdbool.h>
#include "config.h"
+#include "system.h"
-extern JNIEnv *env_ptr;
extern jclass RockboxService_class;
extern jobject RockboxService_instance;
@@ -32,6 +32,8 @@ static jfieldID _battery_level;
void powermgmt_init_target(void)
{
+ JNIEnv *env_ptr = getJavaEnvironment();
+
jmethodID initBatteryMonitor = (*env_ptr)->GetMethodID(env_ptr,
RockboxService_class,
"initBatteryMonitor",
@@ -50,6 +52,8 @@ void powermgmt_init_target(void)
int battery_level(void)
{
+ JNIEnv *env_ptr = getJavaEnvironment();
+
return (*env_ptr)->GetIntField(env_ptr, RockboxService_instance, _battery_level);
}