fix(bedtime): keep the slot off the allow-while-idle ration

Android rations allow-while-idle wake-ups per app in doze, and the timer's
expiry slot and the alarm's fallback share that ration, so a 07:00
wake-up fire could hold back a timer due at 07:04. The bedtime slot is
now a plain exact alarm that doze may defer, which can move a mode
boundary but never a ring. A restore of unchanged bedtime settings no
longer forces the mode, and the screen skips its rule check while bedtime
is off.

Refs #1
This commit is contained in:
makiolaj committed 2026-10-22 12:20:25 +02:00
1 parent 8b182c999b
commit 1a5552a221
4 files changed
+31 -16

No files matched your search

+10 -5
View File
@@ -2759,11 +2759,16 @@ engines (`ArchitectureRulesTest` holds it to no `android.*` import):
- `BedtimeScheduler`, **one** AlarmManager slot of its own. Its PendingIntent
targets `BedtimeReceiver` with its own action and request code, so arming or
cancelling it cannot replace or cancel an alarm's or a timer's registration.
It is `RTC_WAKEUP`, exact while idle when the platform allows it and
`setAndAllowWhileIdle` otherwise, the timer slot's two branches. It never
uses `setAlarmClock`: that slot is the status bar's next *alarm*. Alarms
themselves use `setAlarmClock`, which the while-idle quota does not touch,
and bedtime adds at most three fires a night.
It is `RTC_WAKEUP` and `setExact` (plain `set` without exact-alarm access),
and deliberately **not** allow-while-idle: Android rations allow-while-idle
wake-ups per app in doze (one per nine minutes on Android 10 and 11, and for
the inexact fallback without exact-alarm access), and the timer's expiry slot
and the alarm's fallback draw on that same ration, so a 07:00 wake-up fire
could hold back a timer at 07:04 or a fallback alarm at 07:05. In deep doze
the slot therefore waits for a maintenance window or for the next alarm
clock to wake the device. That can move a mode boundary, never a ring. It
never uses `setAlarmClock` either: that slot is the status bar's next
*alarm*.
- `BedtimeMode`, the rule. Every call is guarded and a no-op without access.
- `BedtimeNotifier`, the reminder, on its own `bedtime_reminder` channel.