Fix Nav Drawer Photo Launcher Registration Crash#3758
Conversation
[AI] Registered the nav drawer photo edit launcher once in BaseDrawerActivity.onCreate and injected it into BaseDrawerController, preventing the registerForActivityResult crash when the drawer was rebuilt after the activity reached STARTED. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Suggested Review Order
|
📝 WalkthroughWalkthroughThe PR refactors activity result handling for photo capture by moving launcher management from Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3758 +/- ##
============================================
+ Coverage 25.23% 25.55% +0.32%
- Complexity 4332 4368 +36
============================================
Files 950 950
Lines 57645 57646 +1
Branches 6894 6894
============================================
+ Hits 14544 14732 +188
+ Misses 41286 41088 -198
- Partials 1815 1826 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Technical Summary
This PR fixes a flaky BrowserStack CI test failure.
The nav drawer's photo-edit launcher was being registered during drawer setup, which can run after the activity reaches
STARTEDand violates theregisterForActivityResultcontract. It now registers once inBaseDrawerActivity.onCreateand is injected intoBaseDrawerController, so rebuilding the controller no longer re-registers it.In CI the illegal re-registration crashed the activity mid-test whenever a home-screen test triggered a UI rebuild after the activity had resumed. Because drawer visibility is gated on a persisted preference, whether a given test hit the crash depended on shard ordering, which is why it surfaced as a flaky cascade of Espresso failures across home-screen tests.
Safety Assurance
Safety story
What gives me confidence:
STARTED); I verified the lifecycle ordering soBaseDrawerActivity.onCreateregisters the launcher beforeonCreateSessionSafe → setupUIever builds a controller.Risks to review:
BaseDrawerActivityis the shared base for drawer-bearing activities, so the registration move affects all of them, not just the home screen.