From 1af5aa4deabbe7b1c7f34961e0bbf3c8994ffd08 Mon Sep 17 00:00:00 2001 From: Roy Luo Date: Fri, 22 Sep 2023 17:51:09 +0000 Subject: [PATCH] Usb compliance warning extension Add new warnings to enum ComplianceWarning Test: atest VtsAidlUsbTargetTest Bug: 296119135 Bug: 300340959 Change-Id: I5dcfe50285589d35dd2a2ab87020de8e2b92c181 --- .../compatibility_matrix.9.xml | 2 +- usb/aidl/Android.bp | 2 +- .../hardware/usb/ComplianceWarning.aidl | 5 ++++ .../hardware/usb/ComplianceWarning.aidl | 25 +++++++++++++++++++ usb/aidl/default/Android.bp | 2 +- .../android.hardware.usb-service.example.xml | 2 +- usb/aidl/vts/Android.bp | 2 +- usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 11 ++++++-- 8 files changed, 44 insertions(+), 7 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index 6bda4a1b4f..60dbd9967e 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -609,7 +609,7 @@ android.hardware.usb - 1-2 + 1-3 IUsb default diff --git a/usb/aidl/Android.bp b/usb/aidl/Android.bp index b82f6d5043..b61576d682 100644 --- a/usb/aidl/Android.bp +++ b/usb/aidl/Android.bp @@ -45,6 +45,6 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl index 8b67070bc6..c7c910324e 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl @@ -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, } diff --git a/usb/aidl/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/android/hardware/usb/ComplianceWarning.aidl index 4c18a310a4..bf79399c14 100644 --- a/usb/aidl/android/hardware/usb/ComplianceWarning.aidl +++ b/usb/aidl/android/hardware/usb/ComplianceWarning.aidl @@ -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, } diff --git a/usb/aidl/default/Android.bp b/usb/aidl/default/Android.bp index 2c6ed07d48..ee8e479d2f 100644 --- a/usb/aidl/default/Android.bp +++ b/usb/aidl/default/Android.bp @@ -34,7 +34,7 @@ cc_binary { "Usb.cpp", ], shared_libs: [ - "android.hardware.usb-V2-ndk", + "android.hardware.usb-V3-ndk", "libbase", "libbinder_ndk", "libcutils", diff --git a/usb/aidl/default/android.hardware.usb-service.example.xml b/usb/aidl/default/android.hardware.usb-service.example.xml index c3f07f5270..7ac206797a 100644 --- a/usb/aidl/default/android.hardware.usb-service.example.xml +++ b/usb/aidl/default/android.hardware.usb-service.example.xml @@ -1,7 +1,7 @@ android.hardware.usb - 2 + 3 IUsb default diff --git a/usb/aidl/vts/Android.bp b/usb/aidl/vts/Android.bp index d0e0eecb3f..cf9299e2fc 100644 --- a/usb/aidl/vts/Android.bp +++ b/usb/aidl/vts/Android.bp @@ -34,7 +34,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.usb-V2-ndk", + "android.hardware.usb-V3-ndk", ], test_suites: [ "general-tests", diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index e9aa65bc8d..7b7269df6a 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -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); + } } }