feat(android): implement Phase 2 force stop detection and recovery

Implements force stop scenario detection and comprehensive alarm recovery.
Adds scenario differentiation (FORCE_STOP, BOOT, COLD_START, NONE) to route
recovery logic appropriately.

Changes:
- Add RecoveryScenario enum and detectScenario() method
- Add performForceStopRecovery() for force stop scenario
- Add alarmsExist() helper to check AlarmManager state
- Update isBootRecovery() to ignore flags < 1 second old (emulator quirk fix)
- Update BootReceiver to only set boot flag for actual boot events
- Add test script step to clear boot flag before testing
- Fix compiler warnings (remove unused parameters)

Fixes false BOOT detection when alarms are cleared after force stop.
Boot flag age validation prevents emulator quirks from triggering BOOT
scenario during app launch.

Implements: Plugin Requirements §3.1.4 - Force Stop Recovery
This commit is contained in:
Matthew Raymer
2025-12-08 07:37:51 +00:00
parent 1053b668d0
commit 4c4a5e2aa9
3 changed files with 373 additions and 34 deletions

View File

@@ -74,6 +74,12 @@ test1_force_stop_cleared_alarms() {
pause
substep "Step 4.5: Clear boot flag (prevent false BOOT detection)"
# Clear boot flag to ensure force stop detection works correctly
# Boot flag might be set from previous runs or emulator quirks
adb shell "run-as ${APP_ID} rm -f shared_prefs/dailynotification_recovery.xml 2>/dev/null || true"
info "Boot flag cleared (if it existed)"
substep "Step 5: Launch app (triggers recovery) and capture logs"
clear_logs
launch_app