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

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

Refactor behavior in onHotplug()

Only call enableAudioReturnChannel when 5V status is false or true.
Since some ARC/eARC devices might trigger 5V status from  false to true when the devices are off, onNewAvrAdded() would power on the devices then.

Bug: 307811135

Change-Id: I3ec98974d9ed6729bfdf110791c7e0e9ae70e48a
parent 7749470a
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -1290,15 +1290,19 @@ public final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
            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.
        if (getAvrDeviceInfo() != null && portId == getAvrDeviceInfo().getPortId()) {
        if (!mService.isEarcEnabled() || !mService.isEarcSupported()) {
            HdmiDeviceInfo avr = getAvrDeviceInfo();
            if (avr != null
                    && portId == avr.getPortId()
                    && isConnectedToArcPort(avr.getPhysicalAddress())) {
                HdmiLogger.debug("Port ID:%d, 5v=%b", portId, connected);
            if (!connected) {
                setSystemAudioMode(false);
                if (connected) {
                    if (mArcEstablished) {
                        enableAudioReturnChannel(true);
                    }
                } else {
                onNewAvrAdded(getAvrDeviceInfo());
                    enableAudioReturnChannel(false);
                }
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -3617,7 +3617,7 @@ public class HdmiControlService extends SystemService {
        }
    }

    @VisibleForTesting
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
    protected boolean isEarcSupported() {
        synchronized (mLock) {
            return mEarcSupported;