From 597e62b7a17b655db31af28d287d79f50672794d Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 22 Dec 2017 15:31:13 +0100 Subject: [PATCH] tweaking some uri permissions --- .../simplemobiletools/gallery/activities/EditActivity.kt | 7 ++++++- .../simplemobiletools/gallery/activities/MainActivity.kt | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 5b62357ab..16d60200e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.gallery.activities import android.app.Activity +import android.content.Intent import android.graphics.Bitmap import android.graphics.Bitmap.CompressFormat import android.graphics.Point @@ -143,7 +144,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener inputStream?.close() outputStream?.close() } - setResult(RESULT_OK) + + Intent().apply { + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + setResult(RESULT_OK, this) + } finish() } else if (saveUri.scheme == "file") { SaveAsDialog(this, saveUri.path, true) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 9cc39903f..29bfea737 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -486,7 +486,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { clipData.addItem(ClipData.Item(it)) } - resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION) + resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) resultIntent.clipData = clipData } @@ -495,7 +495,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { val uri = getFilePublicUri(File(path), BuildConfig.APPLICATION_ID) val type = path.getMimeTypeFromPath() resultIntent.setDataAndTypeAndNormalize(uri, type) - resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION) + resultIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) } private fun itemClicked(path: String) {