Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9910

Android permission error for gallery images with target height/width

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • None
    • cordova-plugin-camera
    • Android 6.0.0 Marshmallow on a Nexus 6, cordova-android 5.0.0 (master), cordova-plugin-camera 1.2.1 (master)

    Description

      When you request an image from the PHOTOLIBRARY source in Android, if you set targetHeight and targetWidth you get a SecurityException for not requesting READ_EXTERNAL_STORAGE. Stack trace:

       java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=5306, uid=10185 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
               at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
               at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
               at android.content.ContentProvider$Transport.query(ContentProvider.java:211)
               at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
               at android.os.Binder.execTransact(Binder.java:453)
       java.io.FileNotFoundException: /storage/emulated/0/Android/data/io.cordova.hellocordova/cache: open failed: ENOENT (No such file or directory)
          at libcore.io.IoBridge.open(IoBridge.java:452)
          at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
          at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
          at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
          at org.apache.cordova.camera.CameraLauncher.ouputModifiedBitmap(CameraLauncher.java:549)
          at org.apache.cordova.camera.CameraLauncher.processResultFromGallery(CameraLauncher.java:669)
          at org.apache.cordova.camera.CameraLauncher.access$000(CameraLauncher.java:66)
          at org.apache.cordova.camera.CameraLauncher$1.run(CameraLauncher.java:765)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
          at java.lang.Thread.run(Thread.java:818)
       Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
          at libcore.io.Posix.open(Native Method)
          at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
          at libcore.io.IoBridge.open(IoBridge.java:438)
          ... 10 more
      

      Attachments

        Activity

          People

            riknoll Richard B Knoll
            riknoll Richard B Knoll
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: