Skip to content

feat(android): Add masked screenshot capture for Hybrid SDKs - #6281

Merged
antonis merged 6 commits into
mainfrom
feat/hybrid-masked-screenshot
Oct 20, 2026
Merged

antonis merged 6 commits into
mainfrom
feat/hybrid-masked-screenshot

Conversation

@antonis

@antonis antonis commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

Adds ScreenshotUtils.takeMaskedScreenshot(activity, options, buildInfoProvider) for Hybrid SDKs. It takes a screenshot and masks it according to SentryAndroidOptions.getScreenshot(), the same way native error screenshots are masked. The implementation moves the existing native masking code into a shared place unchanged and adds a thin entry point for hybrid SDKs

💡 Motivation and Context

Resolves (Android side): getsentry/sentry-react-native#6900

💚 How did you test it?

CI, Manually on RN

📝 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

  • sentry-react-native: switch RNSentryModuleImpl to takeMaskedScreenshot and default screenshot masking to on, once a sentry-java release with this change is available.

Hybrid SDKs capture screenshots for their own errors through
ScreenshotUtils.takeScreenshot, which ignores the screenshot masking
options. Add ScreenshotUtils.takeMaskedScreenshot, backed by a shared
captureMaskedScreenshot that ScreenshotEventProcessor now uses as well,
so native and hybrid screenshots follow the same masking rules.

Refs getsentry/sentry-react-native#6900

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

linear-code Bot commented Oct 19, 2026

Copy link
Copy Markdown

RN-830

@github-actions

github-actions Bot commented Oct 19, 2026 •

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 dd01500

Comment thread CHANGELOG.md Outdated

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Catch only InterruptedException around the main-thread wait and
RuntimeException around bitmap masking. Keep the broad catch for view
hierarchy traversal, which runs custom View code, but let fatal errors
through with ExceptionUtils.rethrowIfFatal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e821ddc. Configure here.

@sentry

sentry Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@antonis
antonis marked this pull request as ready for review October 19, 2026 09:21
Comment thread sentry-android-core/api/sentry-android-core.api Outdated

@romtsn romtsn 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!

antonis and others added 2 commits October 20, 2026 12:33
Add ScreenshotMasking.isAvailable() so the replay integration class name
no longer needs to be public on SentryAndroid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@antonis
antonis merged commit ee24060 into main Oct 20, 2026
70 checks passed
@antonis
antonis deleted the feat/hybrid-masked-screenshot branch October 20, 2026 12:37
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.

2 participants