From 773c4f78d80dae19faf94f4455a6902e2578fcd4 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Mon, 18 Nov 2019 13:49:48 -0800 Subject: [PATCH] Port CRITICAL_JNI_PARAMS from internal master Test: other CLs compile Change-Id: Ie8d2475279877c853971a88c01e8456357eec117 --- core/jni/core_jni_helpers.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/jni/core_jni_helpers.h b/core/jni/core_jni_helpers.h index 16ef753c0cd00..f03f42737134e 100644 --- a/core/jni/core_jni_helpers.h +++ b/core/jni/core_jni_helpers.h @@ -22,6 +22,18 @@ #include #include +// 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.