summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-10-14 14:36:34 -0700
committerEric Laurent <elaurent@google.com>2015-10-15 10:53:32 -0700
commitc0a889f766953b657a5e997bc1362661806d3a19 (patch)
treefb0a2248a68bf20df0adfccf4cdcc7dce2c5d6b0 /services
parent0926aab4b8d5d307c95788086090e8d2b2763f1f (diff)
downloadframeworks_av-c0a889f766953b657a5e997bc1362661806d3a19.zip
frameworks_av-c0a889f766953b657a5e997bc1362661806d3a19.tar.gz
frameworks_av-c0a889f766953b657a5e997bc1362661806d3a19.tar.bz2
audio policy: fix transition from VoIP to voice call on USB
Make sure no active capture takes place while in call and the capture device is the same as the call TX device. Bug: 23977713. Change-Id: Ia379d5e626c150ea49f0cdd581c881dbf0b8399d
Diffstat (limited to 'services')
-rw-r--r--services/audiopolicy/managerdefault/AudioPolicyManager.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index aa4486d..5ff1c0b 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -402,6 +402,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",
@@ -1505,6 +1519,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?