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
This commit is contained in:
Tarundeep Singh
2020-01-30 17:30:44 +05:30
committed by nchalko
parent 32260f62ca
commit 36b8f991e1
7 changed files with 15 additions and 76 deletions

View File

@@ -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) {

View File

@@ -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.
*
* <p> 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 =

View File

@@ -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.
* <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
// when it's an active source. True by default.
static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake";

View File

@@ -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 {

View File

@@ -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

View File

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

View File

@@ -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() {