Update local device info

Local device info should add at allocated, don't need wait cec device discovery action done.
If we wait it, local device info may not add to cec device info list.
It will cause deviceSelect(0) not execute, active source TV will be ignore,
and cect_IgnoreBroadcastedFromSameSource test fail.

Change-Id: Ia2c0141da00a823fbffe898babfdd3ed27249754
Test: run cts -m CtsHdmiCecHostTestCases -t
      android.hdmicec.cts.common.HdmiCecInvalidMessagesTest#cect_IgnoreBroadcastedFromSameSource
Bug: 258988939
This commit is contained in:
eric_kuang.rs
2023-03-06 14:51:56 +08:00
committed by Alison Chang
parent e13fe5cca8
commit 9fa4dc0ff8
2 changed files with 2 additions and 8 deletions

View File

@@ -682,7 +682,6 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
@ServiceThreadOnly
private void launchDeviceDiscovery() {
assertRunOnServiceThread();
clearDeviceInfoList();
DeviceDiscoveryAction action = new DeviceDiscoveryAction(this,
new DeviceDiscoveryCallback() {
@Override
@@ -691,13 +690,6 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
mService.getHdmiCecNetwork().addCecDevice(info);
}
// Since we removed all devices when it starts and
// device discovery action does not poll local devices,
// we should put device info of local device manually here
for (HdmiCecLocalDevice device : mService.getAllCecLocalDevices()) {
mService.getHdmiCecNetwork().addCecDevice(device.getDeviceInfo());
}
mSelectRequestBuffer.process();
resetSelectRequestBuffer();

View File

@@ -1267,6 +1267,7 @@ public class HdmiControlService extends SystemService {
// It's now safe to flush existing local devices from mCecController since they were
// already moved to 'localDevices'.
clearCecLocalDevices();
mHdmiCecNetwork.clearDeviceList();
allocateLogicalAddress(localDevices, initiatedBy);
}
@@ -1303,6 +1304,7 @@ public class HdmiControlService extends SystemService {
HdmiControlManager.POWER_STATUS_ON, getCecVersion());
localDevice.setDeviceInfo(deviceInfo);
mHdmiCecNetwork.addLocalDevice(deviceType, localDevice);
mHdmiCecNetwork.addCecDevice(localDevice.getDeviceInfo());
mCecController.addLogicalAddress(logicalAddress);
allocatedDevices.add(localDevice);
}