From df314d5dbe439317517e5b344f4c8854728260a8 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 22 Nov 2026 13:56:01 +0100 Subject: [PATCH] Document the 21:00 notifications check Co-Authored-By: Claude Opus 5.5 --- DOCS-bypass.md | 31 ++++++++++++++++++++++++++++++- DOCS-wake-enforcement.md | 6 ++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/DOCS-bypass.md b/DOCS-bypass.md index f4414bb..568d6c3 100644 --- a/DOCS-bypass.md +++ b/DOCS-bypass.md @@ -72,7 +72,36 @@ a minute is recorded once (both activities run the launch check). and after the day's own ring was used. It stops on a `dismissed` newer than the bypass, which the phone also pushes at once. Free and sick days and an escape stand it down. The tick reads the phone until `A + 4 h` - (`BYPASS_WATCH`); the fallback timer ticks all day. + (`BYPASS_WATCH`); the fallback timer ticks 04:00-11:59 (and 21:xx, below). + +## The 21:00 notifications check + +Android lets nothing lock "All WakeAlarm notifications", and with them off +the ring has no screen. The ring-time check above still counts it as a +bypass; this one catches it the evening before, while kuhy can still fix it. + +- **Phone.** `NotifState` (the same rule `Bypass.checkPermissions` uses: app + notifications off, or the ring channel at `IMPORTANCE_NONE`) logs a + `notifications` event, data `enabled` (bool) and `trigger`, and pushes it + at once through `publishNowMain`. Triggers: an exact alarm at 21:00 + (`NotifAlarm`, request code 1007, `evening`; re-armed by its receiver, by + every `AlarmScheduler.schedule`, boot and the watchdog, always the next + future 21:00) and `NotifBlockReceiver` on `APP_BLOCK_STATE_CHANGED` / + `NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED` for the ring channel + (`app_block`, `channel_block`). Both receivers hold the broadcast 25 s so + the headless engine is not frozen mid-push. +- **PC** (`_fallback_evening`, rule in `_evening_policy`). The fallback + timer also ticks 21:00-21:59; those ticks skip the morning code. When + today's newest `notifications` event says off, the PC rings + (`notifications_off`) until a newer one says on, or 30 min + (`FALLBACK_RING_CAP`) from the evening's first ring. The cap has its own + latch, `evening_ring.json`, so it never eats the morning's or a bypass's. + The hour gates only *starting*; a ring started at 21:50 runs its 30 min. +- **No ring** when tomorrow is a free or sick day (`free_tomorrow`, + `sick_tomorrow`), when no event was published today (phone off), or when + Firebase does not answer at the tick. An unreachable poll mid-ring keeps + ringing. Events: `evening_tick`, `evening_ring_start`, `evening_ring_stop` + (never the morning's names, so the audit does not count them). ## The monitors ring too diff --git a/DOCS-wake-enforcement.md b/DOCS-wake-enforcement.md index a2c03ab..0cbfc58 100644 --- a/DOCS-wake-enforcement.md +++ b/DOCS-wake-enforcement.md @@ -155,7 +155,8 @@ Phone (`phone_events.kind`): `alarm_fired` (data: `reason` = `ring_screen_opened`, `ring_started_published` (data: `date`, `source` = `alarm`|`ring_screen`), `dismissed`, `stick_check` (data: `trigger` = `exact`|`boot`|`watchdog`, `date` judged, `verdict`, incl. `free_day`|`sick_day`), `bypass` (data: `cause`, `date`, `session`; `DOCS-bypass.md`), -`bypass_ignored`, `unsuspended`, `lockdown_sent` (data: +`bypass_ignored`, `notifications` (data: `enabled`, `trigger` = +`evening`|`app_block`|`channel_block`; `DOCS-bypass.md`), `unsuspended`, `lockdown_sent` (data: `until`, `streak`), `lift_sent`, `escape_used`, `boot`. `ring_started` is published twice over: a headless Dart engine started by @@ -166,7 +167,8 @@ The A+15 check uses `setExactAndAllowWhileIdle` (falls back to system's next alarm. Boot/watchdog catch up on up to 5 unchecked past days. PC (`events.jsonl` `event`): `fallback_tick` (only on decision change), -`fallback_ring_start`, `fallback_ring_stop`, `ring_backend`, `rtc_armed`, +`fallback_ring_start`, `fallback_ring_stop`, `evening_tick`, +`evening_ring_start`, `evening_ring_stop`, `ring_backend`, `rtc_armed`, `rtc_skip`, `firebase_unreachable`, `escape_seen`, `penalty_written`, `penalty_cancelled` (field `cause`: `escape` | `sick_day`), `audit_written`.