Repository navigation
fix(notification): use content uri for bubble icon - #6896
SeniorZhai wants to merge 2 commits into
Conversation
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.
|
AI review done for 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.
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
No description provided.