Skip to content

Expose enableUserInteractionBreadcrumbs (Android) to disable the native UserInteractionIntegration #6993

Closed

Description

@GersonRocha9

Problem Statement

On Android, the native UserInteractionIntegration from sentry-java wraps every activity's Window.Callback and does gesture detection on the main thread for every touch event. In a React Native app this mostly duplicates the touch breadcrumbs the JS SDK already records.

On low-end Android devices we saw recurring ANRs where the blocked main-thread frame was inside the Sentry window callback (on touch dispatch and around onPause). The only way we found to turn the integration off from a React Native / Expo app was a config plugin that writes these manifest meta-data entries:

<meta-data android:name="io.sentry.breadcrumbs.user-interaction" android:value="false" />
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="false" />

RNSentryStart.java already forwards the other native Android breadcrumb off-switches added in #6764 and #6768 (enableActivityLifecycleBreadcrumbs, enableAppLifecycleBreadcrumbs, enableSystemEventBreadcrumbs, enableAppComponentBreadcrumbs, enableNetworkEventBreadcrumbs). setEnableUserInteractionBreadcrumbs is not forwarded, so there is no option in Sentry.init for it. #6747 did not list it.

Solution Brainstorm

Add an Android-only enableUserInteractionBreadcrumbs option and handle it the same way as the existing off-switches:

  • RNSentryStart.java: call options.setEnableUserInteractionBreadcrumbs(...) only when the key is present, so the native default (true) stays the same.
  • options.ts: add the type with JSDoc (@default true, @platform android).
  • Tests in RNSentryStartTest (true, false, and default kept when unset) and in wrapper.test.ts, plus the API report and a CHANGELOG entry.

Native user interaction tracing is already false by default in sentry-java, and the RN SDK does not turn it on. So with this option set to false, UserInteractionIntegration.register sees both flags off and does not install the window callback. I don't think a second option for native tracing is needed. I also kept this option separate from the existing JS enableUserInteractionTracing, because that one controls JS touch tracing.

I have a branch with this change and its tests: GersonRocha9/sentry-react-native@main...GersonRocha9:sentry-react-native:feat/android-user-interaction-breadcrumbs

These checks pass locally: RNSentryStartTest (Gradle testDebugUnitTest), wrapper.test.ts, yarn lint, yarn lint:android, and api-report:check.

Are you willing to submit a PR?

Yes. I'll open it once a maintainer agrees with the approach.

Activity

  1. linear-code commented on Nov 5, 2026

    @linear-code
  2. alwx commented on Nov 8, 2026

    @alwx
    Contributor

    Duplicate of #Thanks for reporting. We've seen your request and added it to our triage queue.

    We'll review it shortly and follow up if we need more information or once next steps are clearer.

  3. self-assigned this
    on Nov 8, 2026
  4. alwx commented on Nov 10, 2026

    @alwx
    Contributor

    Thank you for the detailed report. We agree with the approach. Please open the PR.

    We checked the details against the code. In sentry-java 8.63.0, UserInteractionIntegration.register installs the window callback only when user interaction breadcrumbs or user interaction tracing is on. Native tracing is false by default, and the React Native SDK does not turn it on. So one option is enough, and we do not need a second option for native tracing.

    Before you open the PR, please do these things:

    1. Rebase your branch on main.
    2. Keep the CHANGELOG entry to one line. You can remove the second line.
    3. In the JSDoc, say that the native breadcrumbs duplicate the JS touch breadcrumbs only when the app uses Sentry.wrap (which adds TouchEventBoundary).
  5. added a commit that references this issue on Nov 10, 2026
    4a40cf2
  6. GersonRocha9 commented on Nov 10, 2026

    @GersonRocha9
    ContributorAuthor

    Thank you for the review. The PR is open: #7016.

    1. The branch is rebased on main.
    2. The CHANGELOG entry is one line.
    3. The JSDoc now says that the native breadcrumbs duplicate the JS touch breadcrumbs only when the app uses Sentry.wrap, which adds TouchEventBoundary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions