Skip to content

fix(notification): use content uri for bubble icon - #6896

Open
SeniorZhai wants to merge 2 commits into
masterfrom
fix/notification-bubble-icon
Open

SeniorZhai wants to merge 2 commits into
masterfrom
fix/notification-bubble-icon

Conversation

@SeniorZhai

Copy link
Copy Markdown
Member

No description provided.

Cache circular notification avatar bitmaps in app cache and pass a FileProvider content URI to BubbleMetadata with bitmap fallback, while loading the avatar via Coil off the main thread with hardware bitmaps disabled.
@gaotic

gaotic Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

AI review done for 7dddddb in 28m 05s · 2 comments

Quality: The follow-up serializes shortcut publication with child notification posting, but the change still needs fixes before merge. Verification covered the posting order and Android’s icon selection in source, with no device run.

Role Model Status
Reviewer GPT codex/gpt-6.2-sol · effort high ok
Reviewer Grok grok/grok-4.7@500k · effort medium ok
Summary codex/gpt-6.2-sol · effort medium ok

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review · GPT (Grok failed) · 7530d5d

Request changes. git diff --check passed, and the focused Kotlin check reproduced the shortcut eviction. Offline Gradle configuration could not resolve the Foojay plugin, so compilation, lint, and unit tests did not run.


buildBubble(context, conversation, notificationBuilder, message, resource, person)
notificationManager.notify(conversationNotificationId(message.conversationId), notificationBuilder.build())
buildBubble(context, conversation, notificationBuilder, message, resource, person)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concurrent notification jobs can evict a newly published bubble shortcut before its notify() call. With two dynamic slots, posting B and C while A is between updateShortcuts() and notify() can remove A before Android 11 resolves it, so A cannot bubble. Prepare the icon off-thread, then serialize shortcut publication and notification posting together.

val bubbleIcon = createBubbleIcon(context, conversation.conversationId, bitmap)
val bubbleMetadata =
NotificationCompat.BubbleMetadata.Builder(bubbleIntent, icon)
NotificationCompat.BubbleMetadata.Builder(bubbleIntent, bubbleIcon)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content URI is attached to bubble metadata, but AOSP SystemUI uses the conversation shortcut’s icon whenever it resolves the shortcut. This notification publishes that shortcut with a bitmap, so the PNG write leaves the displayed bubble icon bitmap-backed. Put the URI on the shortcut icon that SystemUI loads. AOSP icon selection

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review · GPT + Grok · 7dddddb

Request changes. Both diff whitespace checks passed, the focused coroutine check reproduced the notification ordering regression, and AOSP source confirmed the icon selection behavior. Compilation, lint, and unit tests were blocked because the Foojay plugin was unavailable offline.

.setGroup(conversation.conversationId)
.setGroupSummary(true)
.build()
notificationManager.notify(conversationSummaryNotificationId(conversation.conversationId), summaryNotification)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post the child and group summary in the same Dispatchers.Main block. If the user opens the chat after the child posts and before the IO continuation runs, onResume() cancels both IDs, then the continuation posts the summary by itself. The focused coroutine check reproduced the surviving summary.

.setIntent(shortcutIntent)
.setLongLived(true)
.setIcon(icon)
.setIcon(shortcutIcon)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous icon issue is still present. SystemUI loads the conversation shortcut’s drawable when the shortcut resolves, and this shortcut still publishes a bitmap. Use the prepared content URI icon for .setIcon() so the displayed bubble uses it. AOSP icon selection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant