summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Colascione <dancol@google.com> 2019-11-19 15:17:44 -0800
committer android-build-merger <android-build-merger@google.com> 2019-11-19 15:17:44 -0800
commit260710644c1663793f3682366366b8340370ea77 (patch)
tree57f46a353464a55cefcf38269bbe2252adfe5dfc
parent3e4a53735eb90dbb49926fcfec9b8fb77e7c3a6e (diff)
parentf2fe7f0b615990ffc72ddb5c6bd9e4ae41956b9a (diff)
Merge "Port CRITICAL_JNI_PARAMS from internal master"
am: f2fe7f0b61 Change-Id: Ie6cdbed1c24281b2ce12de30baf81ada44314c8f
-rw-r--r--core/jni/core_jni_helpers.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/jni/core_jni_helpers.h b/core/jni/core_jni_helpers.h
index 16ef753c0cd0..f03f42737134 100644
--- a/core/jni/core_jni_helpers.h
+++ b/core/jni/core_jni_helpers.h
@@ -22,6 +22,18 @@
#include <nativehelper/scoped_utf_chars.h>
#include <android_runtime/AndroidRuntime.h>
+// Host targets (layoutlib) do not differentiate between regular and critical native methods,
+// and they need all the JNI methods to have JNIEnv* and jclass/jobject as their first two arguments.
+// The following macro allows to have those arguments when compiling for host while omitting them when
+// compiling for Android.
+#ifdef __ANDROID__
+#define CRITICAL_JNI_PARAMS
+#define CRITICAL_JNI_PARAMS_COMMA
+#else
+#define CRITICAL_JNI_PARAMS JNIEnv*, jclass
+#define CRITICAL_JNI_PARAMS_COMMA JNIEnv*, jclass,
+#endif
+
namespace android {
// Defines some helpful functions.