Aperture: Ensure output is truncated
To properly handle the case that a calling app's capture intent
provides an output URI that already exists, ensure that writes are
truncated so that the output file contains *only* our output data.
Change-Id: I9ea601aaabc03c845947e6b0030ccf2c5533a349
diff --git a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
index d6fca81..357a6db 100644
--- a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
@@ -1781,7 +1781,7 @@
outputUri?.let {
try {
- contentResolver.openOutputStream(it).use { outputStream ->
+ contentResolver.openOutputStream(it, "wt").use { outputStream ->
when (input) {
is InputStream -> input.use {
input.copyTo(outputStream!!)