Skip to content

RUM-16551: Fix hidden API reflection noise in Session Replay drawable mappers#3539

Merged
kikoveiga merged 2 commits into
developfrom
kikoveiga/rum-16551/fix-sr-reflection-issues
Jun 16, 2026
Merged

RUM-16551: Fix hidden API reflection noise in Session Replay drawable mappers#3539
kikoveiga merged 2 commits into
developfrom
kikoveiga/rum-16551/fix-sr-reflection-issues

Conversation

@kikoveiga

@kikoveiga kikoveiga commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Gates PorterDuffColorFilter.mColor reflection to API < 28, where the field is actually accessible. ON API 28+ the field is classified as max-target-o, meaning it's blocked and was causing some noise in the logcat.
  • Removes unused mButtonDrawableField in CheckableCompoundButtonMapper that was also causing noise.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@kikoveiga
kikoveiga requested a review from Copilot June 12, 2026 15:59
@kikoveiga kikoveiga changed the title RUM-16643: Fix hidden API reflection noise in Session Replay drawable mappers RUM-16634: Fix hidden API reflection noise in Session Replay drawable mappers Jun 12, 2026
@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16551/fix-sr-reflection-issues branch from 47cba2c to fcaadab Compare June 12, 2026 16:01
@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16551/fix-sr-reflection-issues branch from fcaadab to 2e1e50d Compare June 12, 2026 16:01

Copilot AI 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.

Pull request overview

This PR reduces hidden-API reflection warnings/noise in the Session Replay drawable-to-color mappers by avoiding reflective access to PorterDuffColorFilter.mColor on Android P (API 28) and above, where that field is blocked, and removes now-dead reflection code in the compound button mapper.

Changes:

  • Gate reflection of PorterDuffColorFilter.mColor to SDK_INT < 28 to prevent blocked hidden-API access on P+.
  • Remove an unused reflected mButtonDrawable field cache from CheckableCompoundButtonMapper.
  • Minor KDoc typo fix (“layers”).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/mapper/AndroidMDrawableToColorMapper.kt Avoids hidden-API reflection on P+ by only attempting mColor reflection on API < 28.
features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/mapper/CheckableCompoundButtonMapper.kt Removes unused reflection field initialization for CompoundButton.mButtonDrawable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kikoveiga kikoveiga changed the title RUM-16634: Fix hidden API reflection noise in Session Replay drawable mappers RUM-16551: Fix hidden API reflection noise in Session Replay drawable mappers Jun 12, 2026
@kikoveiga
kikoveiga marked this pull request as ready for review June 12, 2026 16:03
@kikoveiga
kikoveiga requested review from a team as code owners June 12, 2026 16:03

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e1e50d029

ℹ️ 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".

@codecov-commenter

codecov-commenter commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.83721% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.22%. Comparing base (453d040) to head (95305a8).
⚠️ Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
...l/recorder/mapper/AndroidMDrawableToColorMapper.kt 41.18% 17 Missing and 3 partials ⚠️
...l/recorder/mapper/AndroidQDrawableToColorMapper.kt 77.78% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3539   +/-   ##
========================================
  Coverage    72.21%   72.22%           
========================================
  Files          966      966           
  Lines        35654    35650    -4     
  Branches      5951     5956    +5     
========================================
- Hits         25747    25745    -2     
- Misses        8275     8278    +3     
+ Partials      1632     1627    -5     
Files with missing lines Coverage Δ
...l/recorder/mapper/CheckableCompoundButtonMapper.kt 52.63% <ø> (+2.63%) ⬆️
...l/recorder/mapper/AndroidQDrawableToColorMapper.kt 51.11% <77.78%> (+3.94%) ⬆️
...l/recorder/mapper/AndroidMDrawableToColorMapper.kt 47.52% <41.18%> (-1.91%) ⬇️

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-datadog-prod-us1

This comment has been minimized.

@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16551/fix-sr-reflection-issues branch 2 times, most recently from 1f7b2cf to c225fe1 Compare June 14, 2026 19:03
hamorillo
hamorillo previously approved these changes Jun 15, 2026

@hamorillo hamorillo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

jonathanmos
jonathanmos previously approved these changes Jun 15, 2026
@kikoveiga
kikoveiga dismissed stale reviews from jonathanmos and hamorillo via 8b01e5c June 15, 2026 20:09
@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16551/fix-sr-reflection-issues branch from c225fe1 to 8b01e5c Compare June 15, 2026 20:09
@kikoveiga
kikoveiga requested a review from hamorillo June 15, 2026 20:11
ambushwork
ambushwork previously approved these changes Jun 16, 2026
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16551/fix-sr-reflection-issues branch from 8b01e5c to 95305a8 Compare June 16, 2026 10:18
@kikoveiga
kikoveiga requested a review from hamorillo June 16, 2026 10:21

@hamorillo hamorillo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes. 🚀

@kikoveiga
kikoveiga merged commit 55e5280 into develop Jun 16, 2026
27 checks passed
@kikoveiga
kikoveiga deleted the kikoveiga/rum-16551/fix-sr-reflection-issues branch June 16, 2026 11:18
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.

6 participants