audiopolicy: fix ring stream volume cannot apply when previewing ringtone
Using AUDIO_DEVICE_OUT_SPEAKER to replace AUDIO_DEVICE_OUT_SPEAKER_SAFE
for device match.
Bug: 129456342
Test: volume can adjust while previewing ringtone
Change-Id: I3015f811ac6d2e3f3cdd606f453348c4bc526935
Signed-off-by: Robert Lee <lerobert@google.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index bd53f0f..9582daf 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -2463,6 +2463,11 @@
sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i);
audio_devices_t curDevice = desc->devices().types();
+ if (curDevice & AUDIO_DEVICE_OUT_SPEAKER_SAFE) {
+ curDevice |= AUDIO_DEVICE_OUT_SPEAKER;
+ curDevice &= ~AUDIO_DEVICE_OUT_SPEAKER_SAFE;
+ }
+
// Inter / intra volume group priority management: Loop on strategies arranged by priority
// If a higher priority strategy is active, and the output is routed to a device with a
// HW Gain management, do not change the volume