fix: harden backup restore and alarm playback
This commit is contained in:
1 parent
61eff32f5f
commit
11ea9be468
19 files changed
+527
-106
No files matched your search
+16
-5
@@ -42,15 +42,26 @@ written here.
|
||||
challenge` or `theme_mode` from a future version, say) degrades to that
|
||||
field's default, the same forgiving-read posture `AlarmMapper` already uses
|
||||
for a corrupt Room row. It does not fail the import.
|
||||
- Import and export are limited to 8 MiB. Import also rejects more than 10,000
|
||||
alarms, 10,000 timers, 1,000 world clocks, oversized labels or ringtone URIs,
|
||||
and more than 1,000 timer presets. These limits keep a picked document from
|
||||
exhausting memory or creating an impractical number of rows.
|
||||
|
||||
## Import semantics
|
||||
|
||||
Import **replaces all state**: alarms, timers and world clocks are deleted
|
||||
and re-created from the file, and every setting the file carries is written
|
||||
over the current value. This is not a merge, and the backup screen says so
|
||||
before the user confirms. A ringing alarm is dismissed and any running timer
|
||||
is deleted *before* the replace, so the import never leaves an orphaned ring
|
||||
session; alarm/timer/stopwatch scheduling is re-resolved immediately after.
|
||||
before the user confirms. Settings are written in one DataStore transaction;
|
||||
the three Room tables are replaced in one database transaction. The live ring
|
||||
and timer services are paused while the tables change. If the database replace
|
||||
fails, the old rows remain, the previous settings are restored, and the ring
|
||||
and timer registrations are resumed. Scheduling is reconciled after either
|
||||
outcome. An imported timer always starts idle.
|
||||
|
||||
Export writes a complete temporary document before removing an older backup.
|
||||
If the provider refuses the final rename, the complete temporary document is
|
||||
kept in the chosen folder and the app reports the failure with its filename.
|
||||
|
||||
Every imported alarm and timer gets a **fresh id and fresh timestamps**.
|
||||
The backup carries no id and no `created_at`/`updated_at`, since those are
|
||||
@@ -127,8 +138,8 @@ Field names mirror `ClockPrefs`'/`SettingsPrefs`' own on-disk keys. Older
|
||||
files may also carry `default_timer_duration_millis`, from a default timer
|
||||
length setting that has since been removed; it is ignored on import like any
|
||||
other unknown field. Every
|
||||
numeric/duration value is clamped on *apply*, through the existing pref
|
||||
setters, never on parse.
|
||||
numeric/duration value is clamped on *apply* using the same ranges and encoding
|
||||
as the existing preference setters, never on parse.
|
||||
|
||||
## Ringtone URIs
|
||||
|
||||
|
||||
Reference in new issue
Block a user