From c9bc669d43a5c7913bbdc24129e18b799cd342bd Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Mon, 21 Nov 2022 17:55:00 -0500 Subject: Add null check for quick share intent Bug: 258732618 Test: manual, via forcing imageData.quickShareAction to be null Change-Id: I37c3163073d400d0d8eca352c076415f76579fb9 --- .../systemui/screenshot/ScreenshotView.java | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java index 0a4b550882c9..29736b965800 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java @@ -825,12 +825,23 @@ public class ScreenshotView extends FrameLayout implements } }); if (mQuickShareChip != null) { - mQuickShareChip.setPendingIntent(imageData.quickShareAction.actionIntent, - () -> { - mUiEventLogger.log( - ScreenshotEvent.SCREENSHOT_SMART_ACTION_TAPPED, 0, mPackageName); - animateDismissal(); - }); + if (imageData.quickShareAction != null) { + mQuickShareChip.setPendingIntent(imageData.quickShareAction.actionIntent, + () -> { + mUiEventLogger.log( + ScreenshotEvent.SCREENSHOT_SMART_ACTION_TAPPED, 0, + mPackageName); + animateDismissal(); + }); + } else { + // hide chip and unset pending interaction if necessary, since we don't actually + // have a useable quick share intent + Log.wtf(TAG, "Showed quick share chip, but quick share intent was null"); + if (mPendingInteraction == PendingInteraction.QUICK_SHARE) { + mPendingInteraction = null; + } + mQuickShareChip.setVisibility(GONE); + } } if (mPendingInteraction != null) { -- cgit v1.2.3-59-g8ed1b