mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:42:52 +08:00
CB-10825 android: Always request READ permission for gallery source
This closes #191
This commit is contained in:
parent
c20e031d42
commit
a19c75253a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user