summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2014-08-13 13:20:25 -0700
committerTim Murray <timmurray@google.com>2014-08-14 13:41:02 -0700
commitcd38b763d530d80aab1075dfe3b01be83abed362 (patch)
tree5c331b952b8fd83f71d02e514e4fa05aaf93b7b2 /rs/java/android/renderscript/Allocation.java
parenta2bbbb3bac464c3a52e33008401fed4a7542744c (diff)
Allocation.resize() should throw an exception in API 21+.
bug 16846318 Change-Id: I852331ec226e4cad8be79aa27c4b51183e97cc1d
Diffstat (limited to 'rs/java/android/renderscript/Allocation.java')
-rw-r--r--rs/java/android/renderscript/Allocation.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index ac76ddfb8bde..7db85f26bded 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -1341,9 +1341,13 @@ public class Allocation extends BaseObj {
* @param dimX The new size of the allocation.
*
* @deprecated RenderScript objects should be immutable once created. The
- * replacement is to create a new allocation and copy the contents.
+ * replacement is to create a new allocation and copy the contents. This
+ * function will throw an exception if API 21 or higher is used.
*/
public synchronized void resize(int dimX) {
+ if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 21) {
+ throw new RSRuntimeException("Resize is not allowed in API 21+.");
+ }
if ((mType.getY() > 0)|| (mType.getZ() > 0) || mType.hasFaces() || mType.hasMipmaps()) {
throw new RSInvalidStateException("Resize only support for 1D allocations at this time.");
}