Loading services/audiopolicy/service/AudioPolicyService.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -422,12 +422,18 @@ void AudioPolicyService::updateUidStates_l() // 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...) // OR the client source is HOTWORD // AND is on TOP // OR all active clients are using HOTWORD source // AND no call is active // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // OR Any client // AND The assistant is not on TOP // AND is on TOP or latest started // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission sp<AudioRecordClient> topActive; sp<AudioRecordClient> latestActive; sp<AudioRecordClient> latestSensitiveActive; Loading @@ -442,6 +448,7 @@ void AudioPolicyService::updateUidStates_l() bool rttCallActive = (mPhoneState == AUDIO_MODE_IN_CALL || mPhoneState == AUDIO_MODE_IN_COMMUNICATION) && mUidPolicy->isRttEnabled(); bool onlyHotwordActive = true; // if Sensor Privacy is enabled then all recordings should be silenced. if (mSensorPrivacyPolicy->isSensorPrivacyEnabled()) { Loading Loading @@ -473,12 +480,11 @@ void AudioPolicyService::updateUidStates_l() isAssistantOnTop = true; } } // Assistant capturing for HOTWORD or Accessibility services not considered // Client 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) && !(current->attributes.source == AUDIO_SOURCE_HOTWORD || ((isA11yOnTop || rttCallActive) && isAssistant)) && !isAccessibility) { latestActive = current; latestStartNs = current->startTimeNs; Loading @@ -490,6 +496,9 @@ void AudioPolicyService::updateUidStates_l() } isSensitiveActive = true; } if (current->attributes.source != AUDIO_SOURCE_HOTWORD) { onlyHotwordActive = false; } } // if no active client with UI on Top, consider latest active as top Loading Loading @@ -556,6 +565,14 @@ void AudioPolicyService::updateUidStates_l() allowCapture = true; } } } else if (source == AUDIO_SOURCE_HOTWORD) { // For HOTWORD source allow capture when not on TOP if: // All active clients are using HOTWORD source // AND no call is active // OR client has CAPTURE_AUDIO_OUTPUT privileged permission if (onlyHotwordActive && !(isInCall && !current->canCaptureOutput)) { allowCapture = true; } } setAppState_l(current->portId, allowCapture ? apmStatFromAmState(mUidPolicy->getUidState(current->uid)) : Loading Loading
services/audiopolicy/service/AudioPolicyService.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -422,12 +422,18 @@ void AudioPolicyService::updateUidStates_l() // 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...) // OR the client source is HOTWORD // AND is on TOP // OR all active clients are using HOTWORD source // AND no call is active // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // OR Any client // AND The assistant is not on TOP // AND is on TOP or latest started // AND there is no active privacy sensitive capture or call // OR client has CAPTURE_AUDIO_OUTPUT privileged permission sp<AudioRecordClient> topActive; sp<AudioRecordClient> latestActive; sp<AudioRecordClient> latestSensitiveActive; Loading @@ -442,6 +448,7 @@ void AudioPolicyService::updateUidStates_l() bool rttCallActive = (mPhoneState == AUDIO_MODE_IN_CALL || mPhoneState == AUDIO_MODE_IN_COMMUNICATION) && mUidPolicy->isRttEnabled(); bool onlyHotwordActive = true; // if Sensor Privacy is enabled then all recordings should be silenced. if (mSensorPrivacyPolicy->isSensorPrivacyEnabled()) { Loading Loading @@ -473,12 +480,11 @@ void AudioPolicyService::updateUidStates_l() isAssistantOnTop = true; } } // Assistant capturing for HOTWORD or Accessibility services not considered // Client 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) && !(current->attributes.source == AUDIO_SOURCE_HOTWORD || ((isA11yOnTop || rttCallActive) && isAssistant)) && !isAccessibility) { latestActive = current; latestStartNs = current->startTimeNs; Loading @@ -490,6 +496,9 @@ void AudioPolicyService::updateUidStates_l() } isSensitiveActive = true; } if (current->attributes.source != AUDIO_SOURCE_HOTWORD) { onlyHotwordActive = false; } } // if no active client with UI on Top, consider latest active as top Loading Loading @@ -556,6 +565,14 @@ void AudioPolicyService::updateUidStates_l() allowCapture = true; } } } else if (source == AUDIO_SOURCE_HOTWORD) { // For HOTWORD source allow capture when not on TOP if: // All active clients are using HOTWORD source // AND no call is active // OR client has CAPTURE_AUDIO_OUTPUT privileged permission if (onlyHotwordActive && !(isInCall && !current->canCaptureOutput)) { allowCapture = true; } } setAppState_l(current->portId, allowCapture ? apmStatFromAmState(mUidPolicy->getUidState(current->uid)) : Loading