WordPress-Android icon indicating copy to clipboard operation
WordPress-Android copied to clipboard

Sharing media fails due to permission denial (Android 11)

Open geriux opened this issue 1 year ago • 5 comments

Expected behavior

Sharing media files should work in different Android versions and apps.

Actual behavior

When sharing media files to the editor, a new post, or the media library, it fails when using the File Manager app.

From the logs I can see:

Unable to start activity ComponentInfo{com.jetpack.android/org.wordpress.android.ui.ShareIntentReceiverActivity}: java.lang.SecurityException: Permission Denial: opening provider com.android.fileexplorer.provider.FileExplorerFileProvider

I've also seen other cases like:

Unable to start activity ComponentInfo{com.jetpack.android/org.wordpress.android.ui.ShareIntentReceiverActivity}: java.lang.SecurityException: Permission Denial: reading com.gallery20.common.GYFileProvider ...  requires the provider be exported, or grantUriPermission()

Steps to reproduce the behavior

  • Open the File Manager app
  • Select a media file from the thumbnail (do not open it, if it's from the image preview, there's no crash)
  • Share it into the Jetpack/WordPress app

Note: From 24.0 the crash is prevented but the image is not added due to the error mentioned above.

Tested on a Redmi Note 8T, Android 11, JPAndroid / WPAndroid 23.9, 24.0

geriux avatar Feb 07 '24 14:02 geriux

Hey @thomashorta 👋 sorry for the ping but I saw you recently worked on some permission changes and I was wondering if you'd have any ideas on why this issue is happening. Any help would be appreciated, thank you!

geriux avatar Feb 07 '24 14:02 geriux

Hi, @geriux I tested here on my Samsung S24+ with Android 14 and everything seemed to work. But I also tested on an Android 11 emulator (with the default Files app) and I wasn't able to make the media sharing work at all BUT I also didn't get permission denial logs, so I don't know what could be going on, to be honest.

Debugging it, it looks like the file path is null when we try to get it from here.

Note: I didn't have the Media/File permission enabled on Jetpack both on my S24+ and the emulator. When turning the permission on in the emulator I was able to share from the thumbnail, but not from the image preview inside the file app (which is the opposite of what you reported 😅)

I am investigating other issues at the moment, but I will try to keep an eye on this and come back to it when I have more time.

thomashorta avatar Feb 08 '24 14:02 thomashorta

I am investigating other issues at the moment, but I will try to keep an eye on this and come back to it when I have more time.

Thanks for taking a look! Let me know if I can help with providing more info if needed 🙇

geriux avatar Feb 09 '24 08:02 geriux