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

Commit b8d62e70 authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

Fix the hotplug behaviors in TV.

- Don't run the local address allocation in the case of TV and the removed event.
- Let isTvDevice() return the value based on mLocalDevices, since tv() is
  unstable during the intialization period.

Bug: 17601460
Change-Id: Ic5701f1f86f51171960033bd97e169270a0021bf
parent 8ade9f90
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -724,12 +724,9 @@ public final class HdmiControlService extends SystemService {
    void onHotplug(int portId, boolean connected) {
        assertRunOnServiceThread();

        if (connected && !isTvDevice()) {
            ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>();
            for (int type : mLocalDevices) {
            if (type == HdmiDeviceInfo.DEVICE_TV) {
                // Skip the reallocation of the logical address on TV.
                continue;
            }
                HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type);
                if (localDevice == null) {
                    localDevice = HdmiCecLocalDevice.create(this, type);
@@ -738,6 +735,7 @@ public final class HdmiControlService extends SystemService {
                localDevices.add(localDevice);
            }
            allocateLogicalAddress(localDevices, INITIATED_BY_HOTPLUG);
        }

        for (HdmiCecLocalDevice device : mCecController.getLocalDeviceList()) {
            device.onHotplug(portId, connected);
@@ -1691,7 +1689,7 @@ public final class HdmiControlService extends SystemService {
    }

    boolean isTvDevice() {
        return tv() != null;
        return mLocalDevices.contains(HdmiDeviceInfo.DEVICE_TV);
    }

    private HdmiCecLocalDevicePlayback playback() {