Methods Summary |
---|
private void | broadcastActiveSource()
sendCommand(HdmiCecMessageBuilder.buildActiveSource(getSourceAddress(), getSourcePath()));
// Because only playback device can create this action, it's safe to cast.
playback().setActiveSource(true);
|
static com.android.server.hdmi.OneTouchPlayAction | create(HdmiCecLocalDevicePlayback source, int targetAddress, android.hardware.hdmi.IHdmiControlCallback callback)
// Factory method. Ensures arguments are valid.
if (source == null || callback == null) {
Slog.e(TAG, "Wrong arguments");
return null;
}
return new OneTouchPlayAction(source, targetAddress,
callback);
|
void | handleTimerEvent(int state)
if (mState != state) {
return;
}
if (state == STATE_WAITING_FOR_REPORT_POWER_STATUS) {
if (mPowerStatusCounter++ < LOOP_COUNTER_MAX) {
queryDevicePowerStatus();
addTimer(mState, HdmiConfig.TIMEOUT_MS);
} else {
// Couldn't wake up the TV for whatever reason. Report failure.
invokeCallback(HdmiControlManager.RESULT_TIMEOUT);
finish();
}
}
|
private void | invokeCallback(int result)
try {
mCallback.onComplete(result);
} catch (RemoteException e) {
Slog.e(TAG, "Callback failed:" + e);
}
|
boolean | processCommand(HdmiCecMessage cmd)
if (mState != STATE_WAITING_FOR_REPORT_POWER_STATUS
|| mTargetAddress != cmd.getSource()) {
return false;
}
if (cmd.getOpcode() == Constants.MESSAGE_REPORT_POWER_STATUS) {
int status = cmd.getParams()[0];
if (status == HdmiControlManager.POWER_STATUS_ON) {
broadcastActiveSource();
invokeCallback(HdmiControlManager.RESULT_SUCCESS);
finish();
}
return true;
}
return false;
|
private void | queryDevicePowerStatus()
sendCommand(HdmiCecMessageBuilder.buildGiveDevicePowerStatus(getSourceAddress(),
mTargetAddress));
|
boolean | start()
sendCommand(HdmiCecMessageBuilder.buildTextViewOn(getSourceAddress(), mTargetAddress));
broadcastActiveSource();
queryDevicePowerStatus();
mState = STATE_WAITING_FOR_REPORT_POWER_STATUS;
addTimer(mState, HdmiConfig.TIMEOUT_MS);
return true;
|