fix(worldclock): read the whole home readout and catch up after sleep
The home readout gave TalkBack its minute-precision time as a description, which replaced "Home", the city and the zone name; it is the node's text now. The clock-change receiver swaps TIME_TICK, which doubled every minute's work, for SCREEN_ON, which covers a delay stretched by deep sleep, and resets the cached default zone on TIMEZONE_CHANGED so the rebuild cannot read the old one. Doc and KDoc drift fixed.
This commit is contained in:
1 parent
65c86af313
commit
adc5a3bdd6
8 files changed
+54
-38
No files matched your search
+14
-8
@@ -595,7 +595,8 @@ Four slices:
|
||||
| Slice | Keys | Owner |
|
||||
|---|---|---|
|
||||
| Appearance (M1) | `theme_mode`, `dynamic_color` | `AppearancePrefs` in `core-prefs`, the family's shared key names |
|
||||
| Clock defaults (M2) | `default_snooze_minutes`, `default_snooze_limit`, `default_vibrate`, `default_volume_ramp_seconds`, `default_alarm_ringtone_uri`, `default_timer_ringtone_uri`, `default_dismiss_challenge`, `home_zone_id`, `world_clock_show_seconds` | `ClockPrefs`, surfaced as `SettingsPrefs.defaults: Flow<ClockDefaults>`; `world_clock_show_seconds` (#23) as its own `SettingsPrefs.worldClockSeconds`, so flipping a display option re-emits nothing alarms and timers watch |
|
||||
| Clock defaults (M2) | `default_snooze_minutes`, `default_snooze_limit`, `default_vibrate`, `default_volume_ramp_seconds`, `default_alarm_ringtone_uri`, `default_timer_ringtone_uri`, `default_dismiss_challenge`, `home_zone_id` | `ClockPrefs`, surfaced as `SettingsPrefs.defaults: Flow<ClockDefaults>` |
|
||||
| World clock display (#23) | `world_clock_show_seconds` | `ClockPrefs`, surfaced as its own `SettingsPrefs.worldClockSeconds`, not a clock default, so flipping it re-emits nothing alarms and timers watch |
|
||||
| Stopwatch run record (M2) | `stopwatch_state`, `stopwatch_started_elapsed_millis`, `stopwatch_accumulated_millis`, `stopwatch_last_lap_cumulative_millis` (M7 is the first caller of the last, for the in-progress lap's split) | `StopwatchPrefs`, behind `StopwatchStateStore` |
|
||||
| System facts (M3) | `last_boot_id` | `SystemPrefs`, behind `BootStateStore`, the persisted half of the reboot gate |
|
||||
| Timers (M6) | `timer_presets`, `timer_ring_sounding_since_millis` | `TimerPrefs`: the presets surfaced as `SettingsPrefs.timerPresets`, the ring session's anchor behind `TimerRingStateStore` |
|
||||
@@ -2444,8 +2445,9 @@ The second hand belongs to the switch rather than being always there: a hand
|
||||
that steps every second is exactly what makes the tab wake every second, and
|
||||
the point of the switch is that nobody pays for that without asking.
|
||||
|
||||
Both cadences are `Ticker.alignedTicks` (§12), `WorldClockDefaults.MinuteTick`
|
||||
or `SecondTick`, so a tick lands on the wall-clock boundary itself rather than
|
||||
Both cadences are `Ticker.alignedTicks` (§12), at
|
||||
`WorldClockDefaults.tickFor(showSeconds)`, which is derived from the same
|
||||
`unitFor` the readouts are truncated to, so a tick lands on the wall-clock boundary itself rather than
|
||||
up to a period late; a free-running one-second `delay` could leave the second
|
||||
hand a full second behind the device clock. This replaces M8's 200 ms
|
||||
free-running tick, which got within a fifth of a second only by waking five
|
||||
@@ -2458,12 +2460,16 @@ it switches the cadence at once through the same `flatMapLatest`.
|
||||
A minute is too long to wait for `TIME_SET` or `TIMEZONE_CHANGED`, which can
|
||||
arrive with the tab on screen (a network zone change on landing, split
|
||||
screen). So `ClockChanges` (`AndroidClockChanges`, a receiver registered only
|
||||
while the tab collects) restarts the tick: those two, plus `TIME_TICK`, make
|
||||
while the tab collects) restarts the tick: those two, plus `SCREEN_ON`, make
|
||||
the state re-read the clock and the zone at once, and the restarted ticker
|
||||
measures its next wait against the clock as it now reads. `TIME_TICK` also
|
||||
covers the one gap an aligned `delay` has, a deep sleep inside the
|
||||
five-second `WhileSubscribed` grace, which stretches the wait because the
|
||||
main looper's clock stops while the device sleeps. The signal is combined
|
||||
measures its next wait against the clock as it now reads. On
|
||||
`TIMEZONE_CHANGED` the receiver also resets the process's cached default
|
||||
zone itself, since the system's own reset is a separate call that can land
|
||||
after the broadcast. `SCREEN_ON` covers the one gap an aligned `delay` has, a
|
||||
deep sleep inside the five-second `WhileSubscribed` grace, which stretches
|
||||
the wait because the main looper's clock stops while the device sleeps.
|
||||
(`TIME_TICK` would also do, but it fires on the same boundary as the minute
|
||||
tick and would build every minute twice.) The signal is combined
|
||||
with the stored list, the home zone and the setting *outside* the
|
||||
`flatMapLatest`, so the receiver is registered once per subscription, not
|
||||
once per list edit. Each broadcast costs one extra `build`, which
|
||||
|
||||
Reference in new issue
Block a user