Fix layout crash & bubble anything with valid bubble metadata intent
I meant to bubble anything with valid bubble metadata intent but in
ag/6004126 however I missed a spot.
Crash was just wrong layout casting; the code is a little awkward
but I'm planning on refactoring it in future CL so it'll be better
just want to not crash sooner :)
Test: atest BubbleControllerTest
Bug: 123077807
Change-Id: I6d85d24cd7fc54db062a71404d64b719f2f35009
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 957d772..a457dee 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -267,8 +267,9 @@
BubbleView bubble = (BubbleView) mInflater.inflate(
R.layout.bubble_view, mStackView, false /* attachToRoot */);
bubble.setNotif(notif);
- if (shouldUseActivityView(mContext)) {
- bubble.setAppOverlayIntent(getAppOverlayIntent(notif));
+ PendingIntent bubbleIntent = getValidBubbleIntent(notif);
+ if (shouldUseActivityView(mContext) || bubbleIntent != null) {
+ bubble.setBubbleIntent(getValidBubbleIntent(notif));
}
mBubbles.put(bubble.getKey(), bubble);
mStackView.addBubble(bubble);
@@ -282,7 +283,7 @@
}
@Nullable
- private PendingIntent getAppOverlayIntent(NotificationEntry notif) {
+ private PendingIntent getValidBubbleIntent(NotificationEntry notif) {
Notification notification = notif.notification.getNotification();
if (canLaunchInActivityView(notification.getBubbleMetadata() != null
? notification.getBubbleMetadata().getIntent() : null)) {