Merge "audio policy: fix volume for unsupported device" into rvc-dev
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index aaa28bc..d5272bc 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -152,10 +152,16 @@
bool AudioOutputDescriptor::setVolume(float volumeDb,
VolumeSource volumeSource,
const StreamTypeVector &/*streams*/,
- const DeviceTypeSet& /*deviceTypes*/,
+ const DeviceTypeSet& deviceTypes,
uint32_t delayMs,
bool force)
{
+
+ if (!supportedDevices().containsDeviceAmongTypes(deviceTypes)) {
+ ALOGV("%s output ID %d unsupported device %s",
+ __func__, getId(), toString(deviceTypes).c_str());
+ return false;
+ }
// We actually change the volume if:
// - the float value returned by computeVolume() changed
// - the force flag is set