summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-08-03 15:18:36 -0700
committerMathias Agopian <mathias@google.com>2011-08-03 17:23:44 -0700
commitec46b4e1ca89d7c3a9ad70ded58da08b5e19f08f (patch)
treec7c9577687a4ce4ec5949f25d029df392b747c8b /graphics
parentb923066deeffbbaad14a117bd56259bd6ee20a08 (diff)
downloadframeworks_base-ec46b4e1ca89d7c3a9ad70ded58da08b5e19f08f.zip
frameworks_base-ec46b4e1ca89d7c3a9ad70ded58da08b5e19f08f.tar.gz
frameworks_base-ec46b4e1ca89d7c3a9ad70ded58da08b5e19f08f.tar.bz2
Add a 'release' method to the SurfaceTexture public Java API
Bug: 5063618 Change-Id: I689cb0c01c14e597ccfb4eb0972e64fa570bd4e8
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/SurfaceTexture.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index 1647ff34..d62fd67 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -187,6 +187,25 @@ public class SurfaceTexture {
return nativeGetTimestamp();
}
+ /**
+ * release() frees all the buffers and puts the SurfaceTexture into the
+ * 'abandoned' state. Once put in this state the SurfaceTexture can never
+ * leave it. When in the 'abandoned' state, all methods of the
+ * ISurfaceTexture interface will fail with the NO_INIT error.
+ *
+ * Note that while calling this method causes all the buffers to be freed
+ * from the perspective of the the SurfaceTexture, if there are additional
+ * references on the buffers (e.g. if a buffer is referenced by a client or
+ * by OpenGL ES as a texture) then those buffer will remain allocated.
+ *
+ * Always call this method when you are done with SurfaceTexture. Failing
+ * to do so may delay resource deallocation for a significant amount of
+ * time.
+ */
+ public void release() {
+ nativeRelease();
+ }
+
protected void finalize() throws Throwable {
try {
nativeFinalize();
@@ -232,6 +251,7 @@ public class SurfaceTexture {
private native void nativeSetDefaultBufferSize(int width, int height);
private native void nativeUpdateTexImage();
private native int nativeGetQueuedCount();
+ private native void nativeRelease();
/*
* We use a class initializer to allow the native code to cache some