# Proposal: Android Auto Favorite Groups ## Intent The Android Auto browse tree exposes only 3 flat folders (Favoritos, Todas, Mis Emisoras), making stations hard to find while driving. The user asked for favorites grouped by category. This is NOT a new feature: favorite groups already exist end-to-end (`GrupoFavoritos` model, SQLite `grupos_favoritos` CRUD, `Emisora.grupoFavoritosId`, `EstadoRadio.gruposFavoritos`, and the phone UI `_GrupoFavoritosPanel`). The only gap is that this categorization was never pushed into the Auto-facing data source. Success = the same grouping the phone already shows becomes reachable in the car, driver-distraction-safe. ## Scope ### In Scope - Extend `FuenteEmisorasAuto` / `actualizarSnapshot()` with a `grupos` parameter so favorite groups and their member stations reach the Auto data source. - Wire `EstadoRadio` to push `gruposFavoritos` into `_fuenteAuto` on snapshot updates. - Extend `ConstructorArbolAuto` to render favorite groups as sub-folders reachable from the existing `Favoritos` folder, with a new `grupo:` media-id scheme. - Keep `Todas` and `Mis Emisoras` unchanged (conservative reorg). - Flag the empty-group and folder-count car-UX decisions for `sdd-design` to resolve. ### Out of Scope - Automatic grouping by pais/idioma/codec (explore Approach 2). - EQ-from-car (separate `android-auto-eq-presets` change — deliver AFTER this). - Any change to group CRUD, phone UI, or the SQLite schema. - Android for Cars App Library / custom templates. ## Capabilities ### New Capabilities - None. ### Modified Capabilities - `android-auto-media`: browse tree gains favorite-group sub-folders under `Favoritos` and a `grupo:` browsable media-id. NOTE: this spec is mid-archive by a concurrent process — `sdd-spec` must confirm its final location before writing the delta. ## Approach Follow explore Investigation 1, Approach 1 (data-model reuse, not new categorization). Add `grupos()` + a `grupos` snapshot field to the Auto data source, mirroring the existing `favoritos`/`misEmisoras`/`todas` seams. `ConstructorArbolAuto.raiz()` keeps 3 root folders; `hijos(idFavoritos)` returns group sub-folders; `hijos(grupo:)` returns that group's stations (reusing the existing sort + 50-item cap). Playable leaves stay `emisora:`. Direct mirror of `pantalla_favoritos.dart` parity. ## Affected Areas | Area | Impact | Description | |------|--------|-------------| | `lib/servicios/navegacion_auto.dart` | Modified | `FuenteEmisorasAuto` interface + `ConstructorArbolAuto` tree/media-ids | | `lib/estado/estado_radio.dart` | Modified | Push `gruposFavoritos` into Auto snapshot | | `lib/modelos/grupo_favoritos.dart`, `lib/servicios/servicio_favoritos.dart` | Read-only reuse | Existing group data/CRUD | ## Risks | Risk | Likelihood | Mitigation | |------|------------|------------| | Shared-file merge conflict with `android-auto-eq-presets` | Med | Deliver this change FIRST, sequentially | | Path collision with mid-archive `android-auto-media` specs | Med | Do not touch those paths; `sdd-spec` confirms spec location | | Driver distraction from too many / empty group folders | Med | Defer empty-group + folder-count decision to `sdd-design` | | Browse depth increases (root -> group -> stations) | Low | Keep root flat; only `Favoritos` gains one level | ## Rollback Plan Additive change. Revert the `grupos` parameter, the `EstadoRadio` snapshot wiring, and the `ConstructorArbolAuto` group-folder branch. The pre-existing 3-folder tree is restored; group data in SQLite and phone UI are untouched. ## Dependencies - None external. Depends only on already-shipped group data model (parent `android-auto-media` change). ## Success Criteria - [ ] `actualizarSnapshot()` accepts and stores favorite groups. - [ ] Auto browse tree shows one sub-folder per surfaced group under `Favoritos`. - [ ] Selecting a group folder lists its member stations; selecting a station plays it. - [ ] `Todas` and `Mis Emisoras` behavior unchanged. - [ ] Empty-group and folder-count UX resolved as explicit design decisions.