From e0d61a8483c7374bfdc64059cdaf0d8c1e96e648 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Wed, 7 Dec 2022 14:56:37 -0500 Subject: [PATCH] Remove old quickshare chip when adding a new one Fix to avoid showing a quickshare chip based on outdated information. Resets the pending interaction if the user tapped the old quickshare chip, since we won't get updated information for that chip. A future change in QPR3 will fix the logic around retrieving the quickshare data, so we don't hit this edge case in the first place. Test: manual; verified that taking two screenshots in quick succession that result in a quickshare chip no longer showed two chips at the same time Bug: 258732618 Change-Id: I70b4914068ee883c95345bbc8e3e04fc334394cf --- .../com/android/systemui/screenshot/ScreenshotView.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java index 0a4b550882c95..0ed9fdca5741f 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java @@ -870,6 +870,13 @@ public class ScreenshotView extends FrameLayout implements } void addQuickShareChip(Notification.Action quickShareAction) { + if (mQuickShareChip != null) { + mSmartChips.remove(mQuickShareChip); + mActionsView.removeView(mQuickShareChip); + } + if (mPendingInteraction == PendingInteraction.QUICK_SHARE) { + mPendingInteraction = null; + } if (mPendingInteraction == null) { LayoutInflater inflater = LayoutInflater.from(mContext); mQuickShareChip = (OverlayActionChip) inflater.inflate(