Restrict some RenderScript CTS tests to only exercise on T+ vendor build.
Affected tests include
- IntrinsicResize with LaunchOptions
- IntrinsicBlend with LaunchOptions and restricted range
These tests are newly added in T, and should not be exercised with an
earlier vendor build.
Bug: 232489547
Fixes: 216826790
Test: test on mixed S vendor + T system
Change-Id: I52dd922ad9bf3eb6caa7a0df8a4ca6ac84c91bcb
(cherry picked from commit c5452afc471062d3b2823cdeeb7b0689a3ee446f)
diff --git a/tests/tests/renderscript/Android.bp b/tests/tests/renderscript/Android.bp
index 4011075..1934bb6 100644
--- a/tests/tests/renderscript/Android.bp
+++ b/tests/tests/renderscript/Android.bp
@@ -23,6 +23,7 @@
// Include both the 32 and 64 bit versions
compile_multilib: "both",
static_libs: [
+ "compatibility-device-util-axt",
"ctstestrunner-axt",
"xmp_toolkit",
],
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ImageProcessingTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ImageProcessingTest.java
index 9ee194e..5a0b38f 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/ImageProcessingTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ImageProcessingTest.java
@@ -16,6 +16,8 @@
package android.renderscript.cts;
+import android.os.Build;
+
import android.renderscript.Allocation;
import android.renderscript.Byte2;
@@ -61,6 +63,8 @@
import android.renderscript.ScriptIntrinsicLUT;
import android.util.Log;
+import com.android.compatibility.common.util.PropertyUtil;
+
public class ImageProcessingTest extends RSBaseCompute {
private Allocation a1, a2;
@@ -177,10 +181,18 @@
}
// Do the same but passing LaunchOptions
- int xStart = 10;
- int xEnd = 20;
- int yStart = 3;
- int yEnd = 6;
+ int xStart = 0;
+ int xEnd = w;
+ int yStart = 0;
+ int yEnd = h;
+ // LaunchOptions tests with restricted range are new tests added in T, so only test them
+ // when the vendor partition has version >= T.
+ if (PropertyUtil.isVendorApiLevelAtLeast(Build.VERSION_CODES.TIRAMISU)) {
+ xStart = 10;
+ xEnd = 20;
+ yStart = 3;
+ yEnd = 6;
+ }
Script.LaunchOptions opt = new Script.LaunchOptions();
opt.setX(xStart, xEnd).setY(yStart, yEnd);
for (int i = 0; i < 14; i++) {
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
index 6639757..0d56172 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
@@ -16,8 +16,10 @@
package android.renderscript.cts;
+import android.os.Build;
import android.renderscript.*;
import android.util.Log;
+import com.android.compatibility.common.util.PropertyUtil;
public class IntrinsicResize extends IntrinsicBase {
@@ -26,6 +28,12 @@
private void testResize(int w, int h, Element.DataType dt, int vecSize, float scaleX, float scaleY, boolean useOpt) {
+ // The LaunchOptions tests are new tests added in T, so skip the tests if the vendor
+ // partition has an earlier version.
+ if (useOpt && !PropertyUtil.isVendorApiLevelAtLeast(Build.VERSION_CODES.TIRAMISU)) {
+ return;
+ }
+
Element e = makeElement(dt, vecSize);
System.gc();