From a19c75253a3deb317c670f2737755d7e05cc635f Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Wed, 9 Mar 2016 12:09:09 -0800 Subject: [PATCH] CB-10825 android: Always request READ permission for gallery source This closes #191 --- src/android/CameraLauncher.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java index 15e908f..1bb6dac 100644 --- a/src/android/CameraLauncher.java +++ b/src/android/CameraLauncher.java @@ -168,11 +168,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect this.callTakePicture(destType, encodingType); } else if ((this.srcType == PHOTOLIBRARY) || (this.srcType == SAVEDPHOTOALBUM)) { - // Any options that edit the file require READ permissions in order to try and - // preserve the original exif data and filename in the modified file that is - // created - if(this.mediaType == PICTURE && (this.destType == FILE_URI || this.destType == NATIVE_URI) - && fileWillBeModified() && !PermissionHelper.hasPermission(this, permissions[0])) { + // FIXME: Stop always requesting the permission + if(!PermissionHelper.hasPermission(this, permissions[0])) { PermissionHelper.requestPermission(this, SAVE_TO_ALBUM_SEC, Manifest.permission.READ_EXTERNAL_STORAGE); } else { this.getImage(this.srcType, destType, encodingType); @@ -1204,11 +1201,6 @@ private String ouputModifiedBitmap(Bitmap bitmap, Uri uri) throws IOException { } } - private boolean fileWillBeModified() { - return (this.targetWidth > 0 && this.targetHeight > 0) || - this.correctOrientation || this.allowEdit; - } - /** * Taking or choosing a picture launches another Activity, so we need to implement the * save/restore APIs to handle the case where the CordovaActivity is killed by the OS