diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-03-16 14:33:55 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-03-16 14:33:55 +0000 |
commit | 046cec3aa7fd58a9519cad8d693b47a2400e1742 (patch) | |
tree | cb0ba0773a3e8b3cef5d7690e2822f03d1425ddb /firmware/target/hosted/android/powermgmt-android.c | |
parent | efa9f13500d1672d0b631520e92e08f3ff61e45c (diff) | |
download | rockbox-046cec3aa7fd58a9519cad8d693b47a2400e1742.tar.gz 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 'firmware/target/hosted/android/powermgmt-android.c')
-rw-r--r-- | firmware/target/hosted/android/powermgmt-android.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/firmware/target/hosted/android/powermgmt-android.c b/firmware/target/hosted/android/powermgmt-android.c index 222212f9c8..d23fece39a 100644 --- a/firmware/target/hosted/android/powermgmt-android.c +++ b/firmware/target/hosted/android/powermgmt-android.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <jni.h> | 23 | #include <jni.h> |
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | #include "config.h" | 25 | #include "config.h" |
26 | #include "system.h" | ||
27 | 26 | ||
27 | extern JNIEnv *env_ptr; | ||
28 | extern jclass RockboxService_class; | 28 | extern jclass RockboxService_class; |
29 | extern jobject RockboxService_instance; | 29 | extern jobject RockboxService_instance; |
30 | 30 | ||
@@ -32,8 +32,6 @@ static jfieldID _battery_level; | |||
32 | 32 | ||
33 | void powermgmt_init_target(void) | 33 | void powermgmt_init_target(void) |
34 | { | 34 | { |
35 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
36 | |||
37 | jmethodID initBatteryMonitor = (*env_ptr)->GetMethodID(env_ptr, | 35 | jmethodID initBatteryMonitor = (*env_ptr)->GetMethodID(env_ptr, |
38 | RockboxService_class, | 36 | RockboxService_class, |
39 | "initBatteryMonitor", | 37 | "initBatteryMonitor", |
@@ -52,8 +50,6 @@ void powermgmt_init_target(void) | |||
52 | 50 | ||
53 | int battery_level(void) | 51 | int battery_level(void) |
54 | { | 52 | { |
55 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
56 | |||
57 | return (*env_ptr)->GetIntField(env_ptr, RockboxService_instance, _battery_level); | 53 | return (*env_ptr)->GetIntField(env_ptr, RockboxService_instance, _battery_level); |
58 | } | 54 | } |
59 | 55 | ||