Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c20453d937dd1af6b681aa42404205c3976adad1
Author: cketti <cketti@gmail.com>
Date: Thu Nov 12 21:30:05 2020
Set clip data when sharing streams using ShareCompat
The mechanism in Intent.createChooser() to migrate clip data and flags
from the target intent only works if the target intent actually contains
the necessary flags and clip data. If that's not the case the content
preview in the share sheet won't work because it won't be able to access
the content.
With this change the share intent contains the necessary clip data items
and flags by the time Intent.createChooser() is called.
Relnote: "Set clip data and grant uri read permission when sharing streams using ShareCompat"
Bug: 173137936
Test: ShareCompatTest
Change-Id: I4aa318b146206e4e5cd028b7e3798c9d895d8324
M core/core/src/androidTest/java/androidx/core/app/ShareCompatTest.java
M core/core/src/main/java/androidx/core/app/ShareCompat.java
https://android-review.googlesource.com/1497445
Branch: androidx-master-dev
commit c20453d937dd1af6b681aa42404205c3976adad1
Author: cketti <cketti@gmail.com>
Date: Thu Nov 12 21:30:05 2020
Set clip data when sharing streams using ShareCompat
The mechanism in Intent.createChooser() to migrate clip data and flags
from the target intent only works if the target intent actually contains
the necessary flags and clip data. If that's not the case the content
preview in the share sheet won't work because it won't be able to access
the content.
With this change the share intent contains the necessary clip data items
and flags by the time Intent.createChooser() is called.
Relnote: "Set clip data and grant uri read permission when sharing streams using ShareCompat"
Bug: 173137936
Test: ShareCompatTest
Change-Id: I4aa318b146206e4e5cd028b7e3798c9d895d8324
M core/core/src/androidTest/java/androidx/core/app/ShareCompatTest.java
M core/core/src/main/java/androidx/core/app/ShareCompat.java
il...@google.com <il...@google.com> #4
Thanks for the pull request! This will be in the next Core release.
Description
ShareCompat.IntentBuilder
doesn't create share intents that have theFLAG_GRANT_READ_URI_PERMISSION
flag set andEXTRA_STREAM
values added to the intent's clip data.Often that's not a problem because
Intent.migrateExtraStreamToClipData()
makes the appropriate modifications before the intent leaves the process.Intent.migrateExtraStreamToClipData()
has support for modifying the target intent of a chooser intent. However, the chooser intent itself isn't modified. This leads to the share sheet in Android 10+ not being able to access the content to show the display name or a preview image.Reproduce with:
You'll notice that the share sheet doesn't show a preview image. logcat will contain a message similar to this one:
Note that the final share target will have access to the content. I don't know why this actually works if the URI permission hasn't been granted to the system process showing the share sheet 🤷