From d9227bf2860a6f23ab89d8e7e0d7a9bf448d0adf Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Thu, 11 Jun 2026 09:50:29 +0200
Subject: [PATCH] fix(audio): don't treat AppLifecycleState.inactive as backgrounded

---
 lib/services/audio_service.dart |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/services/audio_service.dart b/lib/services/audio_service.dart
index a547e6f..f8ab743 100644
--- a/lib/services/audio_service.dart
+++ b/lib/services/audio_service.dart
@@ -285,11 +285,15 @@
   void didChangeAppLifecycleState(AppLifecycleState state) {
     switch (state) {
       case AppLifecycleState.paused:
-      case AppLifecycleState.inactive:
       case AppLifecycleState.detached:
         AudioService._isBackgrounded = true;
       case AppLifecycleState.resumed:
         AudioService._isBackgrounded = false;
+      // AppLifecycleState.inactive is transient (Android push wake-up, system
+      // dialogs, app switcher preview) — the app is still visible. Treating it
+      // as backgrounded silently blocked auto-play of incoming voice on Android,
+      // where `inactive` fires more often around MQTT push delivery. Leave the
+      // current value untouched so a real paused/resumed edge governs it.
       default:
         break;
     }

--
Gitblit v1.3.1