From caba2c45821faae403ea9b8bd50aa50307e5880d Mon Sep 17 00:00:00 2001 From: "an.xi" Date: Tue, 17 Sep 2024 17:09:09 +0800 Subject: cec: TV could fail to handle one touch play [1/1] PD#SWPL-185469 BUG:367525039 Problem: If the message is received before TV receives the SCREEN_ON broadcast, this message will be processed directly in ActiveSourceHandler and results in a failure to switch source. The root cause is that the mTvInputs variable is not cleared in HdmiCecLocalDevice#disableDevice, since the tv input callback is cleared before the clearing of hdmi device info list. Besides, if the TV device adds the source device's HdmiDeviceInfo with only message, it could fail to add the related TvInputInfo to TvInput Framework. Solution: 1.Clear the tv inputs saved in local tv device during standby. 2.Set valid port id to the HdmiDeviceInfo created by message. Verify: Loki Change-Id: I08747fd2412eaacc6fedee9b0940d2c7c412a7d1 Signed-off-by: an.xi --- services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index 978a8c0e1a45..2000eb705247 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -249,6 +249,7 @@ public final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { .setDisplayName(HdmiUtils.getDefaultDeviceName(source)) .setDeviceType(deviceTypes.get(0)) .setVendorId(Constants.VENDOR_ID_UNKNOWN) + .setPortId(mService.getHdmiCecNetwork().physicalAddressToPortId(physicalAddress)) .build(); mService.getHdmiCecNetwork().addCecDevice(newDevice); } @@ -1398,6 +1399,7 @@ public final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { protected void disableDevice(boolean initiatedByCec, PendingActionClearedCallback callback) { assertRunOnServiceThread(); mService.unregisterTvInputCallback(mTvInputCallback); + mTvInputs.clear(); // Remove any repeated working actions. // HotplugDetectionAction will be reinstated during the wake up process. // HdmiControlService.onWakeUp() -> initializeLocalDevices() -> -- cgit v1.2.3-59-g8ed1b