Fix data collection crash when UI state isn't Ready#3783
Open
andreia-ferreira wants to merge 3 commits into
Open
Fix data collection crash when UI state isn't Ready#3783andreia-ferreira wants to merge 3 commits into
andreia-ferreira wants to merge 3 commits into
Conversation
…nstead of forcing Ready state
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3783 +/- ##
============================================
+ Coverage 66.60% 66.66% +0.06%
- Complexity 1684 1689 +5
============================================
Files 392 392
Lines 10145 10147 +2
Branches 1295 1298 +3
============================================
+ Hits 6757 6765 +8
+ Misses 2711 2708 -3
+ Partials 677 674 -3
🚀 New features to boost your workflow:
|
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 #3450
Fixes #3432
There were crashes on the data collection screen, where the VM expected the UI state to be Ready when it wasn't. One way to reproduce it is:
1- Set 'No background processes' in Developer options->Background process limit
2 - Initiate data collection and send the app to the background midway through the survey
3 - Open other apps to be sure that the app process is killed
4 - Return to the app and press the back button and see that it crashes
This happens after the OS kills the app process (usually because of low memory), the back stack and saved state are restored while everything else has to be recreated from scratch, so the app reopens directly on data collection while
MainViewModelis still runningreactivateLastSurveywhich populates theactiveSurveyflow. The screen sits inLoadingawaiting the active survey to finish loading (orError, if it fails) , and a back press in that moment crashes the app.This PR updates this logic, moving most of
onBackto a dedicated method in the VM, which will handle the different uiStates accordingly and showing the exit warning if a user exits in the middle of a loading. This was also covered with unit tests.Before
Screen_recording_20260612_164333.webm
After
Screen_recording_20260612_163811.webm
@shobhitagarwal1612 PTAL?