We're building ReClaim , a minimalist Android launcher that's on Google Play . Two earlier posts covered features that measure time: app reminder timers that race AlarmManager against a coroutine , and daily app limits that replay UsageEvents instead of trusting the daily buckets.
Both features worked in the happy path. Both also had a gap that only shows up at a boundary:
A reboot. You set a 15-minute reminder for an app, the phone restarts, and the timer is just gone. No alarm, no countdown notification.
Midnight. You open an app at 11:40 PM and close it at 12:20 AM. Those 20 minutes after midnight never counted toward the new day.
Both fixes went into a single commit. This post walks through it: a small "pending" flag, a boot receiver, and a pure function with seven JVM unit tests. Stack: Kotlin, Hilt, DataStore, minSdk 26 , targetSdk 36 . Snippets are trimmed from the real code; // ... marks cuts.
Edge case 1: a reboot wipes the timer
Here's how a reminder gets scheduled.…