# Phase 2 – Force Stop Recovery Verification **Plugin:** Daily Notification Plugin **Scope:** Force stop detection & recovery (App ID: `com.timesafari.dailynotification`) **Related Docs:** - `android-implementation-directive-phase2.md` - `03-plugin-requirements.md` (Force Stop & App Termination behavior) - `PHASE2-EMULATOR-TESTING.md` - `000-UNIFIED-ALARM-DIRECTIVE.md` --- ## 1. Objective Phase 2 verifies that the Daily Notification Plugin: 1. Correctly detects **force stop** conditions where alarms may have been cleared. 2. **Reschedules** future notifications when schedules exist in the database but alarms are missing. 3. **Avoids heavy recovery** when alarms are intact (no false positives). 4. **Does not misfire** force-stop recovery on first launch / empty database. Phase 2 builds on Phase 1, which already covers: - Cold start detection - Missed notification marking - Basic alarm verification --- ## 2. Test Method Verification is performed using the emulator test harness: ```bash cd test-apps/android-test-app ./test-phase2.sh ``` This script: * Builds and installs the debug APK (`app/build/outputs/apk/debug/app-debug.apk`). * Guides the tester through UI steps for scheduling notifications and configuring the plugin. * Simulates: * `force-stop` behavior via `adb shell am force-stop ...` * "Soft stop" / process kill via `adb shell am kill ...` * First launch / empty DB via uninstall + reinstall * Collects and parses `DNP-REACTIVATION` log lines, extracting: * `scenario` * `missed` * `rescheduled` * `verified` * `errors` Detailed steps and expectations are documented in `PHASE2-EMULATOR-TESTING.md`. --- ## 3. Test Matrix | ID | Scenario | Method / Script Step | Expected Behavior | Result | Notes | | --- | ---------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------ | ----- | | 2.1 | Force stop clears alarms | `test-phase2.sh` – TEST 1: Force Stop – Alarms Cleared | `scenario=FORCE_STOP`, `rescheduled>0`, `errors=0` | ☐ | | | 2.2 | Force stop / process stop with alarms intact | `test-phase2.sh` – TEST 2: Soft Stop – Alarms Intact | `scenario != FORCE_STOP`, `rescheduled=0`, `errors=0` | ☐ | | | 2.3 | First launch / empty DB (no schedules present) | `test-phase2.sh` – TEST 3: First Launch / No Schedules | Either no recovery logs **or** `scenario=NONE` (or equivalent) and `rescheduled=0`, `errors=0` | ☐ | | > Fill in **Result** and **Notes** after executing the script on your baseline emulator/device. --- ## 4. Expected Log Patterns ### 4.1 Force Stop – Alarms Cleared (Test 2.1) Typical expected `DNP-REACTIVATION` log patterns: ```text DNP-REACTIVATION: Detected scenario: FORCE_STOP DNP-REACTIVATION: Rescheduled alarm: daily_ for