diff options
author | Eric Laurent <elaurent@google.com> | 2015-03-30 18:59:03 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2015-03-31 15:47:09 +0000 |
commit | 424314382b6e2064df1c7c445038a11104be84c7 (patch) | |
tree | 095ad0c7a005c20887665ee5ec243e692bac6834 /services/audiopolicy | |
parent | c42c4b526422fada02f3522a08143f738e9e60af (diff) | |
download | frameworks_av-424314382b6e2064df1c7c445038a11104be84c7.zip frameworks_av-424314382b6e2064df1c7c445038a11104be84c7.tar.gz frameworks_av-424314382b6e2064df1c7c445038a11104be84c7.tar.bz2 |
DO NOT MERGE - 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.
Manual cherry-pick from master 4c91f90
Bug: 19957479
Change-Id: Ica9f440384bcb85e669864bd29504a4fda862ce7
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 7f27659..6ebd0ed 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -7635,10 +7635,14 @@ AudioPolicyManager::DeviceVector AudioPolicyManager::DeviceVector::getDevicesFro 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()); } |