diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java index d5dadbff419fa..7e8bb08e0086c 100644 --- a/core/java/android/hardware/hdmi/HdmiControlManager.java +++ b/core/java/android/hardware/hdmi/HdmiControlManager.java @@ -16,8 +16,6 @@ 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.NonNull; import android.annotation.Nullable; @@ -31,7 +29,7 @@ import android.annotation.SystemService; import android.content.Context; import android.content.pm.PackageManager; import android.os.RemoteException; -import android.os.SystemProperties; +import android.sysprop.HdmiProperties; import android.util.ArrayMap; import android.util.Log; @@ -316,8 +314,7 @@ public final class HdmiControlManager { mHasPlaybackDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PLAYBACK); mHasAudioSystemDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM); mHasSwitchDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH); - mIsSwitchDevice = SystemProperties.getBoolean( - PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH, false); + mIsSwitchDevice = HdmiProperties.is_switch().orElse(false); } private static boolean hasDeviceType(int[] types, int type) { diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java index 8182d60ef4590..8b659f9276339 100644 --- a/core/java/com/android/internal/os/RoSystemProperties.java +++ b/core/java/com/android/internal/os/RoSystemProperties.java @@ -18,6 +18,7 @@ package com.android.internal.os; import android.os.SystemProperties; import android.sysprop.CryptoProperties; +import android.sysprop.HdmiProperties; /** * 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. */ public static final boolean CEC_AUDIO_DEVICE_FORWARD_VOLUME_KEYS_SYSTEM_AUDIO_MODE_OFF = - SystemProperties.getBoolean( - "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. - * - *

Default is false. - */ - public static final String PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH = - "ro.hdmi.property_is_device_hdmi_cec_switch"; + HdmiProperties.forward_volume_keys_when_system_audio_mode_off().orElse(false); // ------ ro.config.* -------- // public static final boolean CONFIG_AVOID_GFX_ACCEL = diff --git a/services/core/java/com/android/server/hdmi/Constants.java b/services/core/java/com/android/server/hdmi/Constants.java index 3006ef41931fc..d7bf37db6afd8 100644 --- a/services/core/java/com/android/server/hdmi/Constants.java +++ b/services/core/java/com/android/server/hdmi/Constants.java @@ -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_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. - *

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. - * - *

True means enabling muting logic. - *

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. - * - *

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. - * - *

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 // when it's an active source. True by default. static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake"; diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java index 9e2fd4e9e91ef..496273b6bf0e6 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java @@ -35,6 +35,7 @@ import android.media.tv.TvInputInfo; import android.media.tv.TvInputManager.TvInputCallback; import android.os.SystemProperties; import android.provider.Settings.Global; +import android.sysprop.HdmiProperties; import android.util.Slog; 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 // when ARC is using TvInput. - private boolean mArcIntentUsed = SystemProperties - .get(Constants.PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT, "0").contains("tvinput"); + private boolean mArcIntentUsed = HdmiProperties.arc_port().orElse("0").contains("tvinput"); // 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. @@ -823,7 +823,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource { private void enableAudioReturnChannel(boolean enabled) { assertRunOnServiceThread(); mService.enableAudioReturnChannel( - SystemProperties.getInt(Constants.PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT, 0), + Integer.parseInt(HdmiProperties.arc_port().orElse("0")), enabled); } @@ -895,9 +895,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource { boolean currentMuteStatus = mService.getAudioManager().isStreamMute(AudioManager.STREAM_MUSIC); if (currentMuteStatus == newSystemAudioMode) { - if (mService.readBooleanSystemProperty( - Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE, true) - || newSystemAudioMode) { + if (HdmiProperties.system_audio_mode_muting().orElse(true) || newSystemAudioMode) { mService.getAudioManager() .adjustStreamVolume( AudioManager.STREAM_MUSIC, @@ -1133,7 +1131,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource { if (portId == Constants.CEC_SWITCH_HOME && mService.isPlaybackDevice()) { switchToHomeTvInput(); } 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); return; } else { diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java index 560f7a03b20fd..603dfafc6ff51 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java @@ -24,6 +24,7 @@ import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.SystemProperties; import android.provider.Settings.Global; +import android.sysprop.HdmiProperties; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; @@ -43,11 +44,10 @@ import java.util.Locale; public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource { private static final String TAG = "HdmiCecLocalDevicePlayback"; - private static final boolean WAKE_ON_HOTPLUG = - SystemProperties.getBoolean(Constants.PROPERTY_WAKE_ON_HOTPLUG, true); + private static final boolean WAKE_ON_HOTPLUG = false; 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 // cannot wake up via CEC commands, this address the inconvenience of having to diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java index ae008b4bfa7af..eb6612fffc0ce 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceSource.java @@ -16,12 +16,10 @@ package com.android.server.hdmi; -import static com.android.internal.os.RoSystemProperties.PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH; - import android.hardware.hdmi.HdmiControlManager; import android.hardware.hdmi.HdmiPortInfo; import android.hardware.hdmi.IHdmiControlCallback; -import android.os.SystemProperties; +import android.sysprop.HdmiProperties; import android.util.Slog; import com.android.internal.annotations.GuardedBy; @@ -44,8 +42,7 @@ abstract class HdmiCecLocalDeviceSource extends HdmiCecLocalDevice { // Device has cec switch functionality or not. // Default is false. - protected boolean mIsSwitchDevice = SystemProperties.getBoolean( - PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH, false); + protected boolean mIsSwitchDevice = HdmiProperties.is_switch().orElse(false); // Routing port number used for Routing Control. // This records the default routing port or the previous valid routing port. diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 6a0cc2661f3db..51d363a411164 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -19,7 +19,6 @@ package com.android.server.hdmi; import static android.hardware.hdmi.HdmiControlManager.DEVICE_EVENT_ADD_DEVICE; import static android.hardware.hdmi.HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE; -import static com.android.internal.os.RoSystemProperties.PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH; import static com.android.server.hdmi.Constants.ADDR_UNREGISTERED; import static com.android.server.hdmi.Constants.DISABLED; import static com.android.server.hdmi.Constants.ENABLED; @@ -2520,8 +2519,7 @@ public class HdmiControlService extends SystemService { } boolean isSwitchDevice() { - return SystemProperties.getBoolean( - PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH, false); + return HdmiProperties.is_switch().orElse(false); } boolean isTvDeviceEnabled() {