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

Commit b0a75b7e authored by Paul Colta's avatar Paul Colta Committed by Android (Google) Code Review
Browse files

Merge "HDMI: Allow TV panels to go to dream when handling <Standby>" into main

parents 0e68e023 d742610b
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -434,6 +434,22 @@ public final class HdmiControlManager {
    @Retention(RetentionPolicy.SOURCE)
    public @interface SoundbarMode {}

    // -- Defines the TV's behavior upon receiving a <Standby> message.
    /**
     * TV goes to sleep upon receiving <Standby>.
     *
     * @see HdmiControlManager#CEC_SETTING_NAME_TV_BEHAVIOR_ON_STANDBY_MESSAGE
     * @hide
     */
    public static final int TV_BEHAVIOR_ON_STANDBY_MESSAGE_GO_TO_SLEEP = 0;
    /**
     * TV goes to dream upon receiving <Standby>.
     *
     * @see HdmiControlManager#CEC_SETTING_NAME_TV_BEHAVIOR_ON_STANDBY_MESSAGE
     * @hide
     */
    public static final int TV_BEHAVIOR_ON_STANDBY_MESSAGE_GO_TO_DREAM = 1;

    // -- Scope of CEC power control messages sent by a playback device.
    /**
     * Send CEC power control messages to TV only:
@@ -863,6 +879,14 @@ public final class HdmiControlManager {
     * @see HdmiControlManager#setSoundbarMode(int)
     */
    public static final String CEC_SETTING_NAME_SOUNDBAR_MODE = "soundbar_mode";
    /**
     * Name of a setting that defines the TV's behavior (sleep or dream) upon receiving a
     * <Standby> message.
     *
     * @hide
     */
    public static final String CEC_SETTING_NAME_TV_BEHAVIOR_ON_STANDBY_MESSAGE =
            "tv_behavior_on_standby_message";
    /**
     * Name of a setting deciding on the power control mode.
     *
+6 −0
Original line number Diff line number Diff line
@@ -6808,6 +6808,12 @@
    <bool name="config_cecQuerySadMaxDisabled_allowed">true</bool>
    <bool name="config_cecQuerySadMaxDisabled_default">false</bool>

    <bool name="config_cecTvBehaviorOnStandbyMessage_userConfigurable">false</bool>
    <bool name="config_cecTvBehaviorOnStandbyMessageGoToSleep_allowed">true</bool>
    <bool name="config_cecTvBehaviorOnStandbyMessageGoToSleep_default">true</bool>
    <bool name="config_cecTvBehaviorOnStandbyMessageGoToDream_allowed">true</bool>
    <bool name="config_cecTvBehaviorOnStandbyMessageGoToDream_default">false</bool>

    <!-- eARC Configuration -->
    <bool name="config_earcEnabled_userConfigurable">true</bool>
    <bool name="config_earcFeatureEnabled_allowed">true</bool>
+6 −0
Original line number Diff line number Diff line
@@ -5276,6 +5276,12 @@
  <java-symbol type="bool" name="config_cecQuerySadMaxDisabled_allowed" />
  <java-symbol type="bool" name="config_cecQuerySadMaxDisabled_default" />

  <java-symbol type="bool" name="config_cecTvBehaviorOnStandbyMessage_userConfigurable" />
  <java-symbol type="bool" name="config_cecTvBehaviorOnStandbyMessageGoToSleep_allowed" />
  <java-symbol type="bool" name="config_cecTvBehaviorOnStandbyMessageGoToSleep_default" />
  <java-symbol type="bool" name="config_cecTvBehaviorOnStandbyMessageGoToDream_allowed" />
  <java-symbol type="bool" name="config_cecTvBehaviorOnStandbyMessageGoToDream_default" />

  <!-- eARC Configuration -->
  <java-symbol type="bool" name="config_earcEnabled_userConfigurable" />
  <java-symbol type="bool" name="config_earcFeatureEnabled_allowed" />
+16 −0
Original line number Diff line number Diff line
@@ -676,6 +676,18 @@ public class HdmiCecConfig {
                R.bool.config_cecQuerySadMaxDisabled_allowed,
                R.bool.config_cecQuerySadMaxDisabled_default);

        Setting tvBehaviorOnStandby = registerSetting(
                HdmiControlManager.CEC_SETTING_NAME_TV_BEHAVIOR_ON_STANDBY_MESSAGE,
                R.bool.config_cecTvBehaviorOnStandbyMessage_userConfigurable);
        tvBehaviorOnStandby.registerValue(
                HdmiControlManager.TV_BEHAVIOR_ON_STANDBY_MESSAGE_GO_TO_SLEEP,
                R.bool.config_cecTvBehaviorOnStandbyMessageGoToSleep_allowed,
                R.bool.config_cecTvBehaviorOnStandbyMessageGoToSleep_default);
        tvBehaviorOnStandby.registerValue(
                HdmiControlManager.TV_BEHAVIOR_ON_STANDBY_MESSAGE_GO_TO_DREAM,
                R.bool.config_cecTvBehaviorOnStandbyMessageGoToDream_allowed,
                R.bool.config_cecTvBehaviorOnStandbyMessageGoToDream_default);

        Setting earcEnabled = registerSetting(
                HdmiControlManager.SETTING_NAME_EARC_ENABLED,
                R.bool.config_earcEnabled_userConfigurable);
@@ -785,6 +797,8 @@ public class HdmiCecConfig {
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.CEC_SETTING_NAME_QUERY_SAD_MAX:
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.CEC_SETTING_NAME_TV_BEHAVIOR_ON_STANDBY_MESSAGE:
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.SETTING_NAME_EARC_ENABLED:
                return STORAGE_SHARED_PREFS;
            default:
@@ -862,6 +876,8 @@ public class HdmiCecConfig {
                return setting.getName();
            case HdmiControlManager.CEC_SETTING_NAME_QUERY_SAD_MAX:
                return setting.getName();
            case HdmiControlManager.CEC_SETTING_NAME_TV_BEHAVIOR_ON_STANDBY_MESSAGE:
                return setting.getName();
            case HdmiControlManager.SETTING_NAME_EARC_ENABLED:
                return setting.getName();
            default:
+13 −5
Original line number Diff line number Diff line
@@ -544,6 +544,18 @@ public class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    protected int handleStandby(HdmiCecMessage message) {
        assertRunOnServiceThread();

        if (mService.shouldDreamOnStandbyMessage()) {
            Slog.d(TAG, "Start dreaming upon receiving <Standby> from connected device.");
            mService.startDreaming();
            if(mService.shouldTvSendStandbyOnSleep()) {
                // This will turn off connected devices (e.g. an AVR).
                mService.sendCecCommand(
                        HdmiCecMessageBuilder.buildStandby(
                                getDeviceInfo().getLogicalAddress(), Constants.ADDR_BROADCAST));
            }
            return Constants.HANDLED;
        }

        // If the TV has previously changed the active path, ignore <Standby> from non-active
        // source.
        if (getWasActivePathSetToConnectedDevice()
@@ -1548,11 +1560,7 @@ public class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
            return;
        }
        setWasActivePathSetToConnectedDevice(false);
        boolean sendStandbyOnSleep =
                mService.getHdmiCecConfig().getIntValue(
                    HdmiControlManager.CEC_SETTING_NAME_TV_SEND_STANDBY_ON_SLEEP)
                        == HdmiControlManager.TV_SEND_STANDBY_ON_SLEEP_ENABLED;
        if (!initiatedByCec && sendStandbyOnSleep) {
        if (!initiatedByCec && mService.shouldTvSendStandbyOnSleep()) {
            mService.sendCecCommand(
                    HdmiCecMessageBuilder.buildStandby(
                            getDeviceInfo().getLogicalAddress(), Constants.ADDR_BROADCAST),
Loading