fix(alarmas,auto): guard the last unguarded snooze path, surface car progress
Continuation of7054a4c: the native anchor guard alone did not fix the reported ~1444-minute snooze, because Dart runs AFTERWARDS on the pre-notice path and had no guard at all. 1. Snooze from the pre-notice notification, root cause. app.dart dispatches AFTER the receiver's postponeNext already ran and after startActivity, and EstadoAlarmas.posponerProximaDesdePreaviso took whatever occurrence it was handed on faith, then persisted and rescheduled from it -- the last snooze path in the codebase with no occurrence guard. The occurrence itself is not trustworthy either: app.dart falls back to alarma.proximaEjecucion when the native event carries none, and that field can already point at tomorrow. _ocurrenciaSonando is generalized into _ocurrenciaValida with a caller- supplied forward allowance and an externally-proposed occurrence that still has to survive the same check. The pre-notice path gets a ventanaPreaviso (30 min, matching AlarmScheduler.PRE_NOTICE_MILLIS) -- unlike the ringing-screen guard, this occurrence legitimately has not happened yet, which is exactly why the existing helper could not just be reused here. Also heals state already poisoned by the missing guard: a snoozeHasta parked past a 3-hour ceiling (posponerEjecucion clamps to 120 minutes, so anything beyond that is corruption, not a long real snooze) is dropped on recalculation. Without it, an alarm poisoned on a build before this fix keeps reporting tomorrow after updating, and the user reasonably concludes nothing changed. 2. Android Auto: no progress bar or time labels on a local track. updatePosition was never set anywhere in the handler, so it sat at its Duration.zero default while copyWith refreshed updateTime to now on every push -- the car was told "position 0, as of right now" on every event, a bar pinned at the start regardless of what was actually playing. Now set from _player.position on both the player-state and buffered-position listeners (the latter ticks ~2/s, which is what keeps the car's bar smooth between player-state events). Also stream the MediaItem's duration once the source reports it -- Auto draws no bar at all without one, and radio streams correctly keep reporting none (live audio has no length). 3. Android Auto: drop the Ecualizador browsable folder. Owner decision after driving with it: a browsable six-preset list is more interaction than a driver wants, and on/off from all three player views (already fixed in7054a4cto win the custom-action slot) is the only equalizer control that belongs in the car. Preset selection stays on the phone. This lands back on the redesign mockup's original rule ("sin carpeta de ecualizador"), now for a road-tested reason. getChildren keeps answering the folder's id transitionally, since a head unit can have the old tree cached for a session or two. The two "raiz always includes/ends with Ecualizador" tests are replaced, not regressed -- same move the codebase already made once in the other direction for the same folder. Tests: 1127 -> 1132.
This commit is contained in:
@@ -315,20 +315,19 @@ class ConstructorArbolAuto {
|
||||
/// optionally Música Local, Ecualizador), all non-playable.
|
||||
///
|
||||
/// Decision `auto/ecualizador-diseno` SUPERSEDES the "no equalizer
|
||||
/// folder" rule that used to live in this doc comment (commit `2403da3`,
|
||||
/// mirroring the redesign mockup's "sin carpeta de ecualizador", turn t4
|
||||
/// line 40). That rule was sound when written, but predated on-device
|
||||
/// feedback showing that Android Auto custom actions don't surface
|
||||
/// enough state for choosing among six presets: a monochrome icon cannot
|
||||
/// legibly encode "which preset", and many head units render a custom
|
||||
/// action icon-first, hiding its label. `Ecualizador` is a real
|
||||
/// browsable folder again: "Desactivar" first, then the six factory
|
||||
/// presets, the active one marked (children built by
|
||||
/// `itemsEcualizadorAuto` in `servicio_audio.dart` -- this class stays
|
||||
/// free of any `AppLocalizations` dependency, unlike that builder).
|
||||
/// Always present, and LAST in the list (after Música Local, when
|
||||
/// included) -- unlike [idMusicaLocal] it is never conditionally hidden.
|
||||
/// Do not "restore" the no-folder rule without re-reading that decision.
|
||||
/// There is NO `Ecualizador` folder. The car's only equalizer control is
|
||||
/// the on/off custom action on the playback screen
|
||||
/// (`controlesEcualizadorPersonalizados` in `servicio_audio.dart`), which
|
||||
/// the driver reaches from all three player views without leaving them.
|
||||
///
|
||||
/// The folder existed briefly (`8423ccd`) because custom actions were
|
||||
/// thought unable to convey enough state for a six-preset choice. Owner
|
||||
/// decision after driving with it: a browsable preset list is more
|
||||
/// interaction than a driver wants, and on/off is the only equalizer
|
||||
/// control that belongs in a car. Preset selection stays on the phone.
|
||||
/// This lands back on the redesign mockup's original rule ("sin carpeta de
|
||||
/// ecualizador", turn t4 line 40), now for a road-tested reason rather than
|
||||
/// an assumed one.
|
||||
///
|
||||
/// `Música Local` is OMITTED entirely (not just empty) unless
|
||||
/// [incluirMusicaLocal] is `true` (Design "Local root hidden until a folder
|
||||
@@ -339,7 +338,6 @@ class ConstructorArbolAuto {
|
||||
_carpeta(idTodas, 'Todas las emisoras'),
|
||||
_carpeta(idMisEmisoras, 'Mis emisoras'),
|
||||
if (incluirMusicaLocal) _carpeta(idMusicaLocal, 'Música Local'),
|
||||
_carpeta(idEcualizador, 'Ecualizador'),
|
||||
];
|
||||
|
||||
MediaItem _carpeta(String id, String titulo) => MediaItem(
|
||||
|
||||
Reference in New Issue
Block a user