@Override @ServiceThreadOnly protected boolean handleSetStreamPath(HdmiCecMessage message) { assertRunOnServiceThread(); int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams()); maySetActiveSource(physicalAddress); maySendActiveSource(message.getSource()); wakeUpIfActiveSource(); return true; // Broadcast message. }
@Override @ServiceThreadOnly protected boolean handleRequestActiveSource(HdmiCecMessage message) { assertRunOnServiceThread(); maySendActiveSource(message.getSource()); return true; // Broadcast message. }
@Override @ServiceThreadOnly protected boolean handleRoutingInformation(HdmiCecMessage message) { assertRunOnServiceThread(); int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams()); maySetActiveSource(physicalAddress); return true; // Broadcast message. }
// Samsung model we tested sends <Routing Change> and <Request Active Source> // in a row, and then changes the input to the internal source if there is no // <Active Source> in response. To handle this, we'll set ActiveSource aggressively. @Override @ServiceThreadOnly protected boolean handleRoutingChange(HdmiCecMessage message) { assertRunOnServiceThread(); int newPath = HdmiUtils.twoBytesToInt(message.getParams(), 2); maySetActiveSource(newPath); return true; // Broadcast message. }
private void handleReportAudioStatus(HdmiCecMessage cmd) { byte[] params = cmd.getParams(); boolean mute = (params[0] & 0x80) == 0x80; int volume = params[0] & 0x7F; tv().setAudioStatus(mute, volume); if (!(tv().isSystemAudioActivated() ^ mute)) { // Toggle AVR's mute status to match with the system audio status. sendUserControlPressedAndReleased(mAvrAddress, HdmiCecKeycode.CEC_KEYCODE_MUTE); } finishWithCallback(HdmiControlManager.RESULT_SUCCESS); }
@Override boolean processCommand(HdmiCecMessage cmd) { if (mState != STATE_WAIT_FOR_REPORT_AUDIO_STATUS) { return false; } switch (cmd.getOpcode()) { case Constants.MESSAGE_REPORT_AUDIO_STATUS: handleReportAudioStatus(cmd); return true; } return false; }