summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/system-target.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/android/system-target.h')
-rw-r--r--firmware/target/hosted/android/system-target.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/firmware/target/hosted/android/system-target.h b/firmware/target/hosted/android/system-target.h
index 9145ab1e84..325c1012af 100644
--- a/firmware/target/hosted/android/system-target.h
+++ b/firmware/target/hosted/android/system-target.h
@@ -21,8 +21,6 @@
21#ifndef __SYSTEM_TARGET_H__ 21#ifndef __SYSTEM_TARGET_H__
22#define __SYSTEM_TARGET_H__ 22#define __SYSTEM_TARGET_H__
23 23
24#include <jni.h>
25
26#define disable_irq() 24#define disable_irq()
27#define enable_irq() 25#define enable_irq()
28#define disable_irq_save() 0 26#define disable_irq_save() 0
@@ -32,19 +30,15 @@ void power_off(void);
32void wait_for_interrupt(void); 30void wait_for_interrupt(void);
33void interrupt(void); 31void interrupt(void);
34 32
35/* A JNI environment is specific to its thread, so use the correct way to 33 /* don't pull in jni.h for every user of this file, it should be only needed
36 * obtain it: share a pointer to the JavaVM structure and ask that the JNI 34 * within the target tree (if at all)
37 * environment attached to the current thread. */ 35 * define this before #including system.h or system-target.h */
38static inline JNIEnv* getJavaEnvironment(void) 36#ifdef _SYSTEM_WITH_JNI
39{ 37#include <jni.h>
40 extern JavaVM *vm_ptr; 38/*
41 JNIEnv *env = NULL; 39 * discover the JNIEnv for this the calling thread in case it's not known */
42 40extern JNIEnv* getJavaEnvironment(void);
43 if (vm_ptr) 41#endif /* _SYSTEM_WITH_JNI */
44 (*vm_ptr)->GetEnv(vm_ptr, (void**) &env, JNI_VERSION_1_2);
45
46 return env;
47}
48 42
49#endif /* __SYSTEM_TARGET_H__ */ 43#endif /* __SYSTEM_TARGET_H__ */
50 44