feat(auto): expose EQ presets as a browsable Android Auto folder

Adds an Ecualizador folder listing the 6 fixed presets; selecting one
applies and persists it through the existing headless-safe seam
without touching playback or the now-playing media item.
This commit is contained in:
2026-07-19 14:12:39 +02:00
parent 066fedb7bc
commit 90cd232ad2
9 changed files with 1092 additions and 7 deletions
+24 -2
View File
@@ -13,6 +13,7 @@ import '../modelos/preset_ecualizador.dart';
import 'controlador_reconexion.dart';
import 'navegacion_auto.dart';
import 'servicio_audio_session.dart';
import 'servicio_ecualizador.dart';
/// Estado de reproducción expuesto al UI.
enum EstadoReproduccion {
@@ -737,6 +738,9 @@ class PluriWaveAudioHandler extends BaseAudioHandler
if (parentMediaId == AudioService.browsableRootId) {
return constructor.raiz();
}
if (parentMediaId == ConstructorArbolAuto.idEcualizador) {
return constructor.presetsEq(PresetEcualizador.presets);
}
final fuente = _fuenteNavegacionGlobal;
if (fuente == null) return const [];
if (parentMediaId == ConstructorArbolAuto.idFavoritos) {
@@ -779,9 +783,27 @@ class PluriWaveAudioHandler extends BaseAudioHandler
String mediaId, [
Map<String, dynamic>? extras,
]) async {
final fuente = _fuenteNavegacionGlobal;
if (fuente == null) return;
try {
// EQ preset selection (Design ADR-3, Spec "EQ Preset Selection Applies
// Without Disturbing Playback"): FIRST branch, unconditional `return`,
// so an `eq_preset:` id can never fall through to the playback routing
// below. `aplicarPresetPorMediaId`'s seams are EQ-only (persist +
// apply) — there is no playback parameter to inject here.
if (esPresetMediaId(mediaId)) {
final servicio = ServicioEcualizador();
await aplicarPresetPorMediaId(
mediaId,
presets: PresetEcualizador.presets,
uuidActual: emisoraActual?.uuid,
clavesPorEmisora: () async =>
(await servicio.cargar()).porEmisora.keys.toSet(),
persistirPrincipal: servicio.guardarPrincipal,
aplicar: aplicarPreset,
);
return;
}
final fuente = _fuenteNavegacionGlobal;
if (fuente == null) return;
await reproducirPorMediaId(
mediaId,
fuente: fuente,