From 24cc74d93c04010cc3c133a028c625ac435e16a0 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Sun, 12 Apr 2026 17:40:44 +0400 Subject: [PATCH] fix(audio): clear BT SCO communication device on call end Without clearCommunicationDevice(), the BT headset stays locked in SCO mode after the call. Media playback (video, music) can't route to BT A2DP, requiring a device reboot to restore normal audio. Co-Authored-By: Claude Opus 4.6 (1M context) --- desktop/src-tauri/src/engine.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/desktop/src-tauri/src/engine.rs b/desktop/src-tauri/src/engine.rs index 984550f..fa5bf2b 100644 --- a/desktop/src-tauri/src/engine.rs +++ b/desktop/src-tauri/src/engine.rs @@ -1500,9 +1500,14 @@ impl CallEngine { #[cfg(target_os = "android")] { crate::wzp_native::audio_stop(); - // Restore MODE_NORMAL so other apps' audio (music, etc.) - // routes normally again. Without this, the system stays in - // communication mode and BT A2DP music goes to earpiece. + // Release the BT SCO communication device so Android can + // route media (video, music) back to BT A2DP. Without this, + // setCommunicationDevice locks BT to SCO mode and other apps + // can't use the headset for media playback until reboot. + if let Err(e) = crate::android_audio::stop_bluetooth_sco() { + tracing::warn!("stop_bluetooth_sco on call end failed: {e}"); + } + // Restore MODE_NORMAL so other apps' audio routes normally. if let Err(e) = crate::android_audio::set_audio_mode_normal() { tracing::warn!("set_audio_mode_normal failed: {e}"); }