feat(feedback): Support runtime enable/disable of shake-to-report#5827
feat(feedback): Support runtime enable/disable of shake-to-report#5827markushi wants to merge 9 commits into
Conversation
|
📲 Install BuildsAndroid
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 22f4345 | 307.87 ms | 354.51 ms | 46.64 ms |
| 8c7718c | 307.42 ms | 374.84 ms | 67.42 ms |
| bb0ff41 | 321.00 ms | 378.28 ms | 57.28 ms |
| c8125f3 | 397.65 ms | 485.14 ms | 87.49 ms |
| eb95ded | 317.51 ms | 369.08 ms | 51.57 ms |
| f634d01 | 375.06 ms | 420.04 ms | 44.98 ms |
| 9fbb112 | 359.71 ms | 421.85 ms | 62.14 ms |
| d501a7e | 307.33 ms | 341.94 ms | 34.61 ms |
| bb0ff41 | 317.76 ms | 384.66 ms | 66.90 ms |
| 9054d65 | 330.94 ms | 403.24 ms | 72.30 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 22f4345 | 1.58 MiB | 2.29 MiB | 719.83 KiB |
| 8c7718c | 0 B | 0 B | 0 B |
| bb0ff41 | 0 B | 0 B | 0 B |
| c8125f3 | 1.58 MiB | 2.10 MiB | 532.32 KiB |
| eb95ded | 0 B | 0 B | 0 B |
| f634d01 | 1.58 MiB | 2.10 MiB | 533.40 KiB |
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| d501a7e | 0 B | 0 B | 0 B |
| bb0ff41 | 0 B | 0 B | 0 B |
| 9054d65 | 1.58 MiB | 2.29 MiB | 723.38 KiB |
Previous results on branch: feat/runtime-enable-disable-shake-to-report
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| be39d9f | 343.92 ms | 417.98 ms | 74.06 ms |
| ad80f17 | 315.06 ms | 364.31 ms | 49.24 ms |
| d65301f | 330.76 ms | 381.63 ms | 50.88 ms |
| 8594d29 | 355.30 ms | 449.74 ms | 94.44 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| be39d9f | 0 B | 0 B | 0 B |
| ad80f17 | 0 B | 0 B | 0 B |
| d65301f | 0 B | 0 B | 0 B |
| 8594d29 | 0 B | 0 B | 0 B |
…r.setDialog to prevent overlapping feedback dialogs
…e-to-report' into feat/runtime-enable-disable-shake-to-report
…strong dialog reference cannot leak its activity
…nt stacked feedback dialogs
…g callback cannot crash the app
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 252b24c. Configure here.
| public void close() throws IOException { | ||
| disable(); | ||
| } | ||
|
|
There was a problem hiding this comment.
Pause stuck across activity navigation
Medium Severity
Navigating to another activity while a feedback dialog is still open leaves paused set, because Dialog.onStop / onDetachedFromWindow do not run when the host activity is only stopped. The previous onActivityResumed cleanup for this case was removed, so shake-to-report stays inert on the new activity until the old dialog is dismissed or destroyed.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 252b24c. Configure here.
| if (!resolvedFeedbackOptions.isUseShakeGesture() || globalFeedbackOptions.isUseShakeGesture()) { | ||
| if (!resolvedFeedbackOptions.isUseShakeGesture() | ||
| || globalFeedbackOptions.isUseShakeGesture() | ||
| || globalFeedbackOptions.getShakeController().isEnabled()) { |
There was a problem hiding this comment.
Stale option blocks per-form shake
Medium Severity
maybeStartShakeDetection still treats isUseShakeGesture() as an active global configuration check. After this change that flag is only the initial state, so a runtime disableFeedbackOnShake() leaves the option true, the controller disabled, and per-form shake opted out — so neither path reacts to shakes.
Reviewed by Cursor Bugbot for commit 252b24c. Configure here.
|
|
||
| /** | ||
| * Enables showing the feedback form when a shake gesture is detected, overriding {@link | ||
| * SentryFeedbackOptions#isUseShakeGesture()}. Only supported on Android; no-op on other |
There was a problem hiding this comment.
would it be possible to provide different interfaces to different platforms?


📜 Description
Adds a runtime API to toggle shake-to-report after
Sentry.init():Sentry.feedback().enableFeedbackOnShake()Sentry.feedback().disableFeedbackOnShake()SentryFeedbackOptions.isUseShakeGesture()now only determines the initial state; the runtime API overrides it afterwards. Propagation works similar toIFormHandler/ReplayControllerby introducing a newSentryFeedbackOptions.IShakeController.This also required a bit of re-wiring on-demand Dialogs vs. the automatic ones, so no duplicate Dialogs are shown and no duplicate detectors run at the same time. The dialogs now report back to the
IShakeController, which now is the only component which takes care of starting/stopping shake detection.💡 Motivation and Context
Having a runtime option to enable / disable the feedback.
Closes #5486 (#5486)
💚 How did you test it?
Unit tests + Manual Tests.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
FeedbackShakeIntegrationso there's a single detector/arbitration point