diff options
author | Karthik Reddy Katta <a_katta@codeaurora.org> | 2015-09-09 19:56:52 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:25:02 -0600 |
commit | c40106ff12387a155eed450726828c0a7e1f002c (patch) | |
tree | 5cb8606567832a5dd062c3fd6505ce8526b01401 /services/audiopolicy/managerdefault | |
parent | 14154955cac023afd736dc658d06a27f31f68e1c (diff) | |
download | frameworks_av-c40106ff12387a155eed450726828c0a7e1f002c.zip frameworks_av-c40106ff12387a155eed450726828c0a7e1f002c.tar.gz frameworks_av-c40106ff12387a155eed450726828c0a7e1f002c.tar.bz2 |
audiopolicy: fix for voice call to work on USB headset during concurrency
When an input stream is active on USB headset and if a voice call
is received, the proxy_open() for voice call fails and the screen freezes.
All active inputs must be closed before opening input stream for
voice call and also all new requests to open input stream must be
blocked.
Change-Id: I3fb0d482a77495ff6fe9fcdc8a1f8915ade52c9a
CRs-fixed: 876993
Diffstat (limited to 'services/audiopolicy/managerdefault')
-rw-r--r-- | services/audiopolicy/managerdefault/AudioPolicyManager.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp index 4d9dbfe..8618b08 100644 --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp @@ -351,6 +351,14 @@ void AudioPolicyManager::updateCallRouting(audio_devices_t rxDevice, int delayMs AUDIO_OUTPUT_FLAG_NONE, AUDIO_FORMAT_INVALID); if (output != AUDIO_IO_HANDLE_NONE) { + // close active input (if any) before opening new input + audio_io_handle_t activeInput = mInputs.getActiveInput(); + if (activeInput != 0) { + ALOGV("updateCallRouting() close active input before opening new input"); + sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput); + stopInput(activeInput, activeDesc->mSessions.itemAt(0)); + releaseInput(activeInput, activeDesc->mSessions.itemAt(0)); + } sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output); ALOG_ASSERT(!outputDesc->isDuplicated(), "updateCallRouting() RX device output is duplicated"); @@ -1336,6 +1344,12 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr, ALOGW("getInputForAttr() could not find device for source %d", inputSource); return BAD_VALUE; } + // block request to open input on USB during voice call + if((AUDIO_MODE_IN_CALL == mEngine->getPhoneState()) && + (device == AUDIO_DEVICE_IN_USB_DEVICE)) { + ALOGV("getInputForAttr(): blocking the request to open input on USB device"); + return BAD_VALUE; + } if (policyMix != NULL) { address = policyMix->mRegistrationId; if (policyMix->mMixType == MIX_TYPE_RECORDERS) { |