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

Commit 9188df6e authored by Yuncheol Heo's avatar Yuncheol Heo Committed by android-build-merger
Browse files

CEC: Allow no parameters with <System Audio Mode Request>.

automerge: 03611473

* commit '03611473':
  CEC: Allow no parameters with <System Audio Mode Request>.
parents 8fafe7b4 03611473
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public final class HdmiCecMessageValidator {
        addValidationInfo(Constants.MESSAGE_SET_STREAM_PATH,
                physicalAddressValidator, DEST_BROADCAST);
        addValidationInfo(Constants.MESSAGE_SYSTEM_AUDIO_MODE_REQUEST,
                physicalAddressValidator, DEST_DIRECT);
                new SystemAudioModeRequestValidator(), DEST_DIRECT);

        // Messages have no parameter.
        FixedLengthValidator noneValidator = new FixedLengthValidator(0);
@@ -303,6 +303,17 @@ public final class HdmiCecMessageValidator {
        }
    }

    private class SystemAudioModeRequestValidator extends PhysicalAddressValidator {
        @Override
        public int isValid(byte[] params) {
            // TV can send <System Audio Mode Request> with no parameters to terminate system audio.
            if (params.length == 0) {
                return OK;
            }
            return super.isValid(params);
        }
    }

    private class ReportPhysicalAddressValidator implements ParameterValidator {
        @Override
        public int isValid(byte[] params) {