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

Commit c312e2fb authored by Oli Lan's avatar Oli Lan
Browse files

Set source package when copying from share sheet.

This uses a new system API to attribute the source package when copying
to clipboard from the share sheet.

This is needed because in S users will see a toast message saying
"<app> pasted from <source>" when an app accesses clipboard. Without
this change, any copy originating from the share sheet results in
"<app> pasted from Android System" rather than the app that is the
actual source of the data.

Bug: 180577866
Test: Manual, share via share sheet and paste in another app;
observe "<app> pasted from <source app>"

Change-Id: Id1c0afcf6e775868febc7c8ab5b44dbacccacfa2
parent a644b688
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1119,7 +1119,7 @@ public class ChooserActivity extends ResolverActivity implements

            ClipboardManager clipboardManager = (ClipboardManager) getSystemService(
                    Context.CLIPBOARD_SERVICE);
            clipboardManager.setPrimaryClip(clipData);
            clipboardManager.setPrimaryClipAsPackage(clipData, getReferrerPackageName());
            Toast.makeText(getApplicationContext(), R.string.copied, Toast.LENGTH_SHORT).show();

            // Log share completion via copy