Skip to content

feat(replay): Add pauseTouchTracking and resumeTouchTracking - #6546

Merged
romtsn merged 1 commit into
mainfrom
feat/replay-pause-touch-tracking
Nov 13, 2026
Merged

romtsn merged 1 commit into
mainfrom
feat/replay-pause-touch-tracking

Conversation

@romtsn

@romtsn romtsn commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

Adds Sentry.replay().pauseTouchTracking() and Sentry.replay().resumeTouchTracking(). While touch tracking is paused, ReplayIntegration drops touch events, but the masked screen recording continues. This works in both session and buffer mode, so a buffered replay that is sent later also has no touches for that period.

Sentry.replay().pauseTouchTracking() // before showing the PIN pad
Sentry.replay().resumeTouchTracking() // after it is hidden

Behavior worth reviewing:

  • The flag is independent of pause()/resume(). resume() does not resume touch tracking, and resumeTouchTracking() does not record touches while the replay is paused.
  • Only resumeTouchTracking() clears the flag. start(), stop() and new app sessions keep it, so touches cannot leak by accident. This is different from pause(), which an explicit start() resets.
  • The flag is set directly (@Volatile) instead of through enqueueOnMainThread like the lifecycle commands. It does not touch ReplayState, so its order relative to lifecycle commands does not matter, and a queued set could let touch events that are already pending on the main looper through.
  • Breadcrumbs are not affected. beforeBreadcrumb already covers them.

Also marks debugMaskingEnabled as @Volatile, because it is written on the caller's thread and read on the recorder thread.

💡 Motivation and Context

Masking hides sensitive content such as a custom PIN pad or a masked WebView, but the recorded touch positions can still reveal the input. pause() already stops touches, but it also stops the screen recording, which some apps want to keep.

The same API comes to sentry-cocoa in a parallel PR. Hybrid SDKs follow later.

💚 How did you test it?

Unit tests in ReplayIntegrationTest: touches are dropped while screenshots continue, resume() does not resume touch tracking, resumeTouchTracking() waits for resume(), and the flag carries over to new replays, also when it is set before any replay starts.

📝 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

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Nov 10, 2026

Copy link
Copy Markdown

JAVA-658

@romtsn
romtsn marked this pull request as ready for review November 11, 2026 14:34
@romtsn
romtsn requested review from a team and adinauer as code owners November 11, 2026 14:34
@romtsn
romtsn requested review from 0xadam-brown and runningcode and removed request for a team November 11, 2026 14:34
@romtsn romtsn added the ship-it PR is ready to merge from a reviewer perspective label Nov 11, 2026

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

Nice!

Apps can stop recording touches on sensitive screens, such as a custom PIN pad, while
the masked screen recording continues. Masking hides the content, but recorded touch
positions could reveal the input.

The flag is independent of pause()/resume() and is cleared only by
resumeTouchTracking(), also across new replays. It is set directly instead of being queued
on the main thread, so it applies to touch events that are already pending.

Also mark debugMaskingEnabled as volatile, it is written and read on different threads.

Fixes JAVA-658

Fixes #5787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@romtsn
romtsn force-pushed the feat/replay-pause-touch-tracking branch from 8896004 to 811035c Compare November 13, 2026 08:26
@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 811035c

@sentry

sentry Bot commented Nov 13, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@romtsn
romtsn merged commit 3b6fa83 into main Nov 13, 2026
52 of 54 checks passed
@romtsn
romtsn deleted the feat/replay-pause-touch-tracking branch November 13, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ship-it PR is ready to merge from a reviewer perspective

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Session Replay] Add ability to mask or suppress touch input over sensitive views and WebViews

2 participants