From 9a35ddf5f83d16b53b08fd6293bd94ef2ab013ba Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Tue, 20 Jun 2023 13:17:15 -0400 Subject: [PATCH] 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 --- .../com/android/systemui/clipboardoverlay/IntentCreator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/IntentCreator.java b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/IntentCreator.java index e342ac2f320dc..fc928a65848ec 100644 --- a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/IntentCreator.java +++ b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/IntentCreator.java @@ -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 {