diff options
| -rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java | 8 | ||||
| -rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiControlService.java | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index ed7cebbc1b03..90dbd1765200 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -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); } diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 8ce6caf30c84..e8cb7204e5f6 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -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. */ |