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
This commit is contained in:
Miranda Kephart
2022-12-07 14:56:37 -05:00
parent 45fdabd5f9
commit e0d61a8483

View File

@@ -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(