Merge "CEC: Send keys to active routing path" into lmp-mr1-dev

This commit is contained in:
Jinsuk Kim
2014-09-26 00:13:53 +00:00
committed by Android (Google) Code Review
2 changed files with 22 additions and 5 deletions

View File

@@ -168,6 +168,10 @@ final class DeviceSelectAction extends HdmiCecFeatureAction {
}
private void sendSetStreamPath() {
// Turn the active source invalidated, which remains so till <Active Source> comes from
// the selected device.
tv().getActiveSource().invalidate();
tv().setActivePath(mTarget.getPhysicalAddress());
sendCommand(HdmiCecMessageBuilder.buildSetStreamPath(
getSourceAddress(), mTarget.getPhysicalAddress()));
invokeCallback(HdmiControlManager.RESULT_SUCCESS);

View File

@@ -350,15 +350,28 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
if (!action.isEmpty()) {
action.get(0).processKeyEvent(keyCode, isPressed);
} else {
if (isPressed && getActiveSource().isValid()) {
int logicalAddress = getActiveSource().logicalAddress;
addAndStartAction(new SendKeyAction(this, logicalAddress, keyCode));
} else {
Slog.w(TAG, "Discard key event: " + keyCode + " pressed:" + isPressed);
if (isPressed) {
int logicalAddress = findKeyReceiverAddress();
if (logicalAddress != Constants.ADDR_INVALID) {
addAndStartAction(new SendKeyAction(this, logicalAddress, keyCode));
return;
}
}
Slog.w(TAG, "Discard key event: " + keyCode + " pressed:" + isPressed);
}
}
private int findKeyReceiverAddress() {
if (getActiveSource().isValid()) {
return getActiveSource().logicalAddress;
}
HdmiDeviceInfo info = getDeviceInfoByPath(getActivePath());
if (info != null) {
return info.getLogicalAddress();
}
return Constants.ADDR_INVALID;
}
private static void invokeCallback(IHdmiControlCallback callback, int result) {
if (callback == null) {
return;