feat(android): implement Phase 1 cold start recovery
Implements cold start recovery for missed notifications and future alarm verification/rescheduling as specified in Phase 1 directive. Changes: - Add ReactivationManager.kt with cold start recovery logic - Integrate recovery into DailyNotificationPlugin.load() - Fix NotifyReceiver to always store NotificationContentEntity for recovery - Add Phase 1 emulator testing guide and verification doc - Add test-phase1.sh automated test harness Recovery behavior: - Detects missed notifications on app launch - Marks missed notifications in database - Verifies future alarms are scheduled in AlarmManager - Reschedules missing future alarms - Completes within 2-second timeout (non-blocking) Test harness: - Automated script with 4 test cases - UI prompts for plugin configuration - Log parsing for recovery results - Verified on Pixel 8 API 34 emulator Related: - Implements: android-implementation-directive-phase1.md - Requirements: docs/alarms/03-plugin-requirements.md §3.1.2 - Testing: docs/alarms/PHASE1-EMULATOR-TESTING.md - Verification: docs/alarms/PHASE1-VERIFICATION.md
This commit is contained in:
@@ -159,6 +159,8 @@ class ReactivationManager(private val context: Context) {
|
||||
|
||||
### 2.3 Cold Start Recovery
|
||||
|
||||
**Platform Reference**: [Android §2.1.4](./alarms/01-platform-capability-reference.md#214-alarms-can-be-restored-after-app-restart) - Alarms can be restored after app restart
|
||||
|
||||
```kotlin
|
||||
/**
|
||||
* Perform cold start recovery
|
||||
@@ -622,6 +624,23 @@ override fun load() {
|
||||
|
||||
**Pass Criteria**: Invalid data handled gracefully.
|
||||
|
||||
### 8.4 Emulator Test Harness
|
||||
|
||||
The manual tests in §8.1–§8.3 are codified in the script `test-phase1.sh` in:
|
||||
|
||||
```bash
|
||||
test-apps/android-test-app/test-phase1.sh
|
||||
```
|
||||
|
||||
**Status:**
|
||||
|
||||
* ✅ Script implemented and polished
|
||||
* ✅ Verified on Android Emulator (Pixel 8 API 34) on 27 November 2025
|
||||
* ✅ Correctly recognizes both `verified>0` and `rescheduled>0` as PASS cases
|
||||
* ✅ Treats `DELETE_FAILED_INTERNAL_ERROR` on uninstall as non-fatal
|
||||
|
||||
For regression testing, use `PHASE1-EMULATOR-TESTING.md` + `test-phase1.sh` as the canonical procedure.
|
||||
|
||||
---
|
||||
|
||||
## 9. Implementation Checklist
|
||||
@@ -676,9 +695,11 @@ override fun load() {
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Unified Alarm Directive](./alarms/000-UNIFIED-ALARM-DIRECTIVE.md) - Master coordination document
|
||||
- [Plugin Requirements](./alarms/03-plugin-requirements.md) - Requirements this phase implements
|
||||
- [Platform Capability Reference](./alarms/01-platform-capability-reference.md) - OS-level facts
|
||||
- [Plugin Behavior Exploration](./alarms/02-plugin-behavior-exploration.md) - Test scenarios
|
||||
- [Full Implementation Directive](./android-implementation-directive.md) - Complete scope (all phases)
|
||||
- [Exploration Findings](./exploration-findings-initial.md) - Gap analysis
|
||||
- [Plugin Requirements](./plugin-requirements-implementation.md) - Requirements
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user