summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-09-25 12:21:06 -0700
committerEric Laurent <elaurent@google.com>2015-10-15 09:48:06 -0700
commitc171c7c47d099a52ade95c3c8d8907bf09bb88fa (patch)
tree1d3aa7df5d0e1a5458efdcadb7748efd76a3e5ae /services/audiopolicy
parent036b6593eec6ced2f34293e8407f1cb86ae1e75f (diff)
downloadframeworks_av-c171c7c47d099a52ade95c3c8d8907bf09bb88fa.zip
frameworks_av-c171c7c47d099a52ade95c3c8d8907bf09bb88fa.tar.gz
frameworks_av-c171c7c47d099a52ade95c3c8d8907bf09bb88fa.tar.bz2
audio policy: fix USB mic selection for VoIP
When transitioning from speaker phone to normal mode and a USB headset is connected, we must force a teardown of active input as the new input device cannot be reached via current input stream. Bug: 24406915. Change-Id: I9f7c1d3f3cba285c25a6da1d54a3d15a5c1f378a
Diffstat (limited to 'services/audiopolicy')
-rw-r--r--services/audiopolicy/managerdefault/AudioPolicyManager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 8419ed5..aa4486d 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -566,9 +566,15 @@ void AudioPolicyManager::setForceUse(audio_policy_force_use_t usage,
audio_io_handle_t activeInput = mInputs.getActiveInput();
if (activeInput != 0) {
- setInputDevice(activeInput, getNewInputDevice(activeInput));
+ sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput);
+ audio_devices_t newDevice = getNewInputDevice(activeInput);
+ // Force new input selection if the new device can not be reached via current input
+ if (activeDesc->mProfile->mSupportedDevices.types() & (newDevice & ~AUDIO_DEVICE_BIT_IN)) {
+ setInputDevice(activeInput, newDevice);
+ } else {
+ closeInput(activeInput);
+ }
}
-
}
void AudioPolicyManager::setSystemProperty(const char* property, const char* value)