Skip to content

feat(feedback): Support runtime enable/disable of shake-to-report#5827

Open
markushi wants to merge 9 commits into
mainfrom
feat/runtime-enable-disable-shake-to-report
Open

feat(feedback): Support runtime enable/disable of shake-to-report#5827
markushi wants to merge 9 commits into
mainfrom
feat/runtime-enable-disable-shake-to-report

Conversation

@markushi

@markushi markushi commented Jul 23, 2026

Copy link
Copy Markdown
Member

📜 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 to IFormHandler / ReplayController by introducing a new SentryFeedbackOptions.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

  • 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

  • Docs update for the new runtime API (docs repo)
  • Possible follow-up: route per-form shake detection through FeedbackShakeIntegration so there's a single detector/arbitration point

@markushi
markushi marked this pull request as ready for review July 23, 2026 16:14
@github-actions

github-actions Bot commented Jul 23, 2026

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 252b24c

@sentry

sentry Bot commented Jul 23, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 448.14 ms 494.02 ms 45.88 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

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

markushi added 2 commits July 23, 2026 22:03
…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
@markushi
markushi marked this pull request as draft July 24, 2026 06:09
@markushi
markushi marked this pull request as ready for review July 24, 2026 06:37
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

JAVA-539

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 252b24c. Configure here.

if (!resolvedFeedbackOptions.isUseShakeGesture() || globalFeedbackOptions.isUseShakeGesture()) {
if (!resolvedFeedbackOptions.isUseShakeGesture()
|| globalFeedbackOptions.isUseShakeGesture()
|| globalFeedbackOptions.getShakeController().isEnabled()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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

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.

would it be possible to provide different interfaces to different platforms?

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.

Support runtime enable/disable of shake-to-report

2 participants