forked from len0rd/rockbox
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
This commit is contained in:
parent
2e5b7aebde
commit
66f2a08f8a
10 changed files with 60 additions and 16 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue