Skip to content

Commit 527abb7

Browse files
antonisclaude
andcommitted
fix(feedback): move isDialogShowing reset from onActivityPaused to onActivityDestroyed
AlertDialog survives pause/resume cycles (e.g. screen off/on), so resetting isDialogShowing in onActivityPaused allowed duplicate dialogs. Move the reset to onActivityDestroyed where the dialog truly cannot survive. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dbbd37e commit 527abb7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/ShakeDetectionIntegration.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ public void onActivityPaused(final @NotNull Activity activity) {
7474
if (activity == currentActivity) {
7575
stopShakeDetection();
7676
currentActivity = null;
77-
// Reset dialog flag — the dialog cannot outlive the activity, so if
78-
// showDialog silently failed or the activity is finishing, clear the flag
79-
// to avoid permanently blocking shake-to-feedback.
80-
isDialogShowing = false;
8177
}
8278
}
8379

@@ -96,7 +92,12 @@ public void onActivitySaveInstanceState(
9692
final @NotNull Activity activity, final @NotNull Bundle outState) {}
9793

9894
@Override
99-
public void onActivityDestroyed(final @NotNull Activity activity) {}
95+
public void onActivityDestroyed(final @NotNull Activity activity) {
96+
// Reset dialog flag — the dialog cannot outlive the activity being destroyed,
97+
// so clear the flag to avoid permanently blocking shake-to-feedback
98+
// (e.g. if showDialog silently failed).
99+
isDialogShowing = false;
100+
}
100101

101102
private void startShakeDetection(final @NotNull Activity activity) {
102103
if (options == null) {

0 commit comments

Comments
 (0)