Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d539d95 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Carter Hsu
Browse files

audiopolicy: reset capture state when input is closed



An active input can be closed before stopInput is called, thus
leaving the input handle to be an unknown input, then the capture
state can keep in true which blocks sound trigger session.
Reset the capture state if needed when input is closed.

Bug: 75253700
Test: manual
authored-by: default avatarZhou Song <zhous@codeaurora.org>
Change-Id: I969aa346e503cab593c33b6ca408845d058f00bc
parent 965737ed
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4761,6 +4761,7 @@ void AudioPolicyManager::closeInput(audio_io_handle_t input)

    nextAudioPortGeneration();

    audio_devices_t device = inputDesc->mDevice;
    ssize_t index = mAudioPatches.indexOfKey(inputDesc->getPatchHandle());
    if (index >= 0) {
        sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
@@ -4771,6 +4772,12 @@ void AudioPolicyManager::closeInput(audio_io_handle_t input)

    inputDesc->close();
    mInputs.removeItem(input);

    audio_devices_t primaryInputDevices = availablePrimaryInputDevices();
    if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) &&
            mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) {
        SoundTrigger::setCaptureState(false);
    }
}

SortedVector<audio_io_handle_t> AudioPolicyManager::getOutputsForDevice(