From cbb0206cb478c862cb871a65e85115281ef12e02 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Tue, 24 Jan 2017 18:58:17 -0800 Subject: Update RenderScript JNI code for Treble - Include rsApiStubs.h instead of rs.h, and remove unused dependencies for rs.h in Android.mk. - Remove libRSDriver.so from LOCAL_REQUIRED_MODULE, since it is not required nor directly used by librs_jni.so. - Fix the discrepancy in ElementGetNativeData and ElementGetSubElements, respective to NDK APIs exposed in libRS.so. rsApiStubs.h contains all public RenderScript APIs exposed in libRS.so. It fixes the mismatch of the declarations and definitions of the two functions mentioned above. And it does not rely on the auto generated header (rsgApiFuncDecl.h) anymore. Bug: 34396220 Test: mm Merged-In: Iedb1b976cfa9033dccefe78cbe80c8022f990e53 Change-Id: Iedb1b976cfa9033dccefe78cbe80c8022f990e53 --- rs/jni/android_renderscript_RenderScript.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rs/jni/android_renderscript_RenderScript.cpp') diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index af370ff2f630..2300da32d355 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -35,8 +35,8 @@ #include "android_runtime/android_util_AssetManager.h" #include "android/graphics/GraphicsJNI.h" -#include #include +#include #include #include #include @@ -1134,7 +1134,7 @@ nElementGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jintArra // we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements assert(dataSize == 5); - uintptr_t elementData[5]; + uint32_t elementData[5]; rsaElementGetNativeData((RsContext)con, (RsElement)id, elementData, dataSize); for(jint i = 0; i < dataSize; i ++) { @@ -1157,7 +1157,7 @@ nElementGetSubElements(JNIEnv *_env, jobject _this, jlong con, jlong id, uintptr_t *ids = (uintptr_t*)malloc(dataSize * sizeof(uintptr_t)); const char **names = (const char **)malloc(dataSize * sizeof(const char *)); - uint32_t *arraySizes = (uint32_t *)malloc(dataSize * sizeof(uint32_t)); + size_t *arraySizes = (size_t *)malloc(dataSize * sizeof(size_t)); rsaElementGetSubElements((RsContext)con, (RsElement)id, ids, names, arraySizes, (uint32_t)dataSize); -- cgit v1.2.3