summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-11-13 15:13:44 -0800
committerJean-Michel Trivi <jmtrivi@google.com>2014-11-17 00:19:32 +0000
commitddbc6657fa0c55166148ca597980edbaafc418bf (patch)
tree4d8439693a03c04b9d4ab8fc5cf3ef5785a3d4ef /services
parente0b7ddcda9b4fb493cc365c92293ed7d12c3208a (diff)
downloadframeworks_av-ddbc6657fa0c55166148ca597980edbaafc418bf.zip
frameworks_av-ddbc6657fa0c55166148ca597980edbaafc418bf.tar.gz
frameworks_av-ddbc6657fa0c55166148ca597980edbaafc418bf.tar.bz2
audiopolicy: Update input device check in checkInputsForDevice
- When an input device is disconnected, checkInputsForDevice clears dynamic fields of input profiles that are supporting the disconnected device. AUDIO_DEVICE_BIT_IN mask is missing while comparing with the supported input devices of a profile which is resulting in clearing wrong fields - Fix is to include AUDIO_DEVICE_BIT_IN in this comparison - also fix two other places where comparison with input device was not masked with AUDIO_DEVICE_BIT_IN. Bug: 18367045 Change-Id: Icc94b8353bc49567d8a6d6a75293c3b0dd42d83c
Diffstat (limited to 'services')
-rw-r--r--services/audiopolicy/AudioPolicyManager.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index 584e170..fff7746 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -3563,7 +3563,8 @@ status_t AudioPolicyManager::checkInputsForDevice(audio_devices_t device,
// check if one opened input is not needed any more after disconnecting one device
for (size_t input_index = 0; input_index < mInputs.size(); input_index++) {
desc = mInputs.valueAt(input_index);
- if (!(desc->mProfile->mSupportedDevices.types() & mAvailableInputDevices.types())) {
+ if (!(desc->mProfile->mSupportedDevices.types() & mAvailableInputDevices.types() &
+ ~AUDIO_DEVICE_BIT_IN)) {
ALOGV("checkInputsForDevice(): disconnecting adding input %d",
mInputs.keyAt(input_index));
inputs.add(mInputs.keyAt(input_index));
@@ -3578,7 +3579,7 @@ status_t AudioPolicyManager::checkInputsForDevice(audio_devices_t device,
profile_index < mHwModules[module_index]->mInputProfiles.size();
profile_index++) {
sp<IOProfile> profile = mHwModules[module_index]->mInputProfiles[profile_index];
- if (profile->mSupportedDevices.types() & device) {
+ if (profile->mSupportedDevices.types() & device & ~AUDIO_DEVICE_BIT_IN) {
ALOGV("checkInputsForDevice(): clearing direct input profile %zu on module %zu",
profile_index, module_index);
if (profile->mSamplingRates[0] == 0) {
@@ -3795,7 +3796,9 @@ void AudioPolicyManager::checkA2dpSuspend()
}
bool isScoConnected =
- (mAvailableInputDevices.types() & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) != 0;
+ ((mAvailableInputDevices.types() & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET &
+ ~AUDIO_DEVICE_BIT_IN) != 0) ||
+ ((mAvailableOutputDevices.types() & AUDIO_DEVICE_OUT_ALL_SCO) != 0);
// suspend A2DP output if:
// (NOT already suspended) &&
// ((SCO device is connected &&