Skip to content

Fix crash on SubmitDataUseCase - #3885

Merged
andreia-ferreira merged 8 commits into
masterfrom
andreia/3882/fix-submit-data-usecase-crash
Aug 20, 2026
Merged

Fix crash on SubmitDataUseCase#3885
andreia-ferreira merged 8 commits into
masterfrom
andreia/3882/fix-submit-data-usecase-crash

Conversation

@andreia-ferreira

@andreia-ferreira andreia-ferreira commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #3882

The crash could be reproduced by doing the following:

  1. Start collecting data and past a draw area/drop pin task
  2. Put the app on background
  3. Simulate destroying the background process by executing either adb shell am kill org.groundplatform.android or having developer options 'no background processes'
  4. Go back to the app and complete data collection
  5. The app would crash when reaching the end of data collection

This was because, when the OS kills the app in the background, the data collection screen is recreated at the task the user was in, but with none of the data collected recovered, which caused the crash mentioning the AddLoi task was missing, and previous answers were also silently missing. The only draft recovery path was when the activity would be recreated and the home screen carried the data in nav arguments.

This PR does the following changes:

  • DataCollectionInitializer now restores draft data so that the screen recovers correctly regardless of how it was opened
  • TaskSequenceHandler makes it impossible for a task sequence to resume past a mandatory task that the user hasn't answered to avoid cases where data is silently missing

Before:

Screen_recording_20260814_160426.webm

After:

Screen_recording_20260814_160539.webm

@shobhitagarwal1612 PTAL?

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.52459% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.69%. Comparing base (85b7a02) to head (0221d10).

Files with missing lines Patch % Lines
...oid/ui/datacollection/DataCollectionInitializer.kt 86.95% 1 Missing and 2 partials ⚠️
...undplatform/android/ui/home/HomeScreenViewModel.kt 0.00% 1 Missing and 1 partial ⚠️
...latform/android/repository/SubmissionRepository.kt 90.00% 0 Missing and 1 partial ⚠️
...m/android/ui/datacollection/TaskSequenceHandler.kt 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3885      +/-   ##
============================================
+ Coverage     68.55%   68.69%   +0.14%     
- Complexity     1911     1927      +16     
============================================
  Files           412      412              
  Lines         10968    10968              
  Branches       1432     1432              
============================================
+ Hits           7519     7535      +16     
+ Misses         2701     2685      -16     
  Partials        748      748              
Files with missing lines Coverage Δ
...droid/ui/datacollection/DataCollectionViewModel.kt 81.17% <100.00%> (+1.65%) ⬆️
...oundplatform/android/ui/home/HomeScreenFragment.kt 73.91% <ø> (+2.33%) ⬆️
...ome/mapcontainer/HomeScreenMapContainerFragment.kt 38.88% <ø> (+2.43%) ⬆️
...latform/android/repository/SubmissionRepository.kt 98.00% <90.00%> (-2.00%) ⬇️
...m/android/ui/datacollection/TaskSequenceHandler.kt 98.27% <87.50%> (-1.73%) ⬇️
...undplatform/android/ui/home/HomeScreenViewModel.kt 77.55% <0.00%> (+3.86%) ⬆️
...oid/ui/datacollection/DataCollectionInitializer.kt 61.64% <86.95%> (+6.80%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreia-ferreira
andreia-ferreira merged commit a831afb into master Aug 20, 2026
19 checks passed
@andreia-ferreira
andreia-ferreira deleted the andreia/3882/fix-submit-data-usecase-crash branch August 20, 2026 16:01
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.

[Trending crash] IllegalStateException: AddLoi task response missing

2 participants