CEC: Make sure CEC switch info is always updated

The CEC switch information was not updated as expected if
Device Discovery action is in progress. Refactored to have the
update routine gets called regardless of the presence of action.

Conflicts:
	services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java

Bug: 16931883
Change-Id: I629e8b646bef54599c1a706bf1c797ecebf8616b
This commit is contained in:
Jinsuk Kim
2014-08-11 11:56:58 +09:00
parent 3afd00e9f2
commit bcfa0677d4
2 changed files with 19 additions and 12 deletions

View File

@@ -256,6 +256,9 @@ final class DeviceDiscoveryAction extends HdmiCecFeatureAction {
current.mPortId = getPortId(current.mPhysicalAddress);
current.mDeviceType = params[2] & 0xFF;
tv().updateCecSwitchInfo(current.mLogicalAddress, current.mDeviceType,
current.mPhysicalAddress);
increaseProcessedDeviceCount();
checkAndProceedStage();
}

View File

@@ -436,18 +436,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
assertRunOnServiceThread();
int path = HdmiUtils.twoBytesToInt(message.getParams());
int address = message.getSource();
int type = message.getParams()[2];
// Build cec switch list with pure CEC switch, AVR.
if (address == Constants.ADDR_UNREGISTERED) {
int type = message.getParams()[2];
if (type == HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH) {
mCecSwitches.add(path);
updateSafeDeviceInfoList();
return true; // Pure switch does not need further processing. Return here.
} else if (type == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
mCecSwitches.add(path);
}
}
if (updateCecSwitchInfo(address, type, path)) return true;
// Ignore if [Device Discovery Action] is going on.
if (hasAction(DeviceDiscoveryAction.class)) {
@@ -462,6 +453,19 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
return true;
}
boolean updateCecSwitchInfo(int address, int type, int path) {
if (address == Constants.ADDR_UNREGISTERED
&& type == HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH) {
mCecSwitches.add(path);
updateSafeDeviceInfoList();
return true; // Pure switch does not need further processing. Return here.
}
if (type == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
mCecSwitches.add(path);
}
return false;
}
void startNewDeviceAction(ActiveSource activeSource) {
for (NewDeviceAction action : getActions(NewDeviceAction.class)) {
// If there is new device action which has the same logical address and path
@@ -1071,7 +1075,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
}
private void invokeDeviceEventListener(HdmiDeviceInfo info, int status) {
if (!hideDevicesBehindLegacySwitch(info)) {
if (info.isSourceType() && !hideDevicesBehindLegacySwitch(info)) {
mService.invokeDeviceEventListeners(info, status);
}
}