fix(audio): make the audio diagnostics visible in release builds
Every diagnostic line in the audio path used `dart:developer`'s `log()`. That function writes to the VM service, which a RELEASE build does not have — so in the only build that ever runs in a car, all eleven of them went nowhere. `debugPrint`/`print` do reach logcat in release; `log()` does not. That includes the two channels built specifically to end the guessing: - `registrarErrorAudioService`, which subscribes to `AudioService.asyncError` so the plugin's swallowed platform exceptions stop vanishing (b0271fa). It moved them from a dropped PublishSubject to a dropped log call. - `_trazarEstadoPublicado`, the published-state trace added in7054a4cto settle why the car's play button never becomes pause. So "no evidence" was never a quiet app. It was an app writing its evidence somewhere release builds discard. Several rounds of hypotheses were argued without data that the app was already producing. All eleven now use `debugPrint` with a `[PluriWave][Tag]` prefix, so one filter catches the audio path and the existing alarm lines together: adb logcat | grep PluriWave No behaviour changes. Tests: 1158, unchanged.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:ui' show Locale;
|
||||
|
||||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:flutter/foundation.dart' show visibleForTesting;
|
||||
import 'package:flutter/foundation.dart' show debugPrint, visibleForTesting;
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
|
||||
import '../l10n/display_names.dart';
|
||||
@@ -836,7 +835,14 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
/// `eqDisponible` rides along because the equalizer custom action is gated
|
||||
/// on it and the flag is otherwise unobservable — one car session answers
|
||||
/// both questions at once:
|
||||
/// adb logcat -s ServicioAudio
|
||||
///
|
||||
/// adb logcat | grep PluriWave
|
||||
///
|
||||
/// It uses [debugPrint] and NOT `dart:developer`'s `log`, and that is not a
|
||||
/// style choice. `log()` writes to the VM service, which a RELEASE build
|
||||
/// does not have — so this trace, and every error line in this file, was
|
||||
/// invisible in the only build that ever runs in a car. Weeks of "no
|
||||
/// evidence" were this, not a quiet app. Do not convert these back.
|
||||
void _trazarEstadoPublicado() {
|
||||
final s = playbackState.value;
|
||||
final traza =
|
||||
@@ -846,7 +852,7 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
'controles=${s.controls.length}';
|
||||
if (traza == _ultimaTrazaEstado) return;
|
||||
_ultimaTrazaEstado = traza;
|
||||
developer.log(traza, name: 'ServicioAudio');
|
||||
debugPrint('[PluriWave][ServicioAudio] estado $traza');
|
||||
}
|
||||
|
||||
/// Binds [construirControlesTransporte] — which holds the whole contract,
|
||||
@@ -909,11 +915,7 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
mensaje = _textos.audioErrorGeneric;
|
||||
}
|
||||
|
||||
developer.log(
|
||||
'[PluriWave] Error reproducción: $codigoLog',
|
||||
name: 'ServicioAudio',
|
||||
level: 900,
|
||||
);
|
||||
debugPrint('[PluriWave][ServicioAudio] Error reproducción: $codigoLog');
|
||||
|
||||
_detenerReconexion();
|
||||
playbackState.add(
|
||||
@@ -956,12 +958,10 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
}
|
||||
|
||||
_reconectando = true;
|
||||
developer.log(
|
||||
'[PluriWave] Stall de red, reintento ${_reconexion.intentos}/'
|
||||
debugPrint(
|
||||
'[PluriWave][ServicioAudio] Stall de red, reintento ${_reconexion.intentos}/'
|
||||
'${_reconexion.maxReintentos} en '
|
||||
'${_reconexion.retrasoParaIntento(_reconexion.intentos).inSeconds}s',
|
||||
name: 'ServicioAudio',
|
||||
level: 800,
|
||||
);
|
||||
playbackState.add(
|
||||
playbackState.value.copyWith(
|
||||
@@ -1207,11 +1207,8 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
rethrow;
|
||||
} on Exception catch (e, stackTrace) {
|
||||
_cambiandoFuente = false;
|
||||
developer.log(
|
||||
'[PluriWave] Error inesperado en playMediaItem: $e',
|
||||
name: 'ServicioAudio',
|
||||
level: 900,
|
||||
stackTrace: stackTrace,
|
||||
debugPrint(
|
||||
'[PluriWave][ServicioAudio] Error inesperado en playMediaItem: $e',
|
||||
);
|
||||
if (revision == _revisionFuente) {
|
||||
playbackState.add(
|
||||
@@ -1264,11 +1261,8 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
void _iniciarPlaySinBloquear(MediaItem mediaItem, int revision) {
|
||||
unawaited(
|
||||
_player.play().catchError((Object error, StackTrace stackTrace) {
|
||||
developer.log(
|
||||
'[PluriWave] Error al iniciar ${mediaItem.title}: $error',
|
||||
name: 'ServicioAudio',
|
||||
level: 900,
|
||||
stackTrace: stackTrace,
|
||||
debugPrint(
|
||||
'[PluriWave][ServicioAudio] Error al iniciar ${mediaItem.title}: $error',
|
||||
);
|
||||
if (revision == _revisionFuente) {
|
||||
_gestionarErrorReproduccion(error);
|
||||
@@ -1553,11 +1547,7 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
if (destino == null) return;
|
||||
await playMediaItem(mediaItemParaEmisora(destino, l10n: _textos));
|
||||
} catch (e) {
|
||||
developer.log(
|
||||
'[PluriWave] Error saltando de emisora: $e',
|
||||
name: 'ServicioAudio',
|
||||
level: 900,
|
||||
);
|
||||
debugPrint('[PluriWave][ServicioAudio] Error saltando de emisora: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1720,10 +1710,8 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
if (emisora == null) return;
|
||||
await playMediaItem(mediaItemParaEmisora(emisora, l10n: _textos));
|
||||
} catch (e) {
|
||||
developer.log(
|
||||
'[PluriWave] Error en playFromSearch($query): $e',
|
||||
name: 'ServicioAudio',
|
||||
level: 900,
|
||||
debugPrint(
|
||||
'[PluriWave][ServicioAudio] Error en playFromSearch($query): $e',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1793,10 +1781,8 @@ class PluriWaveAudioHandler extends BaseAudioHandler
|
||||
);
|
||||
} catch (e) {
|
||||
// Spec "Unknown or stale media id": never propagate from the handler.
|
||||
developer.log(
|
||||
'[PluriWave] Error en playFromMediaId($mediaId): $e',
|
||||
name: 'ServicioAudio',
|
||||
level: 900,
|
||||
debugPrint(
|
||||
'[PluriWave][ServicioAudio] Error en playFromMediaId($mediaId): $e',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user