diff options
| author | 2022-11-21 17:55:00 -0500 | |
|---|---|---|
| committer | 2022-11-21 17:55:00 -0500 | |
| commit | c9bc669d43a5c7913bbdc24129e18b799cd342bd (patch) | |
| tree | 9900c2cc5178356abcbad4f354f9ff73dd6f5912 | |
| parent | 712b0bcd0a0b179b99d3de68001a1e42d2529fc1 (diff) | |
Add null check for quick share intent
Bug: 258732618
Test: manual, via forcing imageData.quickShareAction to be null
Change-Id: I37c3163073d400d0d8eca352c076415f76579fb9
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java | 23 |
1 files 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) { |