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

Commit d27da810 authored by Nathalie Le Clair's avatar Nathalie Le Clair Committed by Automerger Merge Worker
Browse files

Don't remove devices on onHotplug() am: c188a568

parents cc03484e c188a568
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
@@ -127,6 +127,7 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
        // We'll not invalidate the active source on the hotplug event to pass CETC 11.2.2-2 ~ 3.
        if (!connected) {
            getWakeLock().release();
            mService.getHdmiCecNetwork().removeDevicesConnectedToPort(portId);
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -1218,6 +1218,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
@@ -698,7 +698,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();
@@ -707,6 +707,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
@@ -1251,10 +1251,6 @@ public class HdmiControlService extends SystemService {
            device.onHotplug(portId, connected);
        }

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

        announceHotplugEvent(portId, connected);
    }

Loading