diff options
author | Eric Laurent <elaurent@google.com> | 2014-12-24 18:57:46 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-24 18:57:46 +0000 |
commit | b915a420a6a205d30c0181d3fc13078fc6d37a3c (patch) | |
tree | 743d38720da9d490f821f2897af978768b9c7cf2 /services/audiopolicy | |
parent | af318e2882e0b8b1a594f079eb3d10b2daa3ff7e (diff) | |
parent | 572216352498c702651567b3b299a1f7ed725429 (diff) | |
download | frameworks_av-b915a420a6a205d30c0181d3fc13078fc6d37a3c.zip frameworks_av-b915a420a6a205d30c0181d3fc13078fc6d37a3c.tar.gz frameworks_av-b915a420a6a205d30c0181d3fc13078fc6d37a3c.tar.bz2 |
am 57221635: am 5886252a: Merge "audio policy: fix isSourceActive() for hotword" into lmp-mr1-dev
* commit '572216352498c702651567b3b299a1f7ed725429':
audio policy: fix isSourceActive() for hotword
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index be7158f..34c677c 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -2055,12 +2055,23 @@ bool AudioPolicyManager::isSourceActive(audio_source_t source) const { for (size_t i = 0; i < mInputs.size(); i++) { const sp<AudioInputDescriptor> inputDescriptor = mInputs.valueAt(i); - if ((inputDescriptor->mInputSource == (int)source || - (source == AUDIO_SOURCE_VOICE_RECOGNITION && - inputDescriptor->mInputSource == AUDIO_SOURCE_HOTWORD)) - && (inputDescriptor->mRefCount > 0)) { + if (inputDescriptor->mRefCount == 0) { + continue; + } + if (inputDescriptor->mInputSource == (int)source) { return true; } + // AUDIO_SOURCE_HOTWORD is equivalent to AUDIO_SOURCE_VOICE_RECOGNITION only if it + // corresponds to an active capture triggered by a hardware hotword recognition + if ((source == AUDIO_SOURCE_VOICE_RECOGNITION) && + (inputDescriptor->mInputSource == AUDIO_SOURCE_HOTWORD)) { + // FIXME: we should not assume that the first session is the active one and keep + // activity count per session. Same in startInput(). + ssize_t index = mSoundTriggerSessions.indexOfKey(inputDescriptor->mSessions.itemAt(0)); + if (index >= 0) { + return true; + } + } } return false; } @@ -5296,7 +5307,7 @@ uint32_t AudioPolicyManager::activeInputsCount() const for (size_t i = 0; i < mInputs.size(); i++) { const sp<AudioInputDescriptor> desc = mInputs.valueAt(i); if (desc->mRefCount > 0) { - return count++; + count++; } } return count; |