Add null check for quick share intent

Bug: 258732618
Test: manual, via forcing imageData.quickShareAction to be null
Change-Id: I37c3163073d400d0d8eca352c076415f76579fb9
This commit is contained in:
Miranda Kephart
2022-11-21 17:55:00 -05:00
parent 712b0bcd0a
commit c9bc669d43

View File

@@ -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) {