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

Permission not being requested for photolibrary source

    XMLWordPrintableJSON

Details

    Description

      We get a SecurityException for certain cameraOptions in Marshmallow because we do not request the READ_EXTERNAL_STORAGE permission. Here is a repro set:

      {
          saveToPhotoAlbum: false,
          targetHeight: -1,
          targetWidth: -1,
          allowEdit: false,
          correctOrientation: false,
          destinationType: Camera.DestinationType.FILE_URI,
          mediaType: Camera.MediaType.PICTURE,
          encodingType: 1,
          sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM
      }
      

      Stack trace:

      DatabaseUtils: Writing exception to parcel
      DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      DatabaseUtils:         at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
      DatabaseUtils:         at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
      DatabaseUtils:         at android.content.ContentProvider$Transport.query(ContentProvider.java:211)
      DatabaseUtils:         at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
      DatabaseUtils:         at android.os.Binder.execTransact(Binder.java:453)
      AndroidRuntime: FATAL EXCEPTION: pool-1-thread-2
      AndroidRuntime: Process: io.cordova.hellocordova
      AndroidRuntime: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1620)
      AndroidRuntime:        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
      AndroidRuntime:        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
      AndroidRuntime:        at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
      AndroidRuntime:        at android.content.ContentResolver.query(ContentResolver.java:491)
      AndroidRuntime:        at android.content.ContentResolver.query(ContentResolver.java:434)
      AndroidRuntime:        at org.apache.cordova.camera.FileHelper.getDataColumn(FileHelper.java:292)
      AndroidRuntime:        at org.apache.cordova.camera.FileHelper.getRealPathFromURI_API19(FileHelper.java:128)
      AndroidRuntime:        at org.apache.cordova.camera.FileHelper.getRealPath(FileHelper.java:64)
      AndroidRuntime:        at org.apache.cordova.camera.CameraLauncher.processResultFromGallery(CameraLauncher.java:623)
      AndroidRuntime:        at org.apache.cordova.camera.CameraLauncher.access$000(CameraLauncher.java:66)
      AndroidRuntime:        at org.apache.cordova.camera.CameraLauncher$1.run(CameraLauncher.java:781)
      AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      AndroidRuntime:        at java.lang.Thread.run(Thread.java:818)
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: