Usb compliance warning extension

Add new warnings to enum ComplianceWarning

Test: atest VtsAidlUsbTargetTest
Bug: 296119135
Bug: 300340959
Change-Id: I5dcfe50285589d35dd2a2ab87020de8e2b92c181
This commit is contained in:
Roy Luo 2023-09-22 17:51:09 +00:00
parent 3c4646734b
commit 1af5aa4dea
8 changed files with 44 additions and 7 deletions

View file

@ -609,7 +609,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.usb</name>
<version>1-2</version>
<version>1-3</version>
<interface>
<name>IUsb</name>
<instance>default</instance>

View file

@ -45,6 +45,6 @@ aidl_interface {
},
],
frozen: true,
frozen: false,
}

View file

@ -38,4 +38,9 @@ enum ComplianceWarning {
DEBUG_ACCESSORY = 2,
BC_1_2 = 3,
MISSING_RP = 4,
INPUT_POWER_LIMITED = 5,
MISSING_DATA_LINES = 6,
ENUMERATION_FAIL = 7,
FLAKY_CONNECTION = 8,
UNRELIABLE_IO = 9,
}

View file

@ -56,4 +56,29 @@ enum ComplianceWarning {
* Type-C Cable and Connector Specification.
*/
MISSING_RP = 4,
/**
* Used to indicate the charging setups on the USB ports are unable to
* deliver negotiated power.
*/
INPUT_POWER_LIMITED = 5,
/**
* Used to indicate the cable/connector on the USB ports are missing
* the required wires on the data pins to make data transfer.
*/
MISSING_DATA_LINES = 6,
/**
* Used to indicate enumeration failures on the USB ports, potentially due to
* signal integrity issues or other causes.
*/
ENUMERATION_FAIL = 7,
/**
* Used to indicate unexpected data disconnection on the USB ports,
* potentially due to signal integrity issues or other causes.
*/
FLAKY_CONNECTION = 8,
/**
* Used to indicate unreliable or slow data transfer on the USB ports,
* potentially due to signal integrity issues or other causes.
*/
UNRELIABLE_IO = 9,
}

View file

@ -34,7 +34,7 @@ cc_binary {
"Usb.cpp",
],
shared_libs: [
"android.hardware.usb-V2-ndk",
"android.hardware.usb-V3-ndk",
"libbase",
"libbinder_ndk",
"libcutils",

View file

@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.usb</name>
<version>2</version>
<version>3</version>
<interface>
<name>IUsb</name>
<instance>default</instance>

View file

@ -34,7 +34,7 @@ cc_test {
"libbinder_ndk",
],
static_libs: [
"android.hardware.usb-V2-ndk",
"android.hardware.usb-V3-ndk",
],
test_suites: [
"general-tests",

View file

@ -654,11 +654,18 @@ TEST_P(UsbAidlTest, nonCompliantChargerValues) {
EXPECT_EQ(2, usb_last_cookie);
EXPECT_EQ(transactionId, last_transactionId);
// Current compliance values range from [1, 4]
if (usb_last_port_status.supportsComplianceWarnings) {
for (auto warning : usb_last_port_status.complianceWarnings) {
EXPECT_TRUE((int)warning >= (int)ComplianceWarning::OTHER);
EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP);
/*
* Version 2 compliance values range from [1, 4]
* Version 3 compliance values range from [1, 9]
*/
if (usb_version < 3) {
EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP);
} else {
EXPECT_TRUE((int)warning <= (int)ComplianceWarning::UNRELIABLE_IO);
}
}
}