You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/31 15:42:35 UTC

[GitHub] Salamek opened a new issue #332: Unable to take picture: exposed beyond app through ClipData.Item.getUri()

Salamek opened a new issue #332: Unable to take picture: exposed beyond app through ClipData.Item.getUri()
URL: https://github.com/apache/cordova-plugin-camera/issues/332
 
 
   Hi, i cannot get camera working, there is some issue with premissions:
   ![screenshot_2018-08-31_17-29-14](https://user-images.githubusercontent.com/1226241/44921706-9e985e80-ad43-11e8-9b7b-1c66371f936f.png)
   
   My code is:
   
   ```javascript
   navigator.camera.getPicture(function(imageUri) {
       console.log(imageUri);
   },
   function(message) {
       alert('Unable to take picture: ' + message);
   }, {
       destinationType: navigator.camera.DestinationType.FILE_URI,
       sourceType: navigator.camera.PictureSourceType.CAMERA
   }
   ```
   
   Android 8.0/8.1, API level 26-28
   
   Funny thing is, when i first time run an app and i try to take a picture, premission popup appear and when i tap "Allow" app crashes... second run, no premission popup only error above.
   
   Crash logs:
   
   ```log
   --------- beginning of system
   --------- beginning of main
   --------- beginning of crash
   08-31 13:49:17.902  6262  6262 E AndroidRuntime: FATAL EXCEPTION: main
   08-31 13:49:17.902  6262  6262 E AndroidRuntime: Process: io.cordova.pepetevidi:remote, PID: 6262
   08-31 13:49:17.902  6262  6262 E AndroidRuntime: java.lang.RuntimeException: Unable to start service com.tenforwardconsulting.cordova.bgloc.DistanceFilterLocationService@1ce02c7 with Intent { flg=0x4 cmp=io.cordova.pepetevidi/com.tenforwardconsulting.cordova.bgloc.DistanceFilterLocationService (has extras) }: java.lang.SecurityException: "passive" location provider requires ACCESS_FINE_LOCATION permission.
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3556)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.app.ActivityThread.-wrap20(Unknown Source:0)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:105)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6541)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime: Caused by: java.lang.SecurityException: "passive" location provider requires ACCESS_FINE_LOCATION permission.
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1942)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1888)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:691)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:887)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:469)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at com.tenforwardconsulting.cordova.bgloc.DistanceFilterLocationService.setPace(DistanceFilterLocationService.java:162)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at com.tenforwardconsulting.cordova.bgloc.DistanceFilterLocationService.onStartCommand(DistanceFilterLocationService.java:113)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3539)
   08-31 13:49:17.902  6262  6262 E AndroidRuntime:        ... 8 more
   08-31 13:54:14.790  5922  5922 E AndroidRuntime: FATAL EXCEPTION: main
   08-31 13:54:14.790  5922  5922 E AndroidRuntime: Process: io.cordova.pepetevidi, PID: 5922
   08-31 13:54:14.790  5922  5922 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=2, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {io.cordova.pepetevidi/io.cordova.pepetevidi.MainActivity}: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/io.cordova.pepetevidi/cache/.Pic.jpg exposed beyond app through ClipData.Item.getUri()
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.ActivityThread.deliverResults(ActivityThread.java:4324)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4367)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.ActivityThread.-wrap19(Unknown Source:0)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:105)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6541)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime: Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/io.cordova.pepetevidi/cache/.Pic.jpg exposed beyond app through ClipData.Item.getUri()
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.net.Uri.checkFileUriExposed(Uri.java:2348)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.content.ClipData.prepareToLeaveProcess(ClipData.java:941)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.content.Intent.prepareToLeaveProcess(Intent.java:9735)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.content.Intent.prepareToLeaveProcess(Intent.java:9720)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1609)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.Activity.startActivityForResult(Activity.java:4472)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.Activity.startActivityForResult(Activity.java:4430)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:293)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at org.apache.cordova.camera.CameraLauncher.onRequestPermissionResult(CameraLauncher.java:1230)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult(CordovaInterfaceImpl.java:221)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at org.apache.cordova.CordovaActivity.onRequestPermissionsResult(CordovaActivity.java:509)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7388)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.Activity.dispatchActivityResult(Activity.java:7239)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        at android.app.ActivityThread.deliverResults(ActivityThread.java:4320)
   08-31 13:54:14.790  5922  5922 E AndroidRuntime:        ... 9 more
   ```
   
   PS: `navigator.camera.PictureSourceType.PHOTOLIBRARY` works just fine.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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