[CEC Configuration] Use 'int-value' field instead of 'hex-value'

Bug: 166426337
Test: atest HdmiCecConfigTest
Change-Id: Ibb9f1aa87c7af505d1802057266a4c558f6e82af
This commit is contained in:
Michal Olech
2020-11-06 14:49:48 +01:00
parent 5c451faad4
commit fcfdd08bdc
4 changed files with 16 additions and 21 deletions

View File

@@ -283,9 +283,7 @@ public class HdmiCecConfig {
}
private int getIntValue(@NonNull Value value) {
return value.getHexValue() != null
? Integer.decode(value.getHexValue())
: value.getIntValue();
return Integer.decode(value.getIntValue());
}
/**

View File

@@ -24,7 +24,6 @@
</xs:complexType>
<xs:complexType name="value">
<xs:attribute name="string-value" type="xs:string"/>
<xs:attribute name="int-value" type="xs:int"/>
<xs:attribute name="hex-value" type="xs:string"/>
<xs:attribute name="int-value" type="xs:string"/>
</xs:complexType>
</xs:schema>

View File

@@ -22,11 +22,9 @@ package com.android.server.hdmi.cec.config {
public class Value {
ctor public Value();
method public String getHexValue();
method public int getIntValue();
method public String getIntValue();
method public String getStringValue();
method public void setHexValue(String);
method public void setIntValue(int);
method public void setIntValue(String);
method public void setStringValue(String);
}

View File

@@ -410,10 +410,10 @@ public final class HdmiCecConfigTest {
+ " value-type=\"int\""
+ " user-configurable=\"true\">"
+ " <allowed-values>"
+ " <value hex-value=\"0x00\" />"
+ " <value hex-value=\"0x01\" />"
+ " <value int-value=\"0x00\" />"
+ " <value int-value=\"0x01\" />"
+ " </allowed-values>"
+ " <default-value hex-value=\"0x01\" />"
+ " <default-value int-value=\"0x01\" />"
+ " </setting>"
+ "</cec-settings>", null);
assertThat(hdmiCecConfig.getAllowedIntValues(
@@ -556,10 +556,10 @@ public final class HdmiCecConfigTest {
+ " value-type=\"int\""
+ " user-configurable=\"true\">"
+ " <allowed-values>"
+ " <value hex-value=\"0x00\" />"
+ " <value hex-value=\"0x01\" />"
+ " <value int-value=\"0x00\" />"
+ " <value int-value=\"0x01\" />"
+ " </allowed-values>"
+ " <default-value hex-value=\"0x01\" />"
+ " <default-value int-value=\"0x01\" />"
+ " </setting>"
+ "</cec-settings>", null);
assertThat(hdmiCecConfig.getDefaultIntValue(
@@ -741,10 +741,10 @@ public final class HdmiCecConfigTest {
+ " value-type=\"int\""
+ " user-configurable=\"true\">"
+ " <allowed-values>"
+ " <value hex-value=\"0x0\" />"
+ " <value hex-value=\"0x1\" />"
+ " <value int-value=\"0x0\" />"
+ " <value int-value=\"0x1\" />"
+ " </allowed-values>"
+ " <default-value hex-value=\"0x1\" />"
+ " <default-value int-value=\"0x1\" />"
+ " </setting>"
+ "</cec-settings>", null);
assertThat(hdmiCecConfig.getIntValue(
@@ -988,10 +988,10 @@ public final class HdmiCecConfigTest {
+ " value-type=\"int\""
+ " user-configurable=\"true\">"
+ " <allowed-values>"
+ " <value hex-value=\"0x0\" />"
+ " <value hex-value=\"0x1\" />"
+ " <value int-value=\"0x0\" />"
+ " <value int-value=\"0x1\" />"
+ " </allowed-values>"
+ " <default-value hex-value=\"0x1\" />"
+ " <default-value int-value=\"0x1\" />"
+ " </setting>"
+ "</cec-settings>", null);
hdmiCecConfig.setIntValue(HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED,