Loading services/audiopolicy/service/AudioPolicyService.cpp +32 −13 Original line number Diff line number Diff line Loading @@ -416,6 +416,11 @@ void AudioPolicyService::updateUidStates_l() // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // OR The client is an accessibility service // AND Is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD // OR The assistant is not on TOP // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // AND is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD // OR the client source is virtual (remote submix, call audio TX or RX...) Loading Loading @@ -460,7 +465,8 @@ void AudioPolicyService::updateUidStates_l() } bool isAssistant = mUidPolicy->isAssistantUid(current->uid); if (appState == APP_STATE_TOP) { bool isAccessibility = mUidPolicy->isA11yUid(current->uid); if (appState == APP_STATE_TOP && !isAccessibility) { if (current->startTimeNs > topStartNs) { topActive = current; topStartNs = current->startTimeNs; Loading @@ -469,10 +475,13 @@ void AudioPolicyService::updateUidStates_l() isAssistantOnTop = true; } } // Assistant capturing for HOTWORD not considered for latest active to avoid // masking regular clients started before if (current->startTimeNs > latestStartNs && !(current->attributes.source == AUDIO_SOURCE_HOTWORD && isAssistant)) { // Assistant capturing for HOTWORD or Accessibility services not considered // for latest active to avoid masking regular clients started before if (current->startTimeNs > latestStartNs && !((current->attributes.source == AUDIO_SOURCE_HOTWORD || isA11yOnTop || rttCallActive) && isAssistant) && !isAccessibility) { latestActive = current; latestStartNs = current->startTimeNs; } Loading Loading @@ -546,10 +555,20 @@ void AudioPolicyService::updateUidStates_l() // For accessibility service allow capture if: // Is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD if (isA11yOnTop && (source == AUDIO_SOURCE_VOICE_RECOGNITION || source == AUDIO_SOURCE_HOTWORD)) { // Or // The assistant is not on TOP // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission if (isA11yOnTop) { if (source == AUDIO_SOURCE_VOICE_RECOGNITION || source == AUDIO_SOURCE_HOTWORD) { allowCapture = true; } } else { if (!isAssistantOnTop && (!(isSensitiveActive || isInCall) || current->canCaptureOutput)) { allowCapture = true; } } } setAppState_l(current->uid, allowCapture ? apmStatFromAmState(mUidPolicy->getUidState(current->uid)) : Loading Loading
services/audiopolicy/service/AudioPolicyService.cpp +32 −13 Original line number Diff line number Diff line Loading @@ -416,6 +416,11 @@ void AudioPolicyService::updateUidStates_l() // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // OR The client is an accessibility service // AND Is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD // OR The assistant is not on TOP // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // AND is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD // OR the client source is virtual (remote submix, call audio TX or RX...) Loading Loading @@ -460,7 +465,8 @@ void AudioPolicyService::updateUidStates_l() } bool isAssistant = mUidPolicy->isAssistantUid(current->uid); if (appState == APP_STATE_TOP) { bool isAccessibility = mUidPolicy->isA11yUid(current->uid); if (appState == APP_STATE_TOP && !isAccessibility) { if (current->startTimeNs > topStartNs) { topActive = current; topStartNs = current->startTimeNs; Loading @@ -469,10 +475,13 @@ void AudioPolicyService::updateUidStates_l() isAssistantOnTop = true; } } // Assistant capturing for HOTWORD not considered for latest active to avoid // masking regular clients started before if (current->startTimeNs > latestStartNs && !(current->attributes.source == AUDIO_SOURCE_HOTWORD && isAssistant)) { // Assistant capturing for HOTWORD or Accessibility services not considered // for latest active to avoid masking regular clients started before if (current->startTimeNs > latestStartNs && !((current->attributes.source == AUDIO_SOURCE_HOTWORD || isA11yOnTop || rttCallActive) && isAssistant) && !isAccessibility) { latestActive = current; latestStartNs = current->startTimeNs; } Loading Loading @@ -546,10 +555,20 @@ void AudioPolicyService::updateUidStates_l() // For accessibility service allow capture if: // Is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD if (isA11yOnTop && (source == AUDIO_SOURCE_VOICE_RECOGNITION || source == AUDIO_SOURCE_HOTWORD)) { // Or // The assistant is not on TOP // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission if (isA11yOnTop) { if (source == AUDIO_SOURCE_VOICE_RECOGNITION || source == AUDIO_SOURCE_HOTWORD) { allowCapture = true; } } else { if (!isAssistantOnTop && (!(isSensitiveActive || isInCall) || current->canCaptureOutput)) { allowCapture = true; } } } setAppState_l(current->uid, allowCapture ? apmStatFromAmState(mUidPolicy->getUidState(current->uid)) : Loading