Merge "[RenderScript] Better handle DispatchTable init"
diff --git a/v8/renderscript/java/src/android/support/v8/renderscript/RenderScript.java b/v8/renderscript/java/src/android/support/v8/renderscript/RenderScript.java
index 7922b9e..4bbbdfe 100644
--- a/v8/renderscript/java/src/android/support/v8/renderscript/RenderScript.java
+++ b/v8/renderscript/java/src/android/support/v8/renderscript/RenderScript.java
@@ -698,7 +698,7 @@
Log.e(LOG_TAG, "Error loading RS Compat library for Incremental Intrinsic Support: " + e);
throw new RSRuntimeException("Error loading RS Compat library for Incremental Intrinsic Support: " + e);
}
- if (!nIncLoadSO()) {
+ if (!nIncLoadSO(sSdkVersion)) {
throw new RSRuntimeException("Error loading libRSSupport library for Incremental Intrinsic Support");
}
mIncLoaded = true;
@@ -829,7 +829,7 @@
// Additional Entry points For inc libRSSupport
- native boolean nIncLoadSO();
+ native boolean nIncLoadSO(int deviceApi);
native long nIncDeviceCreate();
native void nIncDeviceDestroy(long dev);
// Methods below are wrapped to protect the non-threadsafe
@@ -1244,7 +1244,7 @@
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
useIOlib = true;
}
- if (!rs.nLoadSO(useNative, android.os.Build.VERSION.SDK_INT)) {
+ if (!rs.nLoadSO(useNative, sdkVersion)) {
if (useNative) {
android.util.Log.v(LOG_TAG, "Unable to load libRS.so, falling back to compat mode");
useNative = false;
@@ -1255,7 +1255,7 @@
Log.e(LOG_TAG, "Error loading RS Compat library: " + e);
throw new RSRuntimeException("Error loading RS Compat library: " + e);
}
- if (!rs.nLoadSO(false, android.os.Build.VERSION.SDK_INT)) {
+ if (!rs.nLoadSO(false, sdkVersion)) {
throw new RSRuntimeException("Error loading libRSSupport library");
}
}
diff --git a/v8/renderscript/jni/android_renderscript_RenderScript.cpp b/v8/renderscript/jni/android_renderscript_RenderScript.cpp
index cddb309..d22c502 100644
--- a/v8/renderscript/jni/android_renderscript_RenderScript.cpp
+++ b/v8/renderscript/jni/android_renderscript_RenderScript.cpp
@@ -269,7 +269,7 @@
// Incremental Support lib
static dispatchTable dispatchTabInc;
-static jboolean nLoadSO(JNIEnv *_env, jobject _this, jboolean useNative, jint deviceApi) {
+static jboolean nLoadSO(JNIEnv *_env, jobject _this, jboolean useNative, jint targetApi) {
void* handle = NULL;
if (useNative) {
handle = dlopen("libRS.so", RTLD_LAZY | RTLD_LOCAL);
@@ -281,7 +281,7 @@
return false;
}
- if (loadSymbols(handle, dispatchTab, deviceApi) == false) {
+ if (loadSymbols(handle, dispatchTab, targetApi) == false) {
LOG_API("%s init failed!", filename);
return false;
}
@@ -1524,7 +1524,7 @@
// ---------------------------------------------------------------------------
// For Incremental Intrinsic Support
-static bool nIncLoadSO() {
+static bool nIncLoadSO(jint deviceApi) {
void* handle = NULL;
handle = dlopen("libRSSupport.so", RTLD_LAZY | RTLD_LOCAL);
if (handle == NULL) {
@@ -1532,7 +1532,7 @@
return false;
}
- if (loadSymbols(handle, dispatchTabInc) == false) {
+ if (loadSymbols(handle, dispatchTabInc, deviceApi) == false) {
LOG_API("%s init failed!", filename);
return false;
}
@@ -1730,7 +1730,7 @@
{"rsnSystemGetPointerSize", "()I", (void*)nSystemGetPointerSize },
// Entry points for Inc libRSSupport
-{"nIncLoadSO", "()Z", (bool*)nIncLoadSO },
+{"nIncLoadSO", "(I)Z", (bool*)nIncLoadSO },
{"nIncDeviceCreate", "()J", (void*)nIncDeviceCreate },
{"nIncDeviceDestroy", "(J)V", (void*)nIncDeviceDestroy },
{"rsnIncContextCreate", "(JIII)J", (void*)nIncContextCreate },