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

Commit 36b8f991 authored by Tarundeep Singh's avatar Tarundeep Singh Committed by nchalko
Browse files

RESTRICT AUTOMERGE Use HdmiProperties class for all properties that start with ro.hdmi

RESTRICT AUTOMERGE so this does not go to RVC-DEV,  it is already in master.

Bug: 141581191
Test: m services.core
Change-Id: Ieb32135d30b60ad04d5f3e673391e469c83b7f84
Merged-In: Ieb32135d30b60ad04d5f3e673391e469c83b7f84
parent 32260f62
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line Diff line number Diff line
@@ -16,8 +16,6 @@


package android.hardware.hdmi;
package android.hardware.hdmi;


import static com.android.internal.os.RoSystemProperties.PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH;

import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
@@ -31,7 +29,7 @@ import android.annotation.SystemService;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.sysprop.HdmiProperties;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.Log;
import android.util.Log;


@@ -316,8 +314,7 @@ public final class HdmiControlManager {
        mHasPlaybackDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PLAYBACK);
        mHasPlaybackDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PLAYBACK);
        mHasAudioSystemDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
        mHasAudioSystemDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
        mHasSwitchDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH);
        mHasSwitchDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH);
        mIsSwitchDevice = SystemProperties.getBoolean(
        mIsSwitchDevice = HdmiProperties.is_switch().orElse(false);
            PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH, false);
    }
    }


    private static boolean hasDeviceType(int[] types, int type) {
    private static boolean hasDeviceType(int[] types, int type) {
+2 −10
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.os;


import android.os.SystemProperties;
import android.os.SystemProperties;
import android.sysprop.CryptoProperties;
import android.sysprop.CryptoProperties;
import android.sysprop.HdmiProperties;


/**
/**
 * This is a cache of various ro.* properties so that they can be read just once
 * This is a cache of various ro.* properties so that they can be read just once
@@ -37,16 +38,7 @@ public class RoSystemProperties {
     * mode is off.
     * mode is off.
     */
     */
    public static final boolean CEC_AUDIO_DEVICE_FORWARD_VOLUME_KEYS_SYSTEM_AUDIO_MODE_OFF =
    public static final boolean CEC_AUDIO_DEVICE_FORWARD_VOLUME_KEYS_SYSTEM_AUDIO_MODE_OFF =
            SystemProperties.getBoolean(
            HdmiProperties.forward_volume_keys_when_system_audio_mode_off().orElse(false);
                    "ro.hdmi.cec_audio_device_forward_volume_keys_system_audio_mode_off", false);

    /**
     * Property to indicate if the current device is a cec switch device.
     *
     * <p> Default is false.
     */
    public static final String PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH =
            "ro.hdmi.property_is_device_hdmi_cec_switch";


    // ------ ro.config.* -------- //
    // ------ ro.config.* -------- //
    public static final boolean CONFIG_AVOID_GFX_ACCEL =
    public static final boolean CONFIG_AVOID_GFX_ACCEL =
+0 −43
Original line number Original line Diff line number Diff line
@@ -306,49 +306,6 @@ final class Constants {
    static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
    static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
    static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";
    static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";



    // TODO(OEM): Set this to false to keep the playback device in sleep upon hotplug event.
    //            True by default.
    static final String PROPERTY_WAKE_ON_HOTPLUG = "ro.hdmi.wake_on_hotplug";

    // TODO(OEM): Set this to true to enable 'Set Menu Language' feature. False by default.
    static final String PROPERTY_SET_MENU_LANGUAGE = "ro.hdmi.set_menu_language";

    /**
     * Property to save the ARC port id on system audio device.
     * <p>When ARC is initiated, this port will be used to turn on ARC.
     */
    static final String PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT =
            "ro.hdmi.property_sytem_audio_device_arc_port";

    /**
     * Property to disable muting logic in System Audio Control handling. Default is true.
     *
     * <p>True means enabling muting logic.
     * <p>False means never mute device.
     */
    static final String PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE =
            "ro.hdmi.property_system_audio_mode_muting_enable";

    /**
     * When set to true the HdmiControlService will never request a Logical Address for the
     * playback device type. Default is false.
     *
     * <p> This is useful when HDMI CEC multiple device types is not supported by the cec driver
     */
    static final String PROPERTY_HDMI_CEC_NEVER_CLAIM_PLAYBACK_LOGICAL_ADDRESS =
            "ro.hdmi.property_hdmi_cec_never_claim_playback_logical_address";

    /**
     * A comma separated list of logical addresses that HdmiControlService
     * will never assign local CEC devices to.
     *
     * <p> This is useful when HDMI CEC hardware module can't assign multiple logical addresses
     * in the range same range of 0-7 or 8-15.
     */
    static final String PROPERTY_HDMI_CEC_NEVER_ASSIGN_LOGICAL_ADDRESSES =
            "ro.hdmi.property_hdmi_cec_never_assign_logical_addresses";

    // Set to false to allow playback device to go to suspend mode even
    // Set to false to allow playback device to go to suspend mode even
    // when it's an active source. True by default.
    // when it's an active source. True by default.
    static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake";
    static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake";
+5 −7
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ import android.media.tv.TvInputInfo;
import android.media.tv.TvInputManager.TvInputCallback;
import android.media.tv.TvInputManager.TvInputCallback;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.provider.Settings.Global;
import android.provider.Settings.Global;
import android.sysprop.HdmiProperties;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseArray;


@@ -90,8 +91,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {


    // If the current device uses TvInput for ARC. We assume all other inputs also use TvInput
    // If the current device uses TvInput for ARC. We assume all other inputs also use TvInput
    // when ARC is using TvInput.
    // when ARC is using TvInput.
    private boolean mArcIntentUsed = SystemProperties
    private boolean mArcIntentUsed = HdmiProperties.arc_port().orElse("0").contains("tvinput");
            .get(Constants.PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT, "0").contains("tvinput");


    // Keeps the mapping (HDMI port ID to TV input URI) to keep track of the TV inputs ready to
    // Keeps the mapping (HDMI port ID to TV input URI) to keep track of the TV inputs ready to
    // accept input switching request from HDMI devices.
    // accept input switching request from HDMI devices.
@@ -823,7 +823,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
    private void enableAudioReturnChannel(boolean enabled) {
    private void enableAudioReturnChannel(boolean enabled) {
        assertRunOnServiceThread();
        assertRunOnServiceThread();
        mService.enableAudioReturnChannel(
        mService.enableAudioReturnChannel(
                SystemProperties.getInt(Constants.PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT, 0),
                Integer.parseInt(HdmiProperties.arc_port().orElse("0")),
                enabled);
                enabled);
    }
    }


@@ -895,9 +895,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        boolean currentMuteStatus =
        boolean currentMuteStatus =
                mService.getAudioManager().isStreamMute(AudioManager.STREAM_MUSIC);
                mService.getAudioManager().isStreamMute(AudioManager.STREAM_MUSIC);
        if (currentMuteStatus == newSystemAudioMode) {
        if (currentMuteStatus == newSystemAudioMode) {
            if (mService.readBooleanSystemProperty(
            if (HdmiProperties.system_audio_mode_muting().orElse(true) || newSystemAudioMode) {
                    Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE, true)
                            || newSystemAudioMode) {
                mService.getAudioManager()
                mService.getAudioManager()
                        .adjustStreamVolume(
                        .adjustStreamVolume(
                                AudioManager.STREAM_MUSIC,
                                AudioManager.STREAM_MUSIC,
@@ -1133,7 +1131,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        if (portId == Constants.CEC_SWITCH_HOME && mService.isPlaybackDevice()) {
        if (portId == Constants.CEC_SWITCH_HOME && mService.isPlaybackDevice()) {
            switchToHomeTvInput();
            switchToHomeTvInput();
        } else if (portId == Constants.CEC_SWITCH_ARC) {
        } else if (portId == Constants.CEC_SWITCH_ARC) {
            switchToTvInput(SystemProperties.get(Constants.PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT));
            switchToTvInput(HdmiProperties.arc_port().orElse("0"));
            setLocalActivePort(portId);
            setLocalActivePort(portId);
            return;
            return;
        } else {
        } else {
+3 −3
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.PowerManager.WakeLock;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.provider.Settings.Global;
import android.provider.Settings.Global;
import android.sysprop.HdmiProperties;
import android.util.Slog;
import android.util.Slog;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
@@ -43,11 +44,10 @@ import java.util.Locale;
public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
    private static final String TAG = "HdmiCecLocalDevicePlayback";
    private static final String TAG = "HdmiCecLocalDevicePlayback";


    private static final boolean WAKE_ON_HOTPLUG =
    private static final boolean WAKE_ON_HOTPLUG = false;
            SystemProperties.getBoolean(Constants.PROPERTY_WAKE_ON_HOTPLUG, true);


    private static final boolean SET_MENU_LANGUAGE =
    private static final boolean SET_MENU_LANGUAGE =
            SystemProperties.getBoolean(Constants.PROPERTY_SET_MENU_LANGUAGE, false);
            HdmiProperties.set_menu_language_enabled().orElse(false);


    // Used to keep the device awake while it is the active source. For devices that
    // Used to keep the device awake while it is the active source. For devices that
    // cannot wake up via CEC commands, this address the inconvenience of having to
    // cannot wake up via CEC commands, this address the inconvenience of having to
Loading