Matthias Nott
2026-06-11 d9227bf2860a6f23ab89d8e7e0d7a9bf448d0adf
fix(audio): don't treat AppLifecycleState.inactive as backgrounded

inactive is a transient state — on Android it fires during MQTT push wake-up,
system dialogs, and app-switcher previews while the app is still visible. By
flipping _isBackgrounded=true on inactive, the auto-play gate in
_handleIncomingVoice silently skipped incoming voice messages on Android even
when the user was viewing the matching session. Only paused/detached should
mark backgrounded; leave inactive alone so the real edge governs.
1 files modified
changed files
lib/services/audio_service.dart patch | view | blame | history
lib/services/audio_service.dart
....@@ -285,11 +285,15 @@
285285 void didChangeAppLifecycleState(AppLifecycleState state) {
286286 switch (state) {
287287 case AppLifecycleState.paused:
288
- case AppLifecycleState.inactive:
289288 case AppLifecycleState.detached:
290289 AudioService._isBackgrounded = true;
291290 case AppLifecycleState.resumed:
292291 AudioService._isBackgrounded = false;
292
+ // AppLifecycleState.inactive is transient (Android push wake-up, system
293
+ // dialogs, app switcher preview) — the app is still visible. Treating it
294
+ // as backgrounded silently blocked auto-play of incoming voice on Android,
295
+ // where `inactive` fires more often around MQTT push delivery. Leave the
296
+ // current value untouched so a real paused/resumed edge governs it.
293297 default:
294298 break;
295299 }