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

Commit b09988ca authored by Jungshik Jang's avatar Jungshik Jang Committed by Android Git Automerger
Browse files

am 6fd17d9b: Merge "Use message validator for sending message." into lmp-dev

* commit '6fd17d9b3300c865acfba94bdb9fe3b0c1f3b202':
  Use message validator for sending message.
parents d800c9f0 7bbf9e72
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@ import java.util.Arrays;
public final class HdmiCecMessage {
    public static final byte[] EMPTY_PARAM = EmptyArray.BYTE;

    private static final int MAX_MESSAGE_PARAM_LENGTH = 14;

    private final int mSource;
    private final int mDestination;

@@ -43,12 +41,6 @@ public final class HdmiCecMessage {
        mSource = source;
        mDestination = destination;
        mOpcode = opcode & 0xFF;

        if (params.length > MAX_MESSAGE_PARAM_LENGTH) {
            throw new IllegalArgumentException(
                    "Param length should be at most 13 but current param length is "
                    + params.length);
        }
        mParams = Arrays.copyOf(params, params.length);
    }

+9 −2
Original line number Diff line number Diff line
@@ -517,13 +517,20 @@ public final class HdmiControlService extends SystemService {
    @ServiceThreadOnly
    void sendCecCommand(HdmiCecMessage command, @Nullable SendMessageCallback callback) {
        assertRunOnServiceThread();
        if (mMessageValidator.isValid(command)) {
            mCecController.sendCommand(command, callback);
        } else {
            Slog.e(TAG, "Invalid message type:" + command);
            if (callback != null) {
                callback.onSendCompleted(Constants.SEND_RESULT_FAILURE);
            }
        }
    }

    @ServiceThreadOnly
    void sendCecCommand(HdmiCecMessage command) {
        assertRunOnServiceThread();
        mCecController.sendCommand(command, null);
        sendCecCommand(command, null);
    }

    /**