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

Commit 7fb8e7f4 authored by Jungshik Jang's avatar Jungshik Jang
Browse files

CEC: Send <Give System Audio Mode> regardless of TV's setting.

When TV is brought back out of standby, it should send <Give System Audio Mode>
to audio receiver so that TV recovers system audio mode.
Current implementation sends <Give System Audio Mode> only when setting is "ON".
In order to fix this, this change sends <Give System Audio Mode>
regardless of TV's setting and update system audio mode according to
response of <Give System Audio Mode>.

Bug: 18267467
Change-Id: I2c3c05347c6f2a7a3a5e3772e4e26c77156eb740
parent 3ed9f2f9
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -706,9 +706,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    @ServiceThreadOnly
    void onNewAvrAdded(HdmiDeviceInfo avr) {
        assertRunOnServiceThread();
        if (getSystemAudioModeSetting()) {
        addAndStartAction(new SystemAudioAutoInitiationAction(this, avr.getLogicalAddress()));
        }
        if (isArcFeatureEnabled()) {
            startArcAction(true);
        }
+9 −12
Original line number Diff line number Diff line
@@ -71,19 +71,16 @@ final class SystemAudioAutoInitiationAction extends HdmiCecFeatureAction {
    }

    private void handleSystemAudioModeStatusMessage() {
        // If the last setting is system audio, turn on system audio whatever AVR status is.
        if (tv().getSystemAudioModeSetting()) {
            if (canChangeSystemAudio()) {
                addAndStartAction(new SystemAudioActionFromTv(tv(), mAvrAddress, true, null));
            }
        } else {
            // If the last setting is non-system audio, turn off system audio mode
            // and update system audio status (volume or mute).
            tv().setSystemAudioMode(false, true);
            if (canChangeSystemAudio()) {
                addAndStartAction(new SystemAudioStatusAction(tv(), mAvrAddress, null));
            }
        if (!canChangeSystemAudio()) {
            HdmiLogger.debug("Cannot change system audio mode in auto initiation action.");
            finish();
            return;
        }

        boolean systemAudioModeSetting = tv().getSystemAudioModeSetting();
        // Update AVR's system audio mode regardless of AVR's status.
        addAndStartAction(new SystemAudioActionFromTv(tv(), mAvrAddress, systemAudioModeSetting,
                null));
        finish();
    }