Merge "make Allocation.destroy() include setSurface(null) for USAGE_IO_OUTPUT (Native RS)" automerge: 9a55cbc
automerge: 58fd96c

* commit '58fd96c607de7f7f821a0b15fd37bc28323fcfde':
  make Allocation.destroy() include setSurface(null) for USAGE_IO_OUTPUT (Native RS)
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index 4e89566..e979a1be 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -1882,4 +1882,15 @@
         }
     }
 
+    /**
+     * For USAGE_IO_OUTPUT, destroy() implies setSurface(null).
+     *
+     */
+    @Override
+    public void destroy() {
+        if((mUsage & USAGE_IO_OUTPUT) != 0) {
+            setSurface(null);
+        }
+        super.destroy();
+    }
 }