Skip to content

feat(replay): Add touch tracking pause API - #4166

Merged
buenaflor merged 3 commits into
mainfrom
feat/replay-pause-touch-tracking
Nov 26, 2026
Merged

buenaflor merged 3 commits into
mainfrom
feat/replay-pause-touch-tracking

Conversation

@romtsn

@romtsn romtsn commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

Adds SentryFlutter.replay.pauseTouchTracking() and resumeTouchTracking(). While touch tracking is paused, the native SDKs record no touch positions, but the masked screen recording continues. Breadcrumbs are not affected.

await SentryFlutter.replay.pauseTouchTracking();
try {
  await showSensitiveScreen();
} finally {
  await SentryFlutter.replay.resumeTouchTracking();
}

This is a bridge only; the behavior lives in the native SDKs, which record touches on Flutter too:

  • The flag is independent of pause()/resume(). resume() does not resume touch tracking.
  • Only resumeTouchTracking() clears it, also across new replays and stop()/start(). It can be called before a replay starts.

The calls are wired exactly like pause/resume: SentryReplay → SentryNativeBinding.pauseReplayTouchTracking() / resumeReplayTouchTracking() → JNI ReplayIntegration.pauseTouchTracking() on Android and the controlReplay method channel → SentrySDK.internal.replay.pauseTouchTracking() on iOS. On Web, desktop and the C SDK they are no-ops, like pause().

The native APIs come from getsentry/sentry-java#6546 (sentry-android 8.65.0) and getsentry/sentry-cocoa#9587 (sentry-cocoa 9.36.0), both already on main. The ReplayIntegration JNI bindings were regenerated with the sentry-android bump.

SentryReplay is an abstract interface class, so code outside the SDK that implements it must add the two methods. SentryFlutter.replay can't be replaced, so this only affects hand-written test doubles or wrappers.

💡 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.

Fixes #3903
Fixes DART-444

Docs: getsentry/sentry-docs#20711

💚 How did you test it?

Unit tests in replay_api_test.dart (forwarding, and no call when the platform has no replay) and sentry_native_channel_test.dart (method channel names). The replay_test.dart integration test calls both methods on mobile.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec
  • No breaking changes

Changelog Entry

  • Add SentryFlutter.replay.pauseTouchTracking() and resumeTouchTracking() to stop recording touch positions on sensitive screens, such as a custom PIN pad, while the masked screen recording continues. Touch tracking stays paused across new replays and after resume() until resumeTouchTracking() is called. Code that implements SentryReplay must add the two methods

Bridge the native touch tracking pause to SentryFlutter.replay, so apps
can stop recording touch positions on sensitive screens, such as a
custom PIN pad, while the masked screen recording continues.

The JNI bindings for ReplayIntegration.pauseTouchTracking() and
resumeTouchTracking() are added by hand in jnigen's output shape,
because sentry-android 8.65.0 is not released yet.

Fixes DART-444

Fixes #3903

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

linear-code Bot commented Nov 13, 2026

Copy link
Copy Markdown

DART-444

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Features

  • Track slow and frozen frames and frames delay on Flutter Web, measured against a 60 Hz display by Ortes and buenaflor in #4165
  • Add SentryFlutter.replay.pauseTouchTracking() and resumeTouchTracking() to stop recording touch positions on sensitive screens, such as a custom PIN pad, while the masked screen recording continues. Touch tracking stays paused across new replays and after resume() until resumeTouchTracking() is called. Code that implements SentryReplay must add the two methods by romtsn, claude and buenaflor in #4166
  • Link errors to their own streamed span by buenaflor in #4173

Fixes

  • Spans that ended before frame tracking resumed no longer report estimated frame metrics by Ortes and buenaflor in #4200

Dependencies

Deps

  • chore(deps): update Cocoa SDK to v9.36.0 by github-actions in #4227
  • chore(deps): update JavaScript SDK to v11.17.0 by buenaflor with github-actions in #4195
  • chore(deps): update Native SDK to v0.17.7 by buenaflor with github-actions in #4206
  • chore(deps): update Android SDK to v8.65.1 by github-actions in #4204

Internal Changes

  • (flutter) Drop unneeded Material imports by buenaflor with sentry-junior in #4201
  • (ios) Build TestFlight sample with Xcode 27 by philprime with sentry-junior in #4196
  • Run JavaScript SDK updater weekly by buenaflor with sentry-junior in #4208
  • Remove Cursor Bugbot review guidelines by antonis with sentry-junior in #4205

🤖 This preview updates automatically when you update the PR.

@github-actions

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • packages/flutter/darwin/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift

@buenaflor

Copy link
Copy Markdown
Contributor

Sentry Android 8.65.0 and Sentry Cocoa 9.36.0 is now on main

@buenaflor
buenaflor marked this pull request as ready for review November 26, 2026 11:51
Copilot AI balanced review requested due to automatic review settings November 26, 2026 11:52

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@buenaflor
buenaflor merged commit c96f0ad into main Nov 26, 2026
80 checks passed
@buenaflor
buenaflor deleted the feat/replay-pause-touch-tracking branch November 26, 2026 12:55
romtsn added a commit to getsentry/sentry-docs that referenced this pull request Nov 27, 2026
## DESCRIBE YOUR PR

Documents the new `pauseTouchTracking()` and `resumeTouchTracking()`
Session Replay APIs for Android, Apple, React Native and Flutter, in a
new "Pause Touch Tracking" section under "Manual Control" on each
Session Replay page. The APIs stop recording touches on sensitive
screens, such as a custom PIN pad, while the masked screen recording
continues.

SDK PRs:
- Android: getsentry/sentry-java#6546 (merged)
- Apple: getsentry/sentry-cocoa#9587
- React Native: getsentry/sentry-react-native#7030
- Flutter: getsentry/sentry-dart#4166

The version numbers in the text are the expected next releases: Android
8.65.0, Apple 9.35.0, React Native 8.36.0, Flutter 10.5.0. The hybrid
SDKs can only ship after the native releases, so their numbers are the
least certain. Please do not merge before all SDK PRs are released, and
update the numbers if the release versions differ.

## IS YOUR CHANGE URGENT?

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
supplied a deadline.

Thanks in advance for your help!

## PRE-MERGE CHECKLIST

_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Antonis Lilis <antonis.lilis@gmail.com>
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.

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

3 participants