Skip to content

feat(feedback): Add runtime toggle for shake-to-report#5232

Draft
antonis wants to merge 1 commit intomainfrom
antonis/feedback-shake-runtime
Draft

feat(feedback): Add runtime toggle for shake-to-report#5232
antonis wants to merge 1 commit intomainfrom
antonis/feedback-shake-runtime

Conversation

@antonis
Copy link
Contributor

@antonis antonis commented Mar 25, 2026

📜 Description

Add Sentry.enableFeedbackOnShake() and Sentry.disableFeedbackOnShake() static methods for runtime control of shake gesture detection, matching the React Native API.

The integration now always registers lifecycle callbacks and checks the useShakeGesture flag dynamically on each activity transition. When disabled, there is zero overhead — no sensor registration, no thread allocation.

Changes:

  • FeedbackShakeIntegration: always registers lifecycle callbacks, checks isUseShakeGesture() dynamically in onActivityResumed and in the shake callback
  • SentryShakeDetector.init(): deferred to first startShakeDetection() call (lazy initialization)
  • Sentry.java: added enableFeedbackOnShake() / disableFeedbackOnShake() convenience methods
  • Updated test to reflect always-register behavior

💡 Motivation and Context

Users want to enable/disable shake-to-report at runtime (e.g., only in certain screens or for specific user roles) without restarting the app. This mirrors the existing React Native API.

Stacked on #5150.

💚 How did you test it?

  • All unit tests pass (FeedbackShakeIntegrationTest, SentryShakeDetectorTest, SentryAndroidTest, ManifestMetadataReaderTest)
  • Lint and API checks pass
  • Tested on physical device (Pixel 8 Pro) via sample app with shake gesture enabled via manifest

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

🔮 Next steps

  • Update docs to document the new enableFeedbackOnShake() / disableFeedbackOnShake() API
  • Add changelog entry once approved

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

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


New Features ✨

  • (core) Add configurable IScopesStorageFactory to SentryOptions by adinauer in #5199
  • (feedback) Add runtime toggle for shake-to-report by antonis in #5232
  • (replay) Add beforeErrorSampling callback to Session Replay by romtsn in #5214

Bug Fixes 🐛

  • (replay) Text layouts with center/end alignment return incorrect masking bounding box by markushi in #5218

Internal Changes 🔧

  • (deps) Update Native SDK to v0.13.3 by github-actions in #5215
  • (opentelemetry) Bump OpenTelemetry dependencies by adinauer in #5225

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

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

Generated by 🚫 dangerJS against 1e00dfe

@sentry
Copy link

sentry bot commented Mar 25, 2026

Sentry Build Distribution

App Name App ID Version Configuration Install Page
SDK Size io.sentry.tests.size 8.36.0 (1) release Install Build

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 310.51 ms 354.12 ms 43.61 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
abfcc92 304.04 ms 370.33 ms 66.29 ms
3699cd5 423.60 ms 495.52 ms 71.92 ms
b3d8889 371.33 ms 426.24 ms 54.92 ms
55aaf9b 336.43 ms 364.14 ms 27.71 ms
6727e14 337.22 ms 373.94 ms 36.71 ms
f634d01 359.58 ms 433.88 ms 74.30 ms
ee747ae 374.71 ms 455.18 ms 80.47 ms
bbc35bb 324.88 ms 425.73 ms 100.85 ms
f064536 327.04 ms 405.35 ms 78.31 ms
ee747ae 400.46 ms 423.61 ms 23.15 ms

App size

Revision Plain With Sentry Diff
abfcc92 1.58 MiB 2.13 MiB 557.31 KiB
3699cd5 1.58 MiB 2.10 MiB 533.45 KiB
b3d8889 1.58 MiB 2.10 MiB 535.07 KiB
55aaf9b 0 B 0 B 0 B
6727e14 1.58 MiB 2.28 MiB 718.64 KiB
f634d01 1.58 MiB 2.10 MiB 533.40 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
bbc35bb 1.58 MiB 2.12 MiB 553.01 KiB
f064536 1.58 MiB 2.20 MiB 633.90 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB

Previous results on branch: antonis/feedback-shake-runtime

Startup times

Revision Plain With Sentry Diff
24c63af 309.02 ms 351.47 ms 42.45 ms
3bf4cb2 302.96 ms 358.10 ms 55.15 ms

App size

Revision Plain With Sentry Diff
24c63af 0 B 0 B 0 B
3bf4cb2 0 B 0 B 0 B

Add Sentry.enableFeedbackOnShake() and Sentry.disableFeedbackOnShake()
for runtime control of shake gesture detection, matching the React
Native API.

The integration now always registers lifecycle callbacks and checks
the useShakeGesture flag dynamically on each activity transition.
When disabled, there is zero overhead — no sensor or thread allocation.
Sensor/thread initialization is deferred to first use.

The shake callback also checks the flag before showing the dialog,
so disabling takes effect immediately for new shakes even before the
next activity transition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antonis antonis force-pushed the antonis/feedback-shake-runtime branch from a34dd38 to 1e00dfe Compare March 25, 2026 08:31
@antonis
Copy link
Contributor Author

antonis commented Mar 25, 2026

@sentry review

@antonis
Copy link
Contributor Author

antonis commented Mar 25, 2026

@cursor review

Copy link

@cursor cursor bot left a comment

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

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.

1 participant