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

Commit 0063811f authored by Amy's avatar Amy Committed by shubang
Browse files

Fix port id mismatch temporarily.

ag/5409198

On Atom, HDMI1 port id is 2. HDMI2 is 4. HDMI3 is 1.
They are different from the port index.

When we do manual switch, we use port id to set Routing Port.
When we receive ActiveSource/SetStreamPath, we use port index.
There is a mismatch right now before we transit from hard code to a
portid-tvinputid mapping.

Note this is a temporary solution to avoid potential bug.

Test: manual.
Change-Id: I949587e17b815a755abf7cb17a70da1262efcd70
parent 2e4b25c4
Loading
Loading
Loading
Loading
+7 −10
Original line number Original line Diff line number Diff line
@@ -99,13 +99,10 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
            mService.readBooleanSetting(Global.HDMI_CEC_SWITCH_ENABLED, false);
            mService.readBooleanSetting(Global.HDMI_CEC_SWITCH_ENABLED, false);
        mSystemAudioControlFeatureEnabled =
        mSystemAudioControlFeatureEnabled =
            mService.readBooleanSetting(Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, true);
            mService.readBooleanSetting(Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, true);
        // TODO(amyjojo): make the map ro property.
        // TODO(amyjojo): Maintain a portId to TvinputId map.
        mTvInputs.put(Constants.CEC_SWITCH_HDMI1,
        mTvInputs.put(2, "com.droidlogic.tvinput/.services.Hdmi1InputService/HW5");
                "com.droidlogic.tvinput/.services.Hdmi1InputService/HW5");
        mTvInputs.put(4, "com.droidlogic.tvinput/.services.Hdmi2InputService/HW6");
        mTvInputs.put(Constants.CEC_SWITCH_HDMI2,
        mTvInputs.put(1, "com.droidlogic.tvinput/.services.Hdmi3InputService/HW7");
                "com.droidlogic.tvinput/.services.Hdmi2InputService/HW6");
        mTvInputs.put(Constants.CEC_SWITCH_HDMI3,
                "com.droidlogic.tvinput/.services.Hdmi3InputService/HW7");
    }
    }


    /**
    /**
@@ -748,7 +745,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
     */
     */
    private void setSystemAudioMode(boolean newSystemAudioMode) {
    private void setSystemAudioMode(boolean newSystemAudioMode) {
        int targetPhysicalAddress = getActiveSource().physicalAddress;
        int targetPhysicalAddress = getActiveSource().physicalAddress;
        int port = getLocalPortFromPhysicalAddress(targetPhysicalAddress);
        int port = mService.pathToPortId(targetPhysicalAddress);
        if (newSystemAudioMode && port >= 0) {
        if (newSystemAudioMode && port >= 0) {
            switchToAudioInput();
            switchToAudioInput();
        }
        }
@@ -947,7 +944,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {


    @Override
    @Override
    protected void switchInputOnReceivingNewActivePath(int physicalAddress) {
    protected void switchInputOnReceivingNewActivePath(int physicalAddress) {
        int port = getLocalPortFromPhysicalAddress(physicalAddress);
        int port = mService.pathToPortId(physicalAddress);
        if (isSystemAudioActivated() && port < 0) {
        if (isSystemAudioActivated() && port < 0) {
            // If system audio mode is on and the new active source is not under the current device,
            // If system audio mode is on and the new active source is not under the current device,
            // Will switch to ARC input.
            // Will switch to ARC input.
@@ -1019,7 +1016,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {


    @Override
    @Override
    protected void handleRoutingChangeAndInformation(int physicalAddress, HdmiCecMessage message) {
    protected void handleRoutingChangeAndInformation(int physicalAddress, HdmiCecMessage message) {
        int port = getLocalPortFromPhysicalAddress(physicalAddress);
        int port = mService.pathToPortId(physicalAddress);
        // Routing change or information sent from switches under the current device can be ignored.
        // Routing change or information sent from switches under the current device can be ignored.
        if (port > 0) {
        if (port > 0) {
            return;
            return;