Skip to content

fix(messaging): support AndroidX MessagingStyle avatars and prevent photo tinting (#395) - #406

Merged
D4vidDf merged 1 commit into
dev/0_6_0from
fix/messaging-avatar-extraction-395
Oct 1, 2026
Merged

D4vidDf merged 1 commit into
dev/0_6_0from
fix/messaging-avatar-extraction-395

Conversation

@D4vidDf

@D4vidDf D4vidDf commented Oct 1, 2026

Copy link
Copy Markdown
Owner

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:

  1. Strict template matching: In BaseTranslator.getNotificationBitmap, the check was strictly comparing against "android.app.Notification$MessagingStyle". WhatsApp and modern chat apps build notifications using NotificationCompat, which populates the template with "androidx.core.app.NotificationCompat$MessagingStyle". This caused MessagingStyle avatar extraction to be completely skipped for AndroidX notifications.
  2. Aggressive monochrome white tinting: resolveIcon called isBitmapDarkAndMonochrome() 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

  • AndroidX & Compat MessagingStyle extraction:
    • Leveraged NotificationTemplates.isMessagingStyle(template) (and fallback checks on EXTRA_MESSAGES) to support both platform and AndroidX MessagingStyle.
    • Added extraction via NotificationCompat.MessagingStyle.extractMessagingStyleFromNotification(sbn.notification) with fallback to raw bundle parcels (Person and androidx.core.app.Person) and EXTRA_MESSAGING_PERSON.
    • Added loadIconCompatBitmap to safely resolve IconCompat instances.
  • Visual Source Classification (resolveNotificationVisual):
    • Implemented resolveNotificationVisual(sbn: StatusBarNotification): ResolvedNotificationVisual to categorize visuals by origin (PERSON, PICTURE, LARGE_ICON, SMALL_ICON, APP_ICON, FALLBACK).
  • Selective Tinting Policy:
    • Updated resolveIcon to 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.
  • Unit Tests:
    • Added BaseTranslatorVisualTest covering template recognition, visual source badge rules, and tinting protection policies.

Verification

  • ./gradlew testDebugUnitTest executed and passed cleanly.
  • Verified backwards compatibility with legacy getNotificationBitmap(sbn) callers (DynamicTranslator, LiveUpdateTranslator).

@D4vidDf D4vidDf added enhancement New feature or request prio/low labels Oct 1, 2026
@D4vidDf
D4vidDf changed the base branch from master to dev/0_6_0 October 1, 2026 18:12
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

📱 Debug APK Ready for Testing

The debug APK for commit 1be51dd has been built and is ready:

📦 Android Installation Note: GitHub Actions artifacts are downloaded as a .zip archive. Extract the zip to access and install app-debug.apk.

@D4vidDf
D4vidDf merged commit 65e3562 into dev/0_6_0 Oct 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request prio/low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] WhatsApp profile photos not showing in the island

1 participant