am 51cb7aa7: Merge "CEC: Do not issue non-effective <Routing Change>" into lmp-mr1-dev

* commit '51cb7aa774cf6ab7727928d136052c61325a8031':
  CEC: Do not issue non-effective <Routing Change>
This commit is contained in:
Jinsuk Kim
2014-11-24 21:21:12 +00:00
committed by Android Git Automerger
2 changed files with 17 additions and 20 deletions

View File

@@ -89,11 +89,8 @@ final class ActiveSourceHandler {
tv.updateActiveSource(current); tv.updateActiveSource(current);
invokeCallback(HdmiControlManager.RESULT_SUCCESS); invokeCallback(HdmiControlManager.RESULT_SUCCESS);
} else { } else {
HdmiCecMessage routingChange = HdmiCecMessageBuilder.buildRoutingChange( tv.startRoutingControl(newActive.physicalAddress, current.physicalAddress, true,
getSourceAddress(), newActive.physicalAddress, current.physicalAddress); mCallback);
mService.sendCecCommand(routingChange);
tv.addAndStartAction(
new RoutingControlAction(tv, current.physicalAddress, true, mCallback));
} }
} }
} }

View File

@@ -362,11 +362,22 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
return; return;
} }
int newPath = mService.portIdToPath(portId); int newPath = mService.portIdToPath(portId);
startRoutingControl(oldPath, newPath, true, callback);
}
@ServiceThreadOnly
void startRoutingControl(int oldPath, int newPath, boolean queryDevicePowerStatus,
IHdmiControlCallback callback) {
assertRunOnServiceThread();
if (oldPath == newPath) {
return;
}
HdmiCecMessage routingChange = HdmiCecMessage routingChange =
HdmiCecMessageBuilder.buildRoutingChange(mAddress, oldPath, newPath); HdmiCecMessageBuilder.buildRoutingChange(mAddress, oldPath, newPath);
mService.sendCecCommand(routingChange); mService.sendCecCommand(routingChange);
removeAction(RoutingControlAction.class); removeAction(RoutingControlAction.class);
addAndStartAction(new RoutingControlAction(this, newPath, true, callback)); addAndStartAction(
new RoutingControlAction(this, newPath, queryDevicePowerStatus, callback));
} }
@ServiceThreadOnly @ServiceThreadOnly
@@ -587,12 +598,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
private boolean handleNewDeviceAtTheTailOfActivePath(int path) { private boolean handleNewDeviceAtTheTailOfActivePath(int path) {
// Seq #22 // Seq #22
if (isTailOfActivePath(path, getActivePath())) { if (isTailOfActivePath(path, getActivePath())) {
removeAction(RoutingControlAction.class);
int newPath = mService.portIdToPath(getActivePortId()); int newPath = mService.portIdToPath(getActivePortId());
setActivePath(newPath); setActivePath(newPath);
mService.sendCecCommand(HdmiCecMessageBuilder.buildRoutingChange( startRoutingControl(getActivePath(), newPath, false, null);
mAddress, getActivePath(), newPath));
addAndStartAction(new RoutingControlAction(this, newPath, false, null));
return true; return true;
} }
return false; return false;
@@ -1346,12 +1354,8 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
assertRunOnServiceThread(); assertRunOnServiceThread();
// Seq #23 // Seq #23
if (isTailOfActivePath(path, getActivePath())) { if (isTailOfActivePath(path, getActivePath())) {
removeAction(RoutingControlAction.class);
int newPath = mService.portIdToPath(getActivePortId()); int newPath = mService.portIdToPath(getActivePortId());
mService.sendCecCommand(HdmiCecMessageBuilder.buildRoutingChange( startRoutingControl(getActivePath(), newPath, true, null);
mAddress, getActivePath(), newPath));
mActiveSource.invalidate();
addAndStartAction(new RoutingControlAction(this, getActivePath(), true, null));
} }
} }
@@ -1367,13 +1371,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
// Seq #24 // Seq #24
if (getActivePortId() != Constants.INVALID_PORT_ID) { if (getActivePortId() != Constants.INVALID_PORT_ID) {
if (!routingForBootup && !isProhibitMode()) { if (!routingForBootup && !isProhibitMode()) {
removeAction(RoutingControlAction.class);
int newPath = mService.portIdToPath(getActivePortId()); int newPath = mService.portIdToPath(getActivePortId());
setActivePath(newPath); setActivePath(newPath);
mService.sendCecCommand(HdmiCecMessageBuilder.buildRoutingChange(mAddress, startRoutingControl(getActivePath(), newPath, routingForBootup, null);
getActivePath(), newPath));
addAndStartAction(new RoutingControlAction(this, getActivePortId(),
routingForBootup, null));
} }
} else { } else {
int activePath = mService.getPhysicalAddress(); int activePath = mService.getPhysicalAddress();