feat(android): update session replay masking precedence rules#518
Merged
feat(android): update session replay masking precedence rules#518
Conversation
abelonogov-ld
approved these changes
May 1, 2026
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.
Summary
Changes Android semantics to match iOS when applying session replay masking precedence rules.
This changes existing masking behavior, but should be clearer than the previous behavior. Please see the README changes for details.
How did you test this change?
Unit tests added.
Are there any deployment considerations?
N/A
Note
Medium Risk
Changes core session replay privacy behavior by introducing explicit mask/unmask precedence and propagation, which could affect what gets redacted in recordings. Risk is mitigated by added unit tests but still impacts sensitive-data handling paths.
Overview
Aligns Android session replay masking with a new explicit precedence model: explicit mask (including
ldMask()andmaskXMLViewIds) propagates to descendants and overrides everything, explicit unmask (ldUnmask()) propagates but cannot override an explicit mask, and global privacy rules (e.g.maskTextInputs,maskText,maskWebViews) only apply when no explicit signal exists.Implements this by splitting
PrivacyProfilematchers intoexplicitMaskMatchersvsglobalMaskMatchers, extendingMaskTargetwithhasLDUnmask, updatingMaskCollectortraversal to carry inherited explicit state, and wiringImageCaptureServiceto pass both matcher sets. Adds focused tests for the new precedence rules and updates docs/comments to match; the React Native adapter also switches Observability logging toLDObserveLogging.adapter().Reviewed by Cursor Bugbot for commit d7e05f1. Bugbot is set up for automated code reviews on this repo. Configure here.