summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2014-05-20 18:48:35 -0700
committerJason Sams <jsams@google.com>2014-05-20 18:48:35 -0700
commitb69c791b7995afa5d74d081ef13ccc49a8a7e8da (patch)
tree0241c7ae2b2d056c7c16f81358d3da3d366ea40b /rs
parent47a7d61e70230bbed030e8795a17bf43c479616f (diff)
downloadframeworks_base-b69c791b7995afa5d74d081ef13ccc49a8a7e8da.zip
frameworks_base-b69c791b7995afa5d74d081ef13ccc49a8a7e8da.tar.gz
frameworks_base-b69c791b7995afa5d74d081ef13ccc49a8a7e8da.tar.bz2
Validate RenderScript context creation flags
Sync the IDs to that of the native interface. Change-Id: I7516c1ea4f4a93844ddb8397b2fc1e79ff8d6b68
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/RenderScript.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index a62d1fd..2222d2c 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -73,14 +73,14 @@ public class RenderScript {
* latency over peak performance. This is a hint and may have no effect
* on some implementations.
*/
- public static final long CREATE_FLAG_LOW_LATENCY = 0x0001;
+ public static final long CREATE_FLAG_LOW_LATENCY = 0x0002;
/*
* Context creation flag which specifies a context optimized for long
* battery life over peak performance. This is a hint and may have no effect
* on some implementations.
*/
- public static final long CREATE_FLAG_LOW_POWER = 0x0002;
+ public static final long CREATE_FLAG_LOW_POWER = 0x0004;
static {
sInitialized = false;
@@ -1180,10 +1180,14 @@ public class RenderScript {
return null;
}
+ if ((flags & ~(CREATE_FLAG_LOW_LATENCY | CREATE_FLAG_LOW_POWER)) != 0) {
+ throw new RSIllegalArgumentException("Invalid flags passed.");
+ }
+
RenderScript rs = new RenderScript(ctx);
rs.mDev = rs.nDeviceCreate();
- rs.mContext = rs.nContextCreate(rs.mDev, 0, sdkVersion, ct.mID);
+ rs.mContext = rs.nContextCreate(rs.mDev, (int)flags, sdkVersion, ct.mID);
rs.mContextType = ct;
if (rs.mContext == 0) {
throw new RSDriverException("Failed to create RS context.");