Vendor lib can use rsDispatch.h

In order to allow vendor libs to use rsDispatch.h, jni releated part of
the header is guarded with RS_COMPATIBILITY_LIB since jni.h is not
available to vendors.

Exempt-From-Owner-Approval: Only current owner is this a mailing list
[email protected]
And mailing lists aren't currently supported.

Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j
[email protected]
Test: m -j librsjni

Merged-In: I980593db946207a97a69abc8397beb18105e6ed2
Change-Id: I980593db946207a97a69abc8397beb18105e6ed2
(cherry picked from commit bac72f8b9d90ea0c5bdc0b05e02d418ebc83db25)
diff --git a/cpp/Android.bp b/cpp/Android.bp
index 710c690..c3b44ed 100644
--- a/cpp/Android.bp
+++ b/cpp/Android.bp
@@ -10,6 +10,7 @@
         "-Werror",
         "-Wno-unused-parameter",
         "-std=c++11",
+        "-DRS_COMPATIBILITY_LIB",
     ],
 
     sdk_version: "9",
diff --git a/cpp/rsDispatch.h b/cpp/rsDispatch.h
index 1bcd954..953ba6b 100644
--- a/cpp/rsDispatch.h
+++ b/cpp/rsDispatch.h
@@ -18,7 +18,6 @@
 #define ANDROID_RSDISPATCH_H
 
 #include "rsInternalDefines.h"
-#include "jni.h"
 
 typedef void (*SetNativeLibDirFnPtr)(RsContext con, const char *nativeLibDir, size_t length);
 typedef const void* (*AllocationGetTypeFnPtr)(RsContext con, RsAllocation va);
@@ -263,6 +262,9 @@
 
 bool loadSymbols(void* handle, dispatchTable& dispatchTab, int device_api = 0);
 
+#ifdef RS_COMPATIBILITY_LIB
+#include "jni.h"
+
 // USAGE_IO for RS Support lib
 typedef void (*sAllocationSetSurfaceFnPtr) (JNIEnv *, jobject, RsContext, RsAllocation, RsNativeWindow, dispatchTable);
 struct ioSuppDT {
@@ -271,4 +273,6 @@
 };
 
 bool loadIOSuppSyms(void* handleIO, ioSuppDT& ioDispatch);
-#endif
\ No newline at end of file
+#endif // RS_COMPATIBILITY_LIB
+
+#endif
diff --git a/support/jni/Android.bp b/support/jni/Android.bp
index 3c01fd0..e576fce 100644
--- a/support/jni/Android.bp
+++ b/support/jni/Android.bp
@@ -63,6 +63,7 @@
         "-Wextra",
         "-Wno-unused-parameter",
         "-std=c++11",
+        "-DRS_COMPATIBILITY_LIB",
     ],
 
     required: ["libRSSupport"],