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

Commit 900536cf authored by Nathalie Le Clair's avatar Nathalie Le Clair
Browse files

Don't remove devices on onHotplug()

This CL affects TV panels and Audio Systems only.
Before HdmiCecNetwork existed: devices were removed when
HotplugDetectionAction detected a hotplug out, and TIF was informed.
Before this CL: devices were removed from the CEC network onHotplug,
but the listener to inform TIF wasn't invoked. This was causing
multiple issues.
After: on TV panels and Audio Systems, only remove devices when
HotplugDetectionAction detects a hotplug out,
just like before HdmiCecNetwork existed.

Test: atest
Bug:213417037

Change-Id: I4181b4650b70101da44fd205e4df9eb566f74496
parent 69229e31
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.hardware.hdmi.HdmiDeviceInfo;
 * Callback interface definition for HDMI client to get informed of
 * the CEC logical device status change event.
 *
 * Only to be used on TV panel and Audio System devices (b/226317598).
 *
 * @hide
 */
oneway interface IHdmiDeviceEventListener {
+1 −0
Original line number Diff line number Diff line
@@ -214,6 +214,7 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
        } else {
            // We'll not invalidate the active source on the hotplug event to pass CETC 11.2.2-2 ~ 3
            getWakeLock().release();
            mService.getHdmiCecNetwork().removeDevicesConnectedToPort(portId);

            mDelayedStandbyHandler.removeCallbacksAndMessages(null);
            mDelayedStandbyHandler.postDelayed(new DelayedStandbyRunnable(),
+5 −0
Original line number Diff line number Diff line
@@ -1245,6 +1245,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    @ServiceThreadOnly
    void onHotplug(int portId, boolean connected) {
        assertRunOnServiceThread();

        if (!connected) {
            mService.getHdmiCecNetwork().removeCecSwitches(portId);
        }

        // Turning System Audio Mode off when the AVR is unlugged or standby.
        // When the device is not unplugged but reawaken from standby, we check if the System
        // Audio Control Feature is enabled or not then decide if turning SAM on/off accordingly.
+6 −1
Original line number Diff line number Diff line
@@ -730,7 +730,7 @@ public class HdmiCecNetwork {
        return mCecSwitches;
    }

    void removeDevicesConnectedToPort(int portId) {
    void removeCecSwitches(int portId) {
        Iterator<Integer> it = mCecSwitches.iterator();
        while (it.hasNext()) {
            int path = it.next();
@@ -739,6 +739,11 @@ public class HdmiCecNetwork {
                it.remove();
            }
        }
    }

    void removeDevicesConnectedToPort(int portId) {
        removeCecSwitches(portId);

        List<Integer> toRemove = new ArrayList<>();
        for (int i = 0; i < mDeviceInfos.size(); i++) {
            int key = mDeviceInfos.keyAt(i);
+0 −4
Original line number Diff line number Diff line
@@ -1363,10 +1363,6 @@ public class HdmiControlService extends SystemService {
            device.onHotplug(portId, connected);
        }

        if (!connected) {
            mHdmiCecNetwork.removeDevicesConnectedToPort(portId);
        }

        announceHotplugEvent(portId, connected);
    }

Loading