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

@markushimarkushi 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-actionsBot 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

sentryBot commented Jul 23, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App NameApp IDVersionConfiguration
SDK Sizeio.sentry.tests.size8.50.0 (1)release

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actionsBot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

PlainWith SentryDiff
Startup time448.14 ms494.02 ms45.88 ms
Size0 B0 B0 B

Baseline results on branch: main

Startup times

RevisionPlainWith SentryDiff
22f4345307.87 ms354.51 ms46.64 ms
8c7718c307.42 ms374.84 ms67.42 ms
bb0ff41321.00 ms378.28 ms57.28 ms
c8125f3397.65 ms485.14 ms87.49 ms
eb95ded317.51 ms369.08 ms51.57 ms
f634d01375.06 ms420.04 ms44.98 ms
9fbb112359.71 ms421.85 ms62.14 ms
d501a7e307.33 ms341.94 ms34.61 ms
bb0ff41317.76 ms384.66 ms66.90 ms
9054d65330.94 ms403.24 ms72.30 ms

App size

RevisionPlainWith SentryDiff
22f43451.58 MiB2.29 MiB719.83 KiB
8c7718c0 B0 B0 B
bb0ff410 B0 B0 B
c8125f31.58 MiB2.10 MiB532.32 KiB
eb95ded0 B0 B0 B
f634d011.58 MiB2.10 MiB533.40 KiB
9fbb1121.58 MiB2.11 MiB539.18 KiB
d501a7e0 B0 B0 B
bb0ff410 B0 B0 B
9054d651.58 MiB2.29 MiB723.38 KiB

Previous results on branch: feat/runtime-enable-disable-shake-to-report

Startup times

RevisionPlainWith SentryDiff
be39d9f343.92 ms417.98 ms74.06 ms
ad80f17315.06 ms364.31 ms49.24 ms
d65301f330.76 ms381.63 ms50.88 ms
8594d29355.30 ms449.74 ms94.44 ms

App size

RevisionPlainWith SentryDiff
be39d9f0 B0 B0 B
ad80f170 B0 B0 B
d65301f0 B0 B0 B
8594d290 B0 B0 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
@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

Copy link
Copy Markdown

JAVA-539

@cursorcursorBot 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 CursorFix in Web

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

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.

This seems legit, why did we remove that from the onActivityResumed ?

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 CursorFix 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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we usually keep a single interface and reserve a right to implement it for JVM in the future (e.g. for compose desktop) :)

@runningcoderunningcode 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.

Looks good, just some small things!

onFormOpen.run();
try {
onFormOpen.run();
} catch (Throwable e) {

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.

nit: same question as above

// cleanup and the user's own dismiss listener below
try {
onFormClose.run();
} catch (Throwable e) {

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.

even if it is a user provided callback, i don't think this is a good idea. a user-provided callback could still trigger a stackoverflow or OOMs

public void close() throws IOException {
disable();
}

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.

This seems legit, why did we remove that from the onActivityResumed ?

*
* @return true if the feedback form is shown when a shake gesture is detected
*/
@ApiStatus.Internal

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m: since we're using this one in the sample app (and I imagine there's a use-case for this for customers too), shall we unmark it as Internal and make it public?

Sign up for freeto 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

3 participants

@markushi@runningcode@romtsn