Repository navigation
fix(messaging): support AndroidX MessagingStyle avatars and prevent photo tinting (#395) - #406
Merged
Merged
Conversation
📱 Debug APK Ready for TestingThe debug APK for commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context & Problem
Fixes #395. Users reported that WhatsApp (and other chat apps) profile pictures were either missing or appearing as a blank/white circle in the Dynamic Island rather than displaying the sender's avatar.
Investigation revealed two root causes:
BaseTranslator.getNotificationBitmap, the check was strictly comparing against"android.app.Notification$MessagingStyle". WhatsApp and modern chat apps build notifications usingNotificationCompat, which populates the template with"androidx.core.app.NotificationCompat$MessagingStyle". This causedMessagingStyleavatar extraction to be completely skipped for AndroidX notifications.resolveIconcalledisBitmapDarkAndMonochrome()and tinted matches to solid white (PorterDuff.Mode.SRC_IN). When a sender had a profile photo with low saturation, dark background, night shot, or dark features, it was identified as dark & monochrome and tinted into a solid white circle.Key Changes
NotificationTemplates.isMessagingStyle(template)(and fallback checks onEXTRA_MESSAGES) to support both platform and AndroidXMessagingStyle.NotificationCompat.MessagingStyle.extractMessagingStyleFromNotification(sbn.notification)with fallback to raw bundle parcels (Personandandroidx.core.app.Person) andEXTRA_MESSAGING_PERSON.loadIconCompatBitmapto safely resolveIconCompatinstances.resolveNotificationVisual):resolveNotificationVisual(sbn: StatusBarNotification): ResolvedNotificationVisualto categorize visuals by origin (PERSON,PICTURE,LARGE_ICON,SMALL_ICON,APP_ICON,FALLBACK).resolveIconto only apply monochrome/dark tinting to system icons and app fallback icons (SMALL_ICON,APP_ICON,FALLBACK). Photographic sources (PERSON,PICTURE,LARGE_ICON) are never tinted white.BaseTranslatorVisualTestcovering template recognition, visual source badge rules, and tinting protection policies.Verification
./gradlew testDebugUnitTestexecuted and passed cleanly.getNotificationBitmap(sbn)callers (DynamicTranslator,LiveUpdateTranslator).