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

Commit d3d0aeeb authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Add FLAG_CANCEL_CURRENT to screenshot share intent

The share intent uses clipData, which isn't used to match intents.
Thus, subsequent screenshots didn't update the share intent, so
trying to share a second screenshot would end up sharing the first
one. Adding FLAG_CANCEL_CURRENT fixes this problem.

Bug: 159751741
Fix: 159751741
Test: manual
Change-Id: I5eb63f075c3156e5061ee9f63ba17afa6b7abbbd
parent f9836b01
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -281,8 +281,10 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
                Intent.createChooser(sharingIntent, null, chooserAction.getIntentSender())
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)
                        .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        PendingIntent pendingIntent = PendingIntent.getActivityAsUser(context, requestCode,
                sharingChooserIntent, 0, null, UserHandle.CURRENT);

        // cancel current pending intent (if any) since clipData isn't used for matching
        PendingIntent pendingIntent = PendingIntent.getActivityAsUser(context, 0,
                sharingChooserIntent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);

        // Create a share action for the notification
        PendingIntent shareAction = PendingIntent.getBroadcastAsUser(context, requestCode,