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

Commit 1aca8a71 authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

Correct Audio System device unplug behavior on SAM and ARC

We should internally turn off System Audio Mode and ARC when
unplug happens on the HDMI out port.
Also we should reset the TV support SAM to null in this case.

Since we reinit System Audio Mode regardless when replug in HDMI out,
we should keep the internal SAM and ARC on/off state synced.

Test: manual
Bug: 123157607
Change-Id: Ifea1545b05b81acad591d4b2e9b207dbb05e1889
(cherry picked from commit 91c8466f9365604d55a18a822f7a1b4cc2658411)
parent 42be9e60
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -76,6 +76,11 @@ public class ArcTerminationActionFromAvr extends HdmiCecFeatureAction {
        sendCommand(HdmiCecMessageBuilder.buildTerminateArc(getSourceAddress(), Constants.ADDR_TV),
        sendCommand(HdmiCecMessageBuilder.buildTerminateArc(getSourceAddress(), Constants.ADDR_TV),
            result -> {
            result -> {
                if (result != SendMessageResult.SUCCESS) {
                if (result != SendMessageResult.SUCCESS) {
                    // If the physical connection is already off or TV does not handle
                    // Terminate ARC, turn off ARC internally.
                    if (result == SendMessageResult.NACK) {
                        audioSystem().setArcStatus(false);
                    }
                    HdmiLogger.debug("Terminate ARC was not successfully sent.");
                    HdmiLogger.debug("Terminate ARC was not successfully sent.");
                    finish();
                    finish();
                }
                }
+9 −0
Original line number Original line Diff line number Diff line
@@ -304,6 +304,15 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        }
        }
        if (mService.getPortInfo(portId).getType() == HdmiPortInfo.PORT_OUTPUT) {
        if (mService.getPortInfo(portId).getType() == HdmiPortInfo.PORT_OUTPUT) {
            mCecMessageCache.flushAll();
            mCecMessageCache.flushAll();
            if (!connected) {
                if (isSystemAudioActivated()) {
                    mTvSystemAudioModeSupport = null;
                    checkSupportAndSetSystemAudioMode(false);
                }
                if (isArcEnabled()) {
                    setArcStatus(false);
                }
            }
        } else if (!connected && mPortIdToTvInputs.get(portId) != null) {
        } else if (!connected && mPortIdToTvInputs.get(portId) != null) {
            String tvInputId = mPortIdToTvInputs.get(portId);
            String tvInputId = mPortIdToTvInputs.get(portId);
            HdmiDeviceInfo info = mTvInputsToDeviceInfo.get(tvInputId);
            HdmiDeviceInfo info = mTvInputsToDeviceInfo.get(tvInputId);