CEC: Make deviceSelect work for MHL device

MHL device works on hotplug but not when API deviceSelect is invoked
to select it due to a bug not finding the right MHL device instance.
This CL rectifies it by searching for not only CEC but MHL devices
attached to TV.

Bug: 18909552
Change-Id: I4df1ead836090eb3a7476b7738be47a6970edb7d
This commit is contained in:
Jinsuk Kim
2015-01-06 11:30:56 +09:00
parent ad1e3d7df4
commit 6ad7cbde22
2 changed files with 16 additions and 2 deletions

View File

@@ -326,8 +326,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
ActiveSource activeSource = getActiveSource();
HdmiDeviceInfo info = getCecDeviceInfo(activeSource.logicalAddress);
if (info == null) {
info = new HdmiDeviceInfo(Constants.ADDR_INVALID, path, getActivePortId(),
HdmiDeviceInfo.DEVICE_RESERVED, 0, null);
info = mService.getDeviceInfoByPort(getActivePortId());
if (info == null) {
// No CEC/MHL device is present at the port. Attempt to switch to
// the hardware port itself for non-CEC devices that may be connected.
info = new HdmiDeviceInfo(path, getActivePortId());
}
}
mService.invokeInputChangeListener(info);
}

View File

@@ -672,6 +672,16 @@ public final class HdmiControlService extends SystemService {
return tv() == null ? null : tv().getCecDeviceInfo(logicalAddress);
}
@ServiceThreadOnly
HdmiDeviceInfo getDeviceInfoByPort(int port) {
assertRunOnServiceThread();
HdmiMhlLocalDeviceStub info = mMhlController.getLocalDevice(port);
if (info != null) {
return info.getInfo();
}
return null;
}
/**
* Returns version of CEC.
*/