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

Commit cc975153 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Android (Google) Code Review
Browse files

Merge "CEC: Back up active input correctly against repeated active source commands"

parents dc81f49d 04f813c9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -68,8 +68,12 @@ final class ActiveSourceHandler {
        }

        if (!tv.isProhibitMode()) {
            ActiveSource old = ActiveSource.of(tv.getActiveSource());
            tv.updateActiveSource(newActive);
            boolean notifyInputChange = (mCallback == null);
            if (!old.equals(newActive)) {
                tv.setPrevPortId(tv.getActivePortId());
            }
            tv.updateActiveInput(newActive.physicalAddress, notifyInputChange);
            invokeCallback(HdmiControlManager.RESULT_SUCCESS);
        } else {
+5 −2
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ abstract class HdmiCecLocalDevice {
            logicalAddress = logical;
            physicalAddress = physical;
        }
        public static ActiveSource of(ActiveSource source) {
            return new ActiveSource(source.logicalAddress, source.physicalAddress);
        }
        public static ActiveSource of(int logical, int physical) {
            return new ActiveSource(logical, physical);
        }
@@ -102,10 +105,10 @@ abstract class HdmiCecLocalDevice {
            StringBuffer s = new StringBuffer();
            String logicalAddressString = (logicalAddress == Constants.ADDR_INVALID)
                    ? "invalid" : String.format("0x%02x", logicalAddress);
            s.append("logical_address: ").append(logicalAddressString);
            s.append("(").append(logicalAddressString);
            String physicalAddressString = (physicalAddress == Constants.INVALID_PHYSICAL_ADDRESS)
                    ? "invalid" : String.format("0x%04x", physicalAddress);
            s.append(", physical_address: ").append(physicalAddressString);
            s.append(", ").append(physicalAddressString).append(")");
            return s.toString();
        }
    }
+0 −1
Original line number Diff line number Diff line
@@ -343,7 +343,6 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    void updateActiveInput(int path, boolean notifyInputChange) {
        assertRunOnServiceThread();
        // Seq #15
        setPrevPortId(getActivePortId());
        setActivePath(path);
        // TODO: Handle PAP/PIP case.
        // Show OSD port change banner
+10 −4
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ final class RoutingControlAction extends HdmiCecFeatureAction {

    private void handleReportPowerStatus(int devicePowerStatus) {
        if (isPowerOnOrTransient(getTvPowerStatus())) {
            tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
            updateActiveInput();
            if (isPowerOnOrTransient(devicePowerStatus)) {
                sendSetStreamPath();
            }
@@ -127,6 +127,12 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
        finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
    }

    private void updateActiveInput() {
        HdmiCecLocalDeviceTv tv = tv();
        tv.setPrevPortId(tv.getActivePortId());
        tv.updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
    }

    private int getTvPowerStatus() {
        return tv().getPowerStatus();
    }
@@ -165,13 +171,13 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
                        }
                    });
                } else {
                    tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
                    updateActiveInput();
                    finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
                }
                return;
            case STATE_WAIT_FOR_REPORT_POWER_STATUS:
                if (isPowerOnOrTransient(getTvPowerStatus())) {
                    tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
                    updateActiveInput();
                    sendSetStreamPath();
                }
                finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
@@ -189,7 +195,7 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
            mState = STATE_WAIT_FOR_REPORT_POWER_STATUS;
            addTimer(mState, TIMEOUT_REPORT_POWER_STATUS_MS);
        } else {
            tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
            updateActiveInput();
            sendSetStreamPath();
            finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
        }