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

Commit 51e42e93 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[CEC Configuration] Add 'set_menu_language' setting"

parents 8333b4f4 b39f3b50
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -564,6 +564,32 @@ public final class HdmiControlManager {
    @Retention(RetentionPolicy.SOURCE)
    public @interface TvSendStandbyOnSleep {}

    // -- Whether a playback device should act on an incoming {@code <Set Menu Language>} message.
    /**
     * Confirmation dialog should be shown upon receiving the CEC message.
     *
     * @see HdmiControlManager#CEC_SETTING_NAME_SET_MENU_LANGUAGE
     * @hide
     */
    public static final int SET_MENU_LANGUAGE_ENABLED = 1;
    /**
     * The message should be ignored.
     *
     * @see HdmiControlManager#CEC_SETTING_NAME_SET_MENU_LANGUAGE
     * @hide
     */
    public static final int SET_MENU_LANGUAGE_DISABLED = 0;
    /**
     * @see HdmiControlManager#CEC_SETTING_NAME_SET_MENU_LANGUAGE
     * @hide
     */
    @IntDef(prefix = { "SET_MENU_LANGUAGE_" }, value = {
            SET_MENU_LANGUAGE_ENABLED,
            SET_MENU_LANGUAGE_DISABLED
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SetMenuLanguage {}

    // -- The RC profile of a TV panel.
    /**
     * RC profile none.
@@ -817,6 +843,13 @@ public final class HdmiControlManager {
     */
    public static final String CEC_SETTING_NAME_TV_SEND_STANDBY_ON_SLEEP =
            "tv_send_standby_on_sleep";
    /**
     * Name of a setting deciding whether {@code <Set Menu Language>} message should be
     * handled by the framework or ignored.
     *
     * @hide
     */
    public static final String CEC_SETTING_NAME_SET_MENU_LANGUAGE = "set_menu_language";
    /**
     * Name of a setting representing the RC profile of a TV panel.
     *
@@ -983,6 +1016,7 @@ public final class HdmiControlManager {
        CEC_SETTING_NAME_VOLUME_CONTROL_MODE,
        CEC_SETTING_NAME_TV_WAKE_ON_ONE_TOUCH_PLAY,
        CEC_SETTING_NAME_TV_SEND_STANDBY_ON_SLEEP,
        CEC_SETTING_NAME_SET_MENU_LANGUAGE,
        CEC_SETTING_NAME_RC_PROFILE_TV,
        CEC_SETTING_NAME_RC_PROFILE_SOURCE_HANDLES_ROOT_MENU,
        CEC_SETTING_NAME_RC_PROFILE_SOURCE_HANDLES_SETUP_MENU,
+6 −0
Original line number Diff line number Diff line
@@ -5276,6 +5276,12 @@
    <bool name="config_cecTvSendStandbyOnSleepDisabled_allowed">true</bool>
    <bool name="config_cecTvSendStandbyOnSleepDisabled_default">false</bool>

    <bool name="config_cecSetMenuLanguage_userConfigurable">true</bool>
    <bool name="config_cecSetMenuLanguageEnabled_allowed">true</bool>
    <bool name="config_cecSetMenuLanguageEnabled_default">true</bool>
    <bool name="config_cecSetMenuLanguageDisabled_allowed">true</bool>
    <bool name="config_cecSetMenuLanguageDisabled_default">false</bool>

    <bool name="config_cecRcProfileTv_userConfigurable">true</bool>
    <bool name="config_cecRcProfileTvNone_allowed">true</bool>
    <bool name="config_cecRcProfileTvNone_default">true</bool>
+6 −0
Original line number Diff line number Diff line
@@ -4466,6 +4466,12 @@
  <java-symbol type="bool" name="config_cecTvSendStandbyOnSleepDisabled_allowed" />
  <java-symbol type="bool" name="config_cecTvSendStandbyOnSleepDisabled_default" />

  <java-symbol type="bool" name="config_cecSetMenuLanguage_userConfigurable" />
  <java-symbol type="bool" name="config_cecSetMenuLanguageEnabled_allowed" />
  <java-symbol type="bool" name="config_cecSetMenuLanguageEnabled_default" />
  <java-symbol type="bool" name="config_cecSetMenuLanguageDisabled_allowed" />
  <java-symbol type="bool" name="config_cecSetMenuLanguageDisabled_default" />

  <java-symbol type="bool" name="config_cecRcProfileTv_userConfigurable" />
  <java-symbol type="bool" name="config_cecRcProfileTvNone_allowed" />
  <java-symbol type="bool" name="config_cecRcProfileTvNone_default" />
+14 −0
Original line number Diff line number Diff line
@@ -385,6 +385,16 @@ public class HdmiCecConfig {
                R.bool.config_cecTvSendStandbyOnSleepDisabled_allowed,
                R.bool.config_cecTvSendStandbyOnSleepDisabled_default);

        Setting setMenuLanguage = registerSetting(
                HdmiControlManager.CEC_SETTING_NAME_SET_MENU_LANGUAGE,
                R.bool.config_cecSetMenuLanguage_userConfigurable);
        setMenuLanguage.registerValue(HdmiControlManager.SET_MENU_LANGUAGE_ENABLED,
                R.bool.config_cecSetMenuLanguageEnabled_allowed,
                R.bool.config_cecSetMenuLanguageEnabled_default);
        setMenuLanguage.registerValue(HdmiControlManager.SET_MENU_LANGUAGE_DISABLED,
                R.bool.config_cecSetMenuLanguageDisabled_allowed,
                R.bool.config_cecSetMenuLanguageDisabled_default);

        Setting rcProfileTv = registerSetting(
                HdmiControlManager.CEC_SETTING_NAME_RC_PROFILE_TV,
                R.bool.config_cecRcProfileTv_userConfigurable);
@@ -697,6 +707,8 @@ public class HdmiCecConfig {
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.CEC_SETTING_NAME_TV_SEND_STANDBY_ON_SLEEP:
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.CEC_SETTING_NAME_SET_MENU_LANGUAGE:
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.CEC_SETTING_NAME_RC_PROFILE_TV:
                return STORAGE_SHARED_PREFS;
            case HdmiControlManager.CEC_SETTING_NAME_RC_PROFILE_SOURCE_HANDLES_ROOT_MENU:
@@ -768,6 +780,8 @@ public class HdmiCecConfig {
                return setting.getName();
            case HdmiControlManager.CEC_SETTING_NAME_TV_SEND_STANDBY_ON_SLEEP:
                return setting.getName();
            case HdmiControlManager.CEC_SETTING_NAME_SET_MENU_LANGUAGE:
                return setting.getName();
            case HdmiControlManager.CEC_SETTING_NAME_RC_PROFILE_TV:
                return setting.getName();
            case HdmiControlManager.CEC_SETTING_NAME_RC_PROFILE_SOURCE_HANDLES_ROOT_MENU:
+3 −4
Original line number Diff line number Diff line
@@ -50,9 +50,6 @@ import java.util.Locale;
public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
    private static final String TAG = "HdmiCecLocalDevicePlayback";

    private static final boolean SET_MENU_LANGUAGE =
            HdmiProperties.set_menu_language_enabled().orElse(false);

    // How long to wait after hotplug out before possibly going to Standby.
    @VisibleForTesting
    static final long STANDBY_AFTER_HOTPLUG_OUT_DELAY_MS = 30_000;
@@ -388,7 +385,9 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
    @Constants.HandleMessageResult
    protected int handleSetMenuLanguage(HdmiCecMessage message) {
        assertRunOnServiceThread();
        if (!SET_MENU_LANGUAGE) {
        if (mService.getHdmiCecConfig().getIntValue(
                HdmiControlManager.CEC_SETTING_NAME_SET_MENU_LANGUAGE)
                    == HdmiControlManager.SET_MENU_LANGUAGE_DISABLED) {
            return Constants.ABORT_UNRECOGNIZED_OPCODE;
        }

Loading