audiopolicy: Brush up DeviceVector::getDevice... methods
The semantics of these methods wasn't consistent and wasn't clear
from their names (and aggravated by the fact that audio_devices_t can
be used either as a single device, or as a mask):
* sp<DeviceDescriptor> getDevice(type, address) -- 'type' is a single
device; if 'address' is an empty string, and no matching device
with an empty address is found, returns any device of this type;
* DeviceVector getDevicesFromType(type) -- 'type' is a mask,
device addresses get ignored;
* DeviceVector getDevicesFromTypeAddr(type, address) -- 'type' is
a single device, address is matched exactly. So in practice, only
1 device could be returned.
Changes:
* 'getDevicesFromType' renamed to 'getDevicesFromTypeMask' --
emhpasizes the fact that 'type' can be a mask;
* 'getDevicesFromTypeAddr' removed, usages replaced with a call to
'getDevice'. There were just 2 usages, and their intent seem
to be covered by the semantics of 'getDevice'.
Test: verified basic audio functionality and Auto with simulator
Change-Id: If3e42e4c06f42573fd33ba1303febe0625e079e6
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 3e13e50..007eea0 100644
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -482,7 +482,7 @@
}
}
availableOutputDevices =
- availableOutputDevices.getDevicesFromType(availableOutputDevicesType);
+ availableOutputDevices.getDevicesFromTypeMask(availableOutputDevicesType);
if (outputs.isStreamActive(AUDIO_STREAM_RING) ||
outputs.isStreamActive(AUDIO_STREAM_ALARM)) {
return getDeviceForStrategyInt(