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

Commit 757c0977 authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

CEC: Switch ARC hardware circuit before device update

Audio Return Channel hardware circuit was being switched after
the device update initiated by hotplug event. The device instance
was already removed by the time ARC update was attempted, hence
caused an exception.

This CL ensure the config change is done in advance, when
the AVR device instance is still present.

Bug: 19250400
Change-Id: I31cf682f5c8d1a279a0703d10fe182f3da23d3db
parent fadb0879
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -881,7 +881,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        HdmiLogger.debug("Set Arc Status[old:%b new:%b]", mArcEstablished, enabled);
        boolean oldStatus = mArcEstablished;
        // 1. Enable/disable ARC circuit.
        mService.setAudioReturnChannel(getAvrDeviceInfo().getPortId(), enabled);
        setAudioReturnChannel(enabled);
        // 2. Notify arc status to audio service.
        notifyArcStatusToAudioService(enabled);
        // 3. Update arc status;
@@ -889,6 +889,18 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        return oldStatus;
    }

    /**
     * Switch hardware ARC circuit in the system.
     */
    @ServiceThreadOnly
    void setAudioReturnChannel(boolean enabled) {
        assertRunOnServiceThread();
        HdmiDeviceInfo avr = getAvrDeviceInfo();
        if (avr != null) {
            mService.setAudioReturnChannel(avr.getPortId(), enabled);
        }
    }

    @ServiceThreadOnly
    private void updateArcFeatureStatus(int portId, boolean isConnected) {
        assertRunOnServiceThread();
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction {
        // Turn off system audio mode and update settings.
        tv().setSystemAudioMode(false, true);
        if (tv().isArcEstabilished()) {
            tv().setAudioReturnChannel(false);
            addAndStartAction(new RequestArcTerminationAction(localDevice(), address));
        }
    }