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

Commit 98c311f8 authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

Fix <System Audio Mode Request> handler

CUrrent implemenetation does not use the parameter to route to ARC when
TV sends out Request System Audio Mode on. Instead it request Active
Source when initializing ARC.

Since ARC and System Audio Mode are independent, we should rely on
the physical address sent by <System Audio Mode Request> to locate the
current Active Source.

Also we don't need to terminate ARC when System
Audio Mode is turned off.

Test: manual
Bug: 119151888
Change-Id: I18b0b5225fe57fafde78db15663d9f0a9e225e82
(cherry picked from commit 679dd60e6dbc00141641637af3c18e581db7197b)
parent 78dc908e
Loading
Loading
Loading
Loading
+1 −25
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@ public class ArcInitiationActionFromAvr extends HdmiCecFeatureAction {

    // the required maximum response time specified in CEC 9.2
    private static final int TIMEOUT_MS = 1000;
    private static final int MAX_RETRY_COUNT = 5;

    private int mSendRequestActiveSourceRetryCount = 0;

    ArcInitiationActionFromAvr(HdmiCecLocalDevice source) {
        super(source);
@@ -64,12 +61,7 @@ public class ArcInitiationActionFromAvr extends HdmiCecFeatureAction {
                return true;
            case Constants.MESSAGE_REPORT_ARC_INITIATED:
                mState = STATE_ARC_INITIATED;
                if (audioSystem().getActiveSource().physicalAddress != getSourcePath()
                        && audioSystem().isSystemAudioActivated()) {
                    sendRequestActiveSource();
                } else {
                finish();
                }
                return true;
        }
        return false;
@@ -103,20 +95,4 @@ public class ArcInitiationActionFromAvr extends HdmiCecFeatureAction {
        audioSystem().setArcStatus(false);
        finish();
    }

    protected void sendRequestActiveSource() {
        sendCommand(HdmiCecMessageBuilder.buildRequestActiveSource(getSourceAddress()),
                result -> {
                    if (result != SendMessageResult.SUCCESS) {
                        if (mSendRequestActiveSourceRetryCount < MAX_RETRY_COUNT) {
                            mSendRequestActiveSourceRetryCount++;
                            sendRequestActiveSource();
                        } else {
                            finish();
                        }
                    } else {
                        finish();
                    }
                });
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -783,6 +783,15 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        mService.sendCecCommand(
                HdmiCecMessageBuilder.buildSetSystemAudioMode(
                        mAddress, Constants.ADDR_BROADCAST, systemAudioStatusOn));

        if (systemAudioStatusOn) {
            int sourcePhysicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
            if (sourcePhysicalAddress != getActiveSource().physicalAddress) {
                // If the Active Source recorded by the current device is not synced up with TV,
                // TODO(amyjojo): update Active Source internally
            }
            switchInputOnReceivingNewActivePath(sourcePhysicalAddress);
        }
        return true;
    }