[CEC Configuration] Move master configuration from '/product/etc' to '/system/etc'
Master configuration should actually be available for all Android devices.
Bug: 168020131
Bug: 174349652
Test: atest HdmiCecConfig; also flashed and smoke tested a device
Change-Id: I79dee4798a4d2405505f58e89d78b152cdc82fd7
diff --git a/Android.bp b/Android.bp
index 9493733..b1eb4a5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -604,8 +604,9 @@
],
required: [
"framework-platform-compat-config",
- // TODO: remove gps_debug and protolog.conf.json when the build system propagates "required" properly.
+ // TODO: remove gps_debug, cec_config.xml and protolog.conf.json when the build system propagates "required" properly.
"gps_debug.conf",
+ "cec_config.xml",
"icu4j-platform-compat-config",
"libcore-platform-compat-config",
"protolog.conf.json.gz",
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 17e3456..252fd63 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -110,6 +110,7 @@
],
required: [
+ "cec_config.xml",
"gps_debug.conf",
"protolog.conf.json.gz",
],
@@ -172,6 +173,11 @@
}
prebuilt_etc {
+ name: "cec_config.xml",
+ src: "java/com/android/server/hdmi/cec_config.xml",
+}
+
+prebuilt_etc {
name: "gps_debug.conf",
src: "java/com/android/server/location/gnss/gps_debug.conf",
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecConfig.java b/services/core/java/com/android/server/hdmi/HdmiCecConfig.java
index 98d130f..371fd3d 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecConfig.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecConfig.java
@@ -85,7 +85,7 @@
@NonNull private final Context mContext;
@NonNull private final StorageAdapter mStorageAdapter;
- @Nullable private final CecSettings mProductConfig;
+ @Nullable private final CecSettings mSystemConfig;
@Nullable private final CecSettings mVendorOverride;
/**
@@ -162,14 +162,14 @@
@VisibleForTesting
HdmiCecConfig(@NonNull Context context,
@NonNull StorageAdapter storageAdapter,
- @Nullable CecSettings productConfig,
+ @Nullable CecSettings systemConfig,
@Nullable CecSettings vendorOverride) {
mContext = context;
mStorageAdapter = storageAdapter;
- mProductConfig = productConfig;
+ mSystemConfig = systemConfig;
mVendorOverride = vendorOverride;
- if (mProductConfig == null) {
- Slog.i(TAG, "CEC master configuration XML missing.");
+ if (mSystemConfig == null) {
+ Slog.i(TAG, "CEC system configuration XML missing.");
}
if (mVendorOverride == null) {
Slog.i(TAG, "CEC OEM configuration override XML missing.");
@@ -178,7 +178,7 @@
HdmiCecConfig(@NonNull Context context) {
this(context, new StorageAdapter(context),
- readSettingsFromFile(Environment.buildPath(Environment.getProductDirectory(),
+ readSettingsFromFile(Environment.buildPath(Environment.getRootDirectory(),
ETC_DIR, CONFIG_FILE)),
readSettingsFromFile(Environment.buildPath(Environment.getVendorDirectory(),
ETC_DIR, CONFIG_FILE)));
@@ -226,7 +226,7 @@
@Nullable
private Setting getSetting(@NonNull String name) {
- if (mProductConfig == null) {
+ if (mSystemConfig == null) {
return null;
}
if (mVendorOverride != null) {
@@ -237,8 +237,8 @@
}
}
}
- // If not found, try the product config.
- for (Setting setting : mProductConfig.getSetting()) {
+ // If not found, try the system config.
+ for (Setting setting : mSystemConfig.getSetting()) {
if (setting.getName().equals(name)) {
return setting;
}
@@ -322,11 +322,11 @@
* Returns a list of all settings based on the XML metadata.
*/
public @CecSettingName List<String> getAllSettings() {
- if (mProductConfig == null) {
+ if (mSystemConfig == null) {
return new ArrayList<String>();
}
List<String> allSettings = new ArrayList<String>();
- for (Setting setting : mProductConfig.getSetting()) {
+ for (Setting setting : mSystemConfig.getSetting()) {
allSettings.add(setting.getName());
}
return allSettings;
@@ -336,12 +336,12 @@
* Returns a list of user-modifiable settings based on the XML metadata.
*/
public @CecSettingName List<String> getUserSettings() {
- if (mProductConfig == null) {
+ if (mSystemConfig == null) {
return new ArrayList<String>();
}
Set<String> userSettings = new HashSet<String>();
- // First read from the product config.
- for (Setting setting : mProductConfig.getSetting()) {
+ // First read from the system config.
+ for (Setting setting : mSystemConfig.getSetting()) {
if (setting.getUserConfigurable()) {
userSettings.add(setting.getName());
}
diff --git a/services/core/java/com/android/server/hdmi/cec_config.xml b/services/core/java/com/android/server/hdmi/cec_config.xml
new file mode 100644
index 0000000..480e0ec
--- /dev/null
+++ b/services/core/java/com/android/server/hdmi/cec_config.xml
@@ -0,0 +1,49 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<cec-settings>
+ <setting name="hdmi_cec_enabled"
+ value-type="int"
+ user-configurable="true">
+ <allowed-values>
+ <value int-value="0" />
+ <value int-value="1" />
+ </allowed-values>
+ <default-value int-value="1" />
+ </setting>
+ <setting name="hdmi_cec_version"
+ value-type="int"
+ user-configurable="true">
+ <allowed-values>
+ <value int-value="0x05" />
+ <value int-value="0x06" />
+ </allowed-values>
+ <default-value int-value="0x05" />
+ </setting>
+ <setting name="send_standby_on_sleep"
+ value-type="string"
+ user-configurable="true">
+ <allowed-values>
+ <value string-value="to_tv" />
+ <value string-value="broadcast" />
+ <value string-value="none" />
+ </allowed-values>
+ <default-value string-value="to_tv" />
+ </setting>
+ <setting name="power_state_change_on_active_source_lost"
+ value-type="string"
+ user-configurable="true">
+ <allowed-values>
+ <value string-value="none" />
+ <value string-value="standby_now" />
+ </allowed-values>
+ <default-value string-value="none" />
+ </setting>
+ <setting name="system_audio_mode_muting"
+ value-type="int"
+ user-configurable="true">
+ <allowed-values>
+ <value int-value="0" />
+ <value int-value="1" />
+ </allowed-values>
+ <default-value int-value="1" />
+ </setting>
+</cec-settings>