Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a35ddf5 authored by Miranda Kephart's avatar Miranda Kephart
Browse files

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
parent f312e919
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 {