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

Commit 4b2ec497 authored by Donghyun Cho's avatar Donghyun Cho Committed by android-build-merger
Browse files

Merge "CEC: Update system audio mode based on the current status of AVR" into...

Merge "CEC: Update system audio mode based on the current status of AVR" into nyc-dev am: 3cba6797
am: 6d780da9

* commit '6d780da9':
  CEC: Update system audio mode based on the current status of AVR

Change-Id: I213c31ebffd6f06be9bb3eba7a73daa78f5d3060
parents 22c22a6c 6d780da9
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -826,9 +826,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    @ServiceThreadOnly
    void onNewAvrAdded(HdmiDeviceInfo avr) {
        assertRunOnServiceThread();
        if (getSystemAudioModeSetting() && !isSystemAudioActivated()) {
        addAndStartAction(new SystemAudioAutoInitiationAction(this, avr.getLogicalAddress()));
        }
        if (isArcFeatureEnabled(avr.getPortId())
                && !hasAction(SetArcTransmissionStateAction.class)) {
            startArcAction(true);
@@ -1172,12 +1170,13 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
            if (getAvrDeviceInfo() == null) {
                // AVR may not have been discovered yet. Delay the message processing.
                mDelayedMessageBuffer.add(message);
                return true;
            }
            } else {
                HdmiLogger.warning("Invalid <Set System Audio Mode> message:" + message);
                mService.maySendFeatureAbortCommand(message, Constants.ABORT_REFUSED);
            }
            return true;
        }
        removeAction(SystemAudioAutoInitiationAction.class);
        SystemAudioActionFromAvr action = new SystemAudioActionFromAvr(this,
                message.getSource(), HdmiUtils.parseCommandParamSystemAudioStatus(message), null);
        addAndStartAction(action);
+7 −5
Original line number Diff line number Diff line
@@ -64,13 +64,13 @@ final class SystemAudioAutoInitiationAction extends HdmiCecFeatureAction {
        }

        if (cmd.getOpcode() == Constants.MESSAGE_SYSTEM_AUDIO_MODE_STATUS) {
            handleSystemAudioModeStatusMessage();
            handleSystemAudioModeStatusMessage(HdmiUtils.parseCommandParamSystemAudioStatus(cmd));
            return true;
        }
        return false;
    }

    private void handleSystemAudioModeStatusMessage() {
    private void handleSystemAudioModeStatusMessage(boolean isSystemAudioModeOn) {
        if (!canChangeSystemAudio()) {
            HdmiLogger.debug("Cannot change system audio mode in auto initiation action.");
            finish();
@@ -78,9 +78,11 @@ final class SystemAudioAutoInitiationAction extends HdmiCecFeatureAction {
        }

        boolean systemAudioModeSetting = tv().getSystemAudioModeSetting();
        // Update AVR's system audio mode regardless of AVR's status.
        addAndStartAction(new SystemAudioActionFromTv(tv(), mAvrAddress, systemAudioModeSetting,
                null));
        if (systemAudioModeSetting && !isSystemAudioModeOn) {
            addAndStartAction(new SystemAudioActionFromTv(tv(), mAvrAddress, systemAudioModeSetting, null));
        } else {
            tv().setSystemAudioMode(isSystemAudioModeOn, true);
        }
        finish();
    }