Fix Sentry WORDPRESS-ANDROID-3F23: guard preventBackNavigation#22838
Merged
Fix Sentry WORDPRESS-ANDROID-3F23: guard preventBackNavigation#22838
Conversation
…t finished/destroyed Activity Fixes WORDPRESS-ANDROID-3F23 ActivityLauncherWrapper.preventBackNavigation called Activity.finishAffinity() unconditionally, which throws "IllegalStateException: Can not be called to deliver a result" when the Activity is already finishing or destroyed (the JetpackStaticPosterFragment click event arrives via SingleLiveEvent after the Activity has been torn down). Skip the finishAffinity() call when the Activity is finishing or destroyed. The same fix also addresses the closely-related WORDPRESS-ANDROID-3F1V. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
Contributor
|
|
Contributor
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #22838 +/- ##
=======================================
Coverage 37.20% 37.20%
=======================================
Files 2317 2317
Lines 124522 124522
Branches 16909 16909
=======================================
Hits 46333 46333
Misses 74441 74441
Partials 3748 3748 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cover the isFinishing and isDestroyed branches added to guard against the IllegalStateException seen in WORDPRESS-ANDROID-3F23 / 3F1V. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes WORDPRESS-ANDROID-3F23
Summary
Fix for Sentry WORDPRESS-ANDROID-3F23 — 32 users / 34 events.
ActivityLauncherWrapper.preventBackNavigationcallsActivity.finishAffinity()unconditionally, which throwsIllegalStateException: Can not be called to deliver a resultwhen the Activity is already finishing or destroyed.Fix: skip the
finishAffinity()call when the Activity is finishing or destroyed. The same fix also addresses the closely-related WORDPRESS-ANDROID-3F1V (18 users) which has identical culprit and stack.Test plan
Eyeball the code - it's a simple, self-explanatory change. However, the purpose of the
preventBackNavigationfunction was not self-explanatory, so I added a comment above it.