From e454fd9e50f7bbec7dbc948688561a58226667c3 Mon Sep 17 00:00:00 2001 From: zhuchaochao Date: Sat, 28 Oct 2023 06:30:40 +0000 Subject: [PATCH] fix bug of bluetooth switch to usb Signed-off-by: zhuchaochao Change-Id: Ica3c837ff56caf0ba0f6c0448806b4ea902f5d18 --- .../src/service/audio_policy_service.cpp | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/services/audio_policy/server/src/service/audio_policy_service.cpp b/services/audio_policy/server/src/service/audio_policy_service.cpp index 81c8324813..ec99105ebf 100644 --- a/services/audio_policy/server/src/service/audio_policy_service.cpp +++ b/services/audio_policy/server/src/service/audio_policy_service.cpp @@ -1736,19 +1736,27 @@ int32_t AudioPolicyService::ActivateNewDevice(DeviceType deviceType, bool isScen return result; } } - - if (deviceType == DEVICE_TYPE_BLUETOOTH_A2DP || currentActiveDevice_.deviceType_ == DEVICE_TYPE_BLUETOOTH_A2DP) { + if (deviceType == DEVICE_TYPE_BLUETOOTH_A2DP) { result = HandleA2dpDevice(deviceType); return result; } - - if (isArmUsbDevice_ && - (deviceType == DEVICE_TYPE_USB_HEADSET || currentActiveDevice_.deviceType_ == DEVICE_TYPE_USB_HEADSET)) { + if (isArmUsbDevice_ && deviceType == DEVICE_TYPE_USB_HEADSET ) { result = HandleArmUsbDevice(deviceType); return result; } - - if (deviceType == DEVICE_TYPE_FILE_SINK || currentActiveDevice_.deviceType_ == DEVICE_TYPE_FILE_SINK) { + if (deviceType == DEVICE_TYPE_FILE_SINK ) { + result = HandleFileDevice(deviceType); + return result; + } + if (currentActiveDevice_.deviceType_ == DEVICE_TYPE_BLUETOOTH_A2DP) { + result = HandleA2dpDevice(deviceType); + return result; + } + if (isArmUsbDevice_ && currentActiveDevice_.deviceType_ == DEVICE_TYPE_USB_HEADSET) { + result = HandleArmUsbDevice(deviceType); + return result; + } + if (currentActiveDevice_.deviceType_ == DEVICE_TYPE_FILE_SINK) { result = HandleFileDevice(deviceType); return result; } -- Gitee