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

Commit 7543497f authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

CEC: Send keys to active routing path

Previously keys were sent out only when active source was set. They should
be sent when only the active routing path is set in order to be able to
turn the device on using the remote.

Bug: 17647133
Change-Id: I6dc3eaf3a2115430d40c3dd73cb2ba226ba8164b
parent eda01ee7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -168,6 +168,10 @@ final class DeviceSelectAction extends HdmiCecFeatureAction {
    }

    private void sendSetStreamPath() {
        // Turn the active source invalidated, which remains so till <Active Source> comes from
        // the selected device.
        tv().getActiveSource().invalidate();
        tv().setActivePath(mTarget.getPhysicalAddress());
        sendCommand(HdmiCecMessageBuilder.buildSetStreamPath(
                getSourceAddress(), mTarget.getPhysicalAddress()));
        invokeCallback(HdmiControlManager.RESULT_SUCCESS);
+18 −5
Original line number Diff line number Diff line
@@ -350,13 +350,26 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        if (!action.isEmpty()) {
            action.get(0).processKeyEvent(keyCode, isPressed);
        } else {
            if (isPressed && getActiveSource().isValid()) {
                int logicalAddress = getActiveSource().logicalAddress;
            if (isPressed) {
                int logicalAddress = findKeyReceiverAddress();
                if (logicalAddress != Constants.ADDR_INVALID) {
                    addAndStartAction(new SendKeyAction(this, logicalAddress, keyCode));
            } else {
                    return;
                }
            }
            Slog.w(TAG, "Discard key event: " + keyCode + " pressed:" + isPressed);
        }
    }

    private int findKeyReceiverAddress() {
        if (getActiveSource().isValid()) {
            return getActiveSource().logicalAddress;
        }
        HdmiDeviceInfo info = getDeviceInfoByPath(getActivePath());
        if (info != null) {
            return info.getLogicalAddress();
        }
        return Constants.ADDR_INVALID;
    }

    private static void invokeCallback(IHdmiControlCallback callback, int result) {