1

I am trying to share images from chrome browser to my application using implicit intent ACTION_SEND.

While sharing searched images, app receives intent with a Content URI like this: content://com.android.chrome.FileProvider/images/screenshot/1457448067808912906311.jpg

Using ContentResolver and openInputStream() to read in bytes associated with the content Uri, it crashes app throwing Security Exception : Permission Denial

Here's the stack trace:

Caused by java.lang.SecurityException: Permission Denial: opening provider org.chromium.chrome.browser.util.CompatibilityFileProvider from ProcessRecord{e2de807 31401:com.theteamie.android.app/u0a784} (pid=31401, uid=10784) that is not exported from uid 10060
   at android.os.Parcel.readException(Parcel.java:1620)
   at android.os.Parcel.readException(Parcel.java:1573)
   at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3576)
   at android.app.ActivityThread.acquireProvider(ActivityThread.java:4799)
   at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2018)
   at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1466)
   at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1087)
   at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:942)
   at android.content.ContentResolver.openInputStream(ContentResolver.java:662)
   at com.theteamie.android.app.activity.PostShareActivity.copyToLocalFile(PostShareActivity.java:141)
   at com.theteamie.android.app.activity.PostShareActivity.processChosenFile(PostShareActivity.java:103)
   at com.theteamie.android.app.activity.PostShareActivity.onCreate(PostShareActivity.java:72)
   at android.app.Activity.performCreate(Activity.java:6259)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
   at android.app.ActivityThread.-wrap11(ActivityThread.java)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5443)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

It used to be working few days back when I coded this functionality.I got help from answers to my this SO question.Can someone please suggest what could be causing this issue now?

Community
  • 1
  • 1
Priya Mall
  • 581
  • 1
  • 10
  • 22

1 Answers1

1

Please make sure that you are trying to fetch the image from same activity for which you set ACTION_SEND in Android Manifest. Its most probable reason for above issue

Shshank Bhong
  • 257
  • 2
  • 8