Skip to content

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

Open
markushi wants to merge 10 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 10 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

Comment thread sentry/src/main/java/io/sentry/IFeedbackApi.java

@runningcode runningcode 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!

Comment thread sentry/src/main/java/io/sentry/IFeedbackApi.java Outdated
- Scope shake suppression to the activity a feedback form is showing on, instead
  of a global paused flag. A dialog lives in its activity's window and is never
  notified when that activity is backgrounded, so tracking the owning activity
  removes the lifecycle heuristics entirely
- Re-check enabled on shake dispatch so a concurrent disableOnShake() cannot
  still show a form
- Narrow user-callback guards from Throwable to Exception so Errors propagate
- Rename isFeedbackOnShakeEnabled() to isOnShakeEnabled() for consistency with
  enableOnShake()/disableOnShake(), and drop @ApiStatus.Internal

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@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 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e5d6f39. Configure here.

}
previousOnFormClose = null;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Form unpause clobbers another form

Medium Severity

setOnShakePaused keeps only one formActivityRef and clears it unconditionally on unpause. Cross-activity shake is now allowed while a backgrounded form still exists, so a second form’s pause/unpause overwrites or clears the first form’s slot. Returning to that earlier activity, or destroying it while another form is visible, can re-arm detection and stack another dialog.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e5d6f39. Configure here.

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

3 participants