You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by rk...@apache.org on 2016/03/10 02:59:06 UTC

cordova-plugin-camera git commit: CB-10825 android: Always request READ permission for gallery source

Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master c20e031d4 -> a19c75253


CB-10825 android: Always request READ permission for gallery source

This closes #191


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/a19c7525
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/a19c7525
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/a19c7525

Branch: refs/heads/master
Commit: a19c75253a3deb317c670f2737755d7e05cc635f
Parents: c20e031
Author: Richard Knoll <ri...@gmail.com>
Authored: Wed Mar 9 12:09:09 2016 -0800
Committer: Richard Knoll <ri...@gmail.com>
Committed: Wed Mar 9 17:56:20 2016 -0800

----------------------------------------------------------------------
 src/android/CameraLauncher.java | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/a19c7525/src/android/CameraLauncher.java
----------------------------------------------------------------------
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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org