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

Commit 7c3a9563 authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

Fix bugs in active source command handling in HdmiControl

- Make sure input change listener is invoked
- The command from new device at the active path should
  start routing control

Change-Id: Ic0ca52d42cc1738f9effced322b00f3bd1957f60
parent f96d2296
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -71,18 +71,16 @@ final class ActiveSourceHandler {
            tv.startNewDeviceAction(newActive);
        }

        ActiveSource current = tv.getActiveSource();
        if (!tv.isProhibitMode()) {
            tv.updateActiveSource(newActive);
            if (!current.equals(newActive)) {
            boolean notifyInputChange = (mCallback == null);
            tv.updateActiveInput(newActive.physicalAddress, notifyInputChange);
            }
            invokeCallback(HdmiControlManager.RESULT_SUCCESS);
        } else {
            // TV is in a mode that should keep its current source/input from
            // being changed for its operation. Reclaim the active source
            // or switch the port back to the one used for the current mode.
            ActiveSource current = tv.getActiveSource();
            if (current.logicalAddress == getSourceAddress()) {
                HdmiCecMessage activeSourceCommand = HdmiCecMessageBuilder.buildActiveSource(
                        current.logicalAddress, current.physicalAddress);
+3 −2
Original line number Diff line number Diff line
@@ -238,9 +238,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        if (path == getActivePath()) {
            return;
        }
        setPrevPortId(getActivePortId());
        int portId = mService.pathToPortId(path);
        setActivePath(path);
        setPrevPortId(portId);
        // TODO: Handle PAP/PIP case.
        // Show OSD port change banner
        if (notifyInputChange) {
@@ -440,9 +440,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        if (isTailOfActivePath(path, getActivePath())) {
            removeAction(RoutingControlAction.class);
            int newPath = mService.portIdToPath(getActivePortId());
            setActivePath(newPath);
            mService.sendCecCommand(HdmiCecMessageBuilder.buildRoutingChange(
                    mAddress, getActivePath(), newPath));
            addAndStartAction(new RoutingControlAction(this, getActivePortId(), false, null));
            addAndStartAction(new RoutingControlAction(this, newPath, false, null));
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -101,12 +101,12 @@ final class RoutingControlAction extends FeatureAction {
            // If the routing path doesn't belong to the currently active one, we should
            // ignore it since it might have come from other routing change sequence.
            int routingPath = HdmiUtils.twoBytesToInt(params);
            if (HdmiUtils.isInActiveRoutingPath(mCurrentRoutingPath, routingPath)) {
            if (!HdmiUtils.isInActiveRoutingPath(mCurrentRoutingPath, routingPath)) {
                return true;
            }
            mCurrentRoutingPath = routingPath;
            // Stop possible previous routing change sequence if in progress.
            removeAction(RoutingControlAction.class);
            removeActionExcept(RoutingControlAction.class, this);
            addTimer(mState, TIMEOUT_ROUTING_INFORMATION_MS);
            return true;
        } else if (mState == STATE_WAIT_FOR_REPORT_POWER_STATUS