Skip to content

feat(android): Mask screenshots by default - #6437

Open
runningcode wants to merge 2 commits into
9.x.xfrom
no/screenshot-masking-default
Open

runningcode wants to merge 2 commits into
9.x.xfrom
no/screenshot-masking-default

Conversation

@runningcode

Copy link
Copy Markdown
Contributor

📜 Description

Error screenshots and user feedback screenshots now mask all text and images by default, matching Session Replay.

  • SentryScreenshotOptions turns on maskAllText and maskAllImages in its constructor. maskAllImages also masks WebView, VideoView and the media player views.
  • ManifestMetadataReader used to set both options to false when io.sentry.screenshot.mask-all-text and io.sentry.screenshot.mask-all-images were missing, which would have undone the new default. It now defaults them to true, like the session replay keys.

Opt out with options.screenshot.setMaskAllText(false) / setMaskAllImages(false), or the manifest keys above set to false.

Note: masking needs sentry-android-replay at runtime. If masking is configured and the replay module is missing, ScreenshotEventProcessor skips the screenshot instead of attaching an unmasked one. sentry-android includes replay, so this only affects apps that depend on sentry-android-core directly and use attachScreenshot. Those apps now get no screenshot until they add sentry-android-replay or turn masking off.

💡 Motivation and Context

Screenshots can contain PII. Masking by default makes the safe choice the default, as on iOS.

💚 How did you test it?

  • Updated unit tests for SentryScreenshotOptions and ManifestMetadataReader
  • sentry-android-core screenshot, feedback and manifest unit tests

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • Update the screenshot docs to describe masking, similar to iOS

Error and user feedback screenshots now mask all text and images by
default, matching Session Replay. The manifest reader defaulted the
screenshot masking keys to false, which would have undone the new
default, so it now defaults them to true like the replay keys.

Masking needs sentry-android-replay at runtime. Apps that depend on
sentry-android-core alone and attach screenshots now get no screenshot
until they add the replay module or turn masking off.

Refs JAVA-502
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

JAVA-502

@github-actions

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 0dadc3f

@sentry

sentry Bot commented Oct 30, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode marked this pull request as ready for review October 30, 2026 12:18
@runningcode runningcode added the next-major This should only be merged in the next major version. label Oct 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next-major This should only be merged in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant