Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8d2a5ad authored by Hannah.Hsu's avatar Hannah.Hsu Committed by Winni Chang
Browse files

Call addCecDevice when device updates its physical address

Since APK may not handle onHdmiDeviceUpdated correctly,
call addCecDevice when device updates its physical address,
instead of updateCecDevice.

Thus, APK would remove device on old port and then add on the correct port.

Change-Id: Ia79038b9e4fa4e53f339e3d5ee70bdbe2a44c94d
parent 15d6fac7
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -655,9 +655,13 @@ public class HdmiCecNetwork {
                    .setPortId(physicalAddressToPortId(physicalAddress))
                    .setPortId(physicalAddressToPortId(physicalAddress))
                    .setDeviceType(type)
                    .setDeviceType(type)
                    .build();
                    .build();
            if (deviceInfo.getPhysicalAddress() != physicalAddress) {
                addCecDevice(updatedDeviceInfo);
            } else {
                updateCecDevice(updatedDeviceInfo);
                updateCecDevice(updatedDeviceInfo);
            }
            }
        }
        }
    }


    @ServiceThreadOnly
    @ServiceThreadOnly
    private void handleReportPowerStatus(HdmiCecMessage message) {
    private void handleReportPowerStatus(HdmiCecMessage message) {
+5 −4
Original line number Original line Diff line number Diff line
@@ -396,7 +396,7 @@ public class HdmiCecNetworkTest {
    }
    }


    @Test
    @Test
    public void cecDevices_tracking_updatesPhysicalAddress() {
    public void cecDevices_tracking_updatesPhysicalAddress_add() {
        int logicalAddress = Constants.ADDR_PLAYBACK_1;
        int logicalAddress = Constants.ADDR_PLAYBACK_1;
        int initialPhysicalAddress = 0x1000;
        int initialPhysicalAddress = 0x1000;
        int updatedPhysicalAddress = 0x2000;
        int updatedPhysicalAddress = 0x2000;
@@ -415,11 +415,12 @@ public class HdmiCecNetworkTest {
        assertThat(cecDeviceInfo.getPhysicalAddress()).isEqualTo(updatedPhysicalAddress);
        assertThat(cecDeviceInfo.getPhysicalAddress()).isEqualTo(updatedPhysicalAddress);
        assertThat(cecDeviceInfo.getDeviceType()).isEqualTo(type);
        assertThat(cecDeviceInfo.getDeviceType()).isEqualTo(type);


        // ADD for physical address first detected
        // Handle case where PA is changed: Update CEC device information by calling
        // UPDATE for updating device with new physical address
        // addCecDevice().
        assertThat(mDeviceEventListenerStatuses).containsExactly(
        assertThat(mDeviceEventListenerStatuses).containsExactly(
                HdmiControlManager.DEVICE_EVENT_ADD_DEVICE,
                HdmiControlManager.DEVICE_EVENT_ADD_DEVICE,
                HdmiControlManager.DEVICE_EVENT_UPDATE_DEVICE);
                HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE,
                HdmiControlManager.DEVICE_EVENT_ADD_DEVICE);
    }
    }


    @Test
    @Test