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

Commit 184b124e authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

Handle <Menu Status> message.

- Just accept the message, not to response <Feature Abort>.
- Added the CEC message validation info.

Bug: 17382771
Change-Id: I0c1ba870b0acfcd0414f0a3e7bb6c41483879116
parent 0ecb0c43
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -263,7 +263,9 @@ abstract class HdmiCecLocalDevice {
            case Constants.MESSAGE_GIVE_DEVICE_POWER_STATUS:
                return handleGiveDevicePowerStatus(message);
            case Constants.MESSAGE_MENU_REQUEST:
                return handleGiveDeviceMenuStatus(message);
                return handleMenuRequest(message);
            case Constants.MESSAGE_MENU_STATUS:
                return handleMenuStatus(message);
            case Constants.MESSAGE_VENDOR_COMMAND:
                return handleVendorCommand(message);
            case Constants.MESSAGE_VENDOR_COMMAND_WITH_ID:
@@ -503,13 +505,17 @@ abstract class HdmiCecLocalDevice {
        return true;
    }

    protected boolean handleGiveDeviceMenuStatus(HdmiCecMessage message) {
    protected boolean handleMenuRequest(HdmiCecMessage message) {
        // Always report menu active to receive Remote Control.
        mService.sendCecCommand(HdmiCecMessageBuilder.buildReportMenuStatus(
                mAddress, message.getSource(), Constants.MENU_STATE_ACTIVATED));
        return true;
    }

    protected boolean handleMenuStatus(HdmiCecMessage message) {
        return false;
    }

    protected boolean handleVendorCommand(HdmiCecMessage message) {
        mService.invokeVendorCommandListeners(mDeviceType, message.getSource(),
                message.getParams(), false);
+6 −0
Original line number Diff line number Diff line
@@ -1645,6 +1645,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        invokeDeviceEventListener(newInfo, HdmiControlManager.DEVICE_EVENT_UPDATE_DEVICE);
    }

    @Override
    protected boolean handleMenuStatus(HdmiCecMessage message) {
        // Do nothing and just return true not to prevent from responding <Feature Abort>.
        return true;
    }

    @Override
    protected void dump(final IndentingPrintWriter pw) {
        super.dump(pw);
+3 −1
Original line number Diff line number Diff line
@@ -140,7 +140,9 @@ public final class HdmiCecMessageValidator {
        addValidationInfo(Constants.MESSAGE_SET_OSD_STRING, maxLengthValidator, DEST_DIRECT);
        addValidationInfo(Constants.MESSAGE_SET_OSD_NAME, maxLengthValidator, DEST_DIRECT);

        // TODO: Handle messages for the Device Menu Control.
        // Messages for the Device Menu Control.
        addValidationInfo(Constants.MESSAGE_MENU_REQUEST, oneByteValidator, DEST_DIRECT);
        addValidationInfo(Constants.MESSAGE_MENU_STATUS, oneByteValidator, DEST_DIRECT);

        // Messages for the Remote Control Passthrough.
        // TODO: Parse the first parameter and determine if it can have the next parameter.