Implement USAGE_IO_INPUT
Change-Id: Id5b9e3d0a17e4df15eec36d542fde6dc626138b2
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 1c83c51..2f3e48c 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -1246,24 +1246,6 @@
}
/**
- *
- *
- * @hide
- *
- */
- public SurfaceTexture getSurfaceTexture() {
- if ((mUsage & USAGE_IO_INPUT) == 0) {
- throw new RSInvalidStateException("Allocation is not a surface texture.");
- }
-
- int id = mRS.nAllocationGetSurfaceTextureID(getID(mRS));
- SurfaceTexture st = new SurfaceTexture(id);
- mRS.nAllocationGetSurfaceTextureID2(getID(mRS), st);
-
- return st;
- }
-
- /**
* For allocations used with io operations, returns the handle
* onto a raw buffer that is being managed by the screen
* compositor.
@@ -1272,7 +1254,10 @@
*
*/
public Surface getSurface() {
- return new Surface(getSurfaceTexture());
+ if ((mUsage & USAGE_IO_INPUT) == 0) {
+ throw new RSInvalidStateException("Allocation is not a surface texture.");
+ }
+ return mRS.nAllocationGetSurface(getID(mRS));
}
/**
@@ -1290,19 +1275,6 @@
}
/**
- * @hide
- */
- public void setSurfaceTexture(SurfaceTexture st) {
- mRS.validate();
- if ((mUsage & USAGE_IO_OUTPUT) == 0) {
- throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
- }
-
- Surface s = new Surface(st);
- mRS.nAllocationSetSurface(getID(mRS), s);
- }
-
- /**
* Creates a RenderScript allocation from a bitmap.
*
* With target API version 18 or greater, this allocation will be
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 10f4daa..c3fcbb5 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -303,15 +303,10 @@
validate();
rsnAllocationSyncAll(mContext, alloc, src);
}
- native int rsnAllocationGetSurfaceTextureID(int con, int alloc);
- synchronized int nAllocationGetSurfaceTextureID(int alloc) {
+ native Surface rsnAllocationGetSurface(int con, int alloc);
+ synchronized Surface nAllocationGetSurface(int alloc) {
validate();
- return rsnAllocationGetSurfaceTextureID(mContext, alloc);
- }
- native void rsnAllocationGetSurfaceTextureID2(int con, int alloc, SurfaceTexture st);
- synchronized void nAllocationGetSurfaceTextureID2(int alloc, SurfaceTexture st) {
- validate();
- rsnAllocationGetSurfaceTextureID2(mContext, alloc, st);
+ return rsnAllocationGetSurface(mContext, alloc);
}
native void rsnAllocationSetSurface(int con, int alloc, Surface sur);
synchronized void nAllocationSetSurface(int alloc, Surface sur) {