diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-07 18:45:35 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-07 18:45:35 -0800 |
commit | 697a7ab8c538ca84a92b605e50824da1cbf9b466 (patch) | |
tree | fe32b5c0b8e0fa115cd6358c5428b8a48e285dec /services/audiopolicy | |
parent | 7f8512331f105565054202486fa0a6094ad693c1 (diff) | |
parent | 5dc9ffe50ef517591b8ffad66c7e4d6ec82b8b4b (diff) | |
download | frameworks_av-697a7ab8c538ca84a92b605e50824da1cbf9b466.zip frameworks_av-697a7ab8c538ca84a92b605e50824da1cbf9b466.tar.gz frameworks_av-697a7ab8c538ca84a92b605e50824da1cbf9b466.tar.bz2 |
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/frameworks/av into cm-13.0
Android 6.0.1 release 3
Change-Id: I2f2a1fe1b58c828e8341556996211562d6e195ab
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/managerdefault/AudioPolicyManager.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp index 45efbe1..598edfc 100644 --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp @@ -442,6 +442,20 @@ void AudioPolicyManager::updateCallRouting(audio_devices_t rxDevice, int delayMs patch.num_sources = 2; } + // terminate active capture if on the same HW module as the call TX source device + // FIXME: would be better to refine to only inputs whose profile connects to the + // call TX device but this information is not in the audio patch and logic here must be + // symmetric to the one in startInput() + audio_io_handle_t activeInput = mInputs.getActiveInput(); + if (activeInput != 0) { + sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput); + if (activeDesc->getModuleHandle() == txSourceDeviceDesc->getModuleHandle()) { + audio_session_t activeSession = activeDesc->mSessions.itemAt(0); + stopInput(activeInput, activeSession); + releaseInput(activeInput, activeSession); + } + } + afPatchHandle = AUDIO_PATCH_HANDLE_NONE; status = mpClientInterface->createAudioPatch(&patch, &afPatchHandle, 0); ALOGW_IF(status != NO_ERROR, "setPhoneState() error %d creating TX audio patch", @@ -606,9 +620,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) @@ -1547,6 +1567,15 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input, return INVALID_OPERATION; } } + + // Do not allow capture if an active voice call is using a software patch and + // the call TX source device is on the same HW module. + // FIXME: would be better to refine to only inputs whose profile connects to the + // call TX device but this information is not in the audio patch + if (mCallTxPatch != 0 && + inputDesc->getModuleHandle() == mCallTxPatch->mPatch.sources[0].ext.device.hw_module) { + return INVALID_OPERATION; + } } // Routing? |