Remove setData from clipboard intents
Some apps interpret the "data" field as "to". We're already putting the URI for share intents in EXTRA_STREAM, so remove it from setData. Bug: 285871401 Test: manual (share a copied image from personal profile to a work profile app) Change-Id: Ic50605799b6ce561674e79696090f0e7b8df03dc
This commit is contained in:
@@ -42,8 +42,8 @@ class IntentCreator {
|
||||
// "If using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it should be the
|
||||
// MIME type of the data in EXTRA_STREAM"
|
||||
if (clipData.getItemAt(0).getUri() != null) {
|
||||
shareIntent.setDataAndType(
|
||||
clipData.getItemAt(0).getUri(), clipData.getDescription().getMimeType(0));
|
||||
// We don't use setData here because some apps interpret this as "to:".
|
||||
shareIntent.setType(clipData.getDescription().getMimeType(0));
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, clipData.getItemAt(0).getUri());
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user