Fix regression of missing tinted backgrounds#3561
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3561 +/- ##
===========================================
+ Coverage 72.38% 72.39% +0.01%
===========================================
Files 967 967
Lines 35712 35712
Branches 5972 5971 -1
===========================================
+ Hits 25847 25851 +4
- Misses 8190 8199 +9
+ Partials 1675 1662 -13
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1a1823661
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| val resolvedColor = resolveGradientFillColor(drawable) ?: return null | ||
| val resolvedColor = resolveGradientFillColor(drawable) | ||
| val colorFilter = resolveGradientColorFilter(drawable) | ||
| if (resolvedColor == null || colorFilter == null) return null |
There was a problem hiding this comment.
Don't drop default-mapped gradient backgrounds
When this mapper is used through ViewWireframeMapper (the default mapper for unmapped View/ViewGroup/decor views in TreeViewTraversal), returning null here does not take the image-wireframe fallback used by BaseAsyncBackgroundWireframeMapper; ViewWireframeMapper just returns emptyList() when shapeStyle is null. As a result, on API 29+ an ordinary solid <shape>/GradientDrawable background with no public colorFilter (and hidden tint filters as well) disappears from Session Replay instead of being captured. The N-P branch has the same unconditional no-filter check, so the fallback needs to be limited to mappers that can actually snapshot the background or keep returning resolvedColor when there is no accessible filter.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The null return when colorFilter == null is intentional: tints applied at the StateListDrawable container level don't propagate into the child GradientDrawable's own tint state, so there is no public API or reliable reflection path to distinguish "plain fill, safe to return a color" from "tinted but inaccessible."
The correct fix is probably in ViewWireframeMapper, adding the same image wireframe fallback that BaseAsyncBackgroundWireframeMapper already has. This is a significantly larger change than it appears: it touches payload size, privacy masking, and the async capture pipeline in ways that require careful design so I'm delaying it for a follow-up and won't fix it here.
What does this PR do?
RUM-16551 replaced GradientDrawable.mFillPaint reflection with the public getColor() API, which returns only the raw fill colour. AppCompat stores tints applied via DrawableCompat.setTintList() in the private Drawable.mTintFilter field, which is inaccessible on API 30+ (Android 11's catch-all hidden-API enforcement) and was also not read by the new code on API 24–28. This caused tinted button backgrounds to appear as invisible white ShapeWireframes instead of falling back to the image wireframe path.
Fix: return null from resolveGradientDrawable (Q mapper) and resolveGradientDrawableNPlus (M mapper) when drawable.colorFilter is null, restoring the image wireframe fallback which correctly renders the tinted appearance.
Expected:

Regression:

Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)