summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-03-25 18:15:31 -0700
committerEric Laurent <elaurent@google.com>2015-03-26 18:33:19 -0700
commit4c91f90c72e74474fad7f6a99ae7926c8d1f2504 (patch)
tree8686614058927003da3349a93a87af3883df732b /services
parent84b784dd4f340331d36b1be3de05a6c814d9795c (diff)
downloadframeworks_av-4c91f90c72e74474fad7f6a99ae7926c8d1f2504.zip
frameworks_av-4c91f90c72e74474fad7f6a99ae7926c8d1f2504.tar.gz
frameworks_av-4c91f90c72e74474fad7f6a99ae7926c8d1f2504.tar.bz2
audio policy: fix DeviceVector::getDevicesFromType()
Fix device type comparison in DeviceVector::getDevicesFromType(): AUDIO_DEVICE_BIT_IN bit must be excluded from type comparison and used as an orthogonal match criterium. Change-Id: Ie7378723f5a3d613b1b045ccdda69650a9d655fc
Diffstat (limited to 'services')
-rw-r--r--services/audiopolicy/managerdefault/Devices.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/audiopolicy/managerdefault/Devices.cpp b/services/audiopolicy/managerdefault/Devices.cpp
index 13c8bbc..42e198c 100644
--- a/services/audiopolicy/managerdefault/Devices.cpp
+++ b/services/audiopolicy/managerdefault/Devices.cpp
@@ -180,10 +180,14 @@ sp<DeviceDescriptor> DeviceVector::getDeviceFromId(audio_port_handle_t id) const
DeviceVector DeviceVector::getDevicesFromType(audio_devices_t type) const
{
DeviceVector devices;
+ bool isOutput = audio_is_output_devices(type);
+ type &= ~AUDIO_DEVICE_BIT_IN;
for (size_t i = 0; (i < size()) && (type != AUDIO_DEVICE_NONE); i++) {
- if (itemAt(i)->mDeviceType & type & ~AUDIO_DEVICE_BIT_IN) {
+ bool curIsOutput = audio_is_output_devices(itemAt(i)->mDeviceType);
+ audio_devices_t curType = itemAt(i)->mDeviceType & ~AUDIO_DEVICE_BIT_IN;
+ if ((isOutput == curIsOutput) && ((type & curType) != 0)) {
devices.add(itemAt(i));
- type &= ~itemAt(i)->mDeviceType;
+ type &= ~curType;
ALOGV("DeviceVector::getDevicesFromType() for type %x found %p",
itemAt(i)->mDeviceType, itemAt(i).get());
}