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

Commit 79db52fb authored by Amy's avatar Amy Committed by shubang
Browse files

Complete the HDMI_SYSTEM_AUDIO_CONTROL_ENABLED control logic in Audio

System device.

ag/5338944

Note that we should init system audio mode again when this property is
turned back on.

Test: local tested.
Bug: 118275908
Change-Id: I120801fdacedaea74d311064e6bf66d30992c8ba
parent 0c2e29fa
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -89,12 +89,10 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {

    protected HdmiCecLocalDeviceAudioSystem(HdmiControlService service) {
        super(service, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
        mSystemAudioControlFeatureEnabled = true;
        // TODO(amyjojo) make System Audio Control controllable by users
        /*mSystemAudioControlFeatureEnabled =
        mService.readBooleanSetting(Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, true);*/
        mRoutingControlFeatureEnabled =
            mService.readBooleanSetting(Global.HDMI_CEC_SWITCH_ENABLED, true);
        mSystemAudioControlFeatureEnabled =
            mService.readBooleanSetting(Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, true);
        // TODO(amyjojo): make the map ro property.
        mTvInputs.put(Constants.CEC_SWITCH_HDMI1,
                "com.droidlogic.tvinput/.services.Hdmi1InputService/HW5");
@@ -275,7 +273,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
            int systemAudioOnPowerOnProp, boolean lastSystemAudioControlStatus) {
        if ((systemAudioOnPowerOnProp == ALWAYS_SYSTEM_AUDIO_CONTROL_ON_POWER_ON)
                || ((systemAudioOnPowerOnProp == USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON)
                && lastSystemAudioControlStatus)) {
                && lastSystemAudioControlStatus && isSystemAudioControlFeatureEnabled())) {
            addAndStartAction(new SystemAudioInitiationActionFromAvr(this));
        }
    }
@@ -408,8 +406,11 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
    @ServiceThreadOnly
    protected boolean handleGiveAudioStatus(HdmiCecMessage message) {
        assertRunOnServiceThread();

        if (isSystemAudioControlFeatureEnabled()) {
            reportAudioStatus(message.getSource());
        } else {
            mService.maySendFeatureAbortCommand(message, Constants.ABORT_REFUSED);
        }
        return true;
    }

@@ -776,6 +777,13 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        HdmiLogger.debug("[A]UpdateSystemAudio mode[on=%b] output=[%X]", on, device);
    }

    void onSystemAduioControlFeatureSupportChanged(boolean enabled) {
        setSystemAudioControlFeatureEnabled(enabled);
        if (enabled) {
            addAndStartAction(new SystemAudioInitiationActionFromAvr(this));
        }
    }

    @ServiceThreadOnly
    void setSystemAudioControlFeatureEnabled(boolean enabled) {
        assertRunOnServiceThread();
+3 −0
Original line number Diff line number Diff line
@@ -610,6 +610,9 @@ public class HdmiControlService extends SystemService {
                    if (isTvDeviceEnabled()) {
                        tv().setSystemAudioControlFeatureEnabled(enabled);
                    }
                    if (isAudioSystemDevice()) {
                        audioSystem().onSystemAduioControlFeatureSupportChanged(enabled);
                    }
                    break;
                case Global.HDMI_CEC_SWITCH_ENABLED:
                    if (isAudioSystemDevice()) {