From da28a37be819fc61b41eeafd8cc9428f6518d5d7 Mon Sep 17 00:00:00 2001 From: zhanhang Date: Fri, 3 Nov 2023 18:16:59 +0800 Subject: [PATCH] When adjusting the volume using buttons or settings, only adjust for the music stream Signed-off-by: zhanhang --- .../audio_policy/server/src/service/audio_policy_service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 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 eff6ea2540..a0002e262e 100644 --- a/services/audio_policy/server/src/service/audio_policy_service.cpp +++ b/services/audio_policy/server/src/service/audio_policy_service.cpp @@ -235,7 +235,7 @@ int32_t AudioPolicyService::SetSystemVolumeLevel(AudioStreamType streamType, int int32_t result = SUCCESS; // if current active device's type is DEVICE_TYPE_BLUETOOTH_A2DP and it support absolute volume, set // its absolute volume value. - if (currentActiveDevice_.deviceType_ == DEVICE_TYPE_BLUETOOTH_A2DP) { + if (streamType == STREAM_MUSIC && currentActiveDevice_.deviceType_ == DEVICE_TYPE_BLUETOOTH_A2DP) { result = SetA2dpDeviceVolume(activeBTDevice_, volumeLevel); if (result == SUCCESS) { // set to avrcp device @@ -318,7 +318,7 @@ int32_t AudioPolicyService::GetSystemVolumeLevel(AudioStreamType streamType, boo // if current active device's type is DEVICE_TYPE_BLUETOOTH_A2DP and it support absolute volume, get // its absolute volume value. std::lock_guard lock(a2dpDeviceMapMutex_); - if (currentActiveDevice_.deviceType_ == DEVICE_TYPE_BLUETOOTH_A2DP) { + if (streamType == STREAM_MUSIC && currentActiveDevice_.deviceType_ == DEVICE_TYPE_BLUETOOTH_A2DP) { auto configInfoPos = connectedA2dpDeviceMap_.find(activeBTDevice_); if (configInfoPos != connectedA2dpDeviceMap_.end() && configInfoPos->second.absVolumeSupport) { -- Gitee