diff --git a/android/app/src/main/kotlin/es/freetimelab/pluriwave/RecursosResueltosPorNombre.kt b/android/app/src/main/kotlin/es/freetimelab/pluriwave/RecursosResueltosPorNombre.kt new file mode 100644 index 0000000..c520308 --- /dev/null +++ b/android/app/src/main/kotlin/es/freetimelab/pluriwave/RecursosResueltosPorNombre.kt @@ -0,0 +1,44 @@ +package es.freetimelab.pluriwave + +/** + * Anchors the drawables that only Dart names, so the Android build cannot + * decide they are unused. + * + * These icons are handed to `audio_service` as plain strings + * (`MediaControl.custom(androidIcon: 'drawable/ic_auto_eq_on')`) and resolved + * at runtime through `getResources().getIdentifier(...)`. Nothing on the + * Android side of the build ever mentions them, so as far as the resource + * pipeline is concerned they are dead weight — and they were dropped from + * every release APK. + * + * The damage was not a missing icon. `getResourceId` returns 0 for a name it + * cannot find, `PlaybackStateCompat.CustomAction.Builder` throws on a 0 icon, + * and that throw aborts `AudioService.setState` before the media session is + * ever activated. Android Auto was left holding a frozen, inactive session: + * dead playback screen, a play button that never became pause, the app losing + * its pane to whichever app did have a live session, and audio that played + * "as if it were not the app". One absent file, four symptoms, from 31 July + * (commit 2540556) until this. + * + * Verified rather than assumed. Pulling the installed APK off the device and + * reading its resource table showed `ic_stat_pluriwave` present and both + * equalizer icons absent — and `ic_stat_pluriwave` is the one drawable of the + * three that Kotlin references directly (`R.drawable.ic_stat_pluriwave`, four + * call sites across the alarm notifications). That contrast is the whole + * diagnosis: a real `R.drawable` reference survives, a name that exists only + * inside a Dart string does not. + * + * So this object is not defensive tidiness — it is the reference that was + * missing. Any future drawable that Dart resolves by name must be added here + * AND to the resource guard in `.gitea/workflows/build.yml`, which reads the + * built APK's resource table and fails the build if one of them is gone. + */ +@Suppress("unused") +internal object RecursosResueltosPorNombre { + val anclados: IntArray = + intArrayOf( + R.drawable.ic_auto_eq_on, + R.drawable.ic_auto_eq_off, + R.drawable.ic_stat_pluriwave, + ) +} diff --git a/android/app/src/main/res/raw/keep.xml b/android/app/src/main/res/raw/keep.xml new file mode 100644 index 0000000..8774827 --- /dev/null +++ b/android/app/src/main/res/raw/keep.xml @@ -0,0 +1,33 @@ + + +