am 6fd17d9b: Merge "Use message validator for sending message." into lmp-dev
* commit '6fd17d9b3300c865acfba94bdb9fe3b0c1f3b202': Use message validator for sending message.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -517,13 +517,20 @@ public final class HdmiControlService extends SystemService {
|
||||
@ServiceThreadOnly
|
||||
void sendCecCommand(HdmiCecMessage command, @Nullable SendMessageCallback callback) {
|
||||
assertRunOnServiceThread();
|
||||
mCecController.sendCommand(command, callback);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user