Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a8b5ee1 authored by RD Babiera's avatar RD Babiera
Browse files

Usb non-compliant port partner aidl extension

Adds aidl api definitions for notifying if the plugged Type-C
port partner (power source/accessory/cable) is non-compliant
with type-c power delivery specification. PortStatus is extended to have
a boolean that states whether or not this feature is supported as well
as an array for a new enum ComplianceWarning.

Test: atest VtsAidlUsbTargetTest
new test nonCompliantChargerStatus expects expects array to be empty
when the feature is not supported. new test nonCompliantChargerValues
expects any values in array to be in range of ComplianceWarning enums
if feature is supported.

Bug: 236322506
Change-Id: Ie3c2365e7c713327b44421c4d132b321d0e03d5f
parent 6e89f039
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -652,6 +652,7 @@
    </hal>
    </hal>
    <hal format="aidl" optional="true">
    <hal format="aidl" optional="true">
        <name>android.hardware.usb</name>
        <name>android.hardware.usb</name>
        <version>1-2</version>
        <interface>
        <interface>
            <name>IUsb</name>
            <name>IUsb</name>
            <instance>default</instance>
            <instance>default</instance>
+41 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.usb;
@Backing(type="int") @VintfStability
enum ComplianceWarning {
  OTHER = 1,
  DEBUG_ACCESSORY = 2,
  BC_1_2 = 3,
  MISSING_RP = 4,
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -50,4 +50,6 @@ parcelable PortStatus {
  android.hardware.usb.UsbDataStatus[] usbDataStatus;
  android.hardware.usb.UsbDataStatus[] usbDataStatus;
  boolean powerTransferLimited;
  boolean powerTransferLimited;
  android.hardware.usb.PowerBrickStatus powerBrickStatus;
  android.hardware.usb.PowerBrickStatus powerBrickStatus;
  boolean supportsComplianceWarnings = false;
  android.hardware.usb.ComplianceWarning[] complianceWarnings = {};
}
}
+59 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.usb;

@VintfStability
@Backing(type="int")
/**
 * Indicates the potential non-compliance reasons for the
 * connected USB Type-C port partner which could be a power
 * source, accessory or cable. Applicable for USB-C receptacles
 * in Android devices.
 */
enum ComplianceWarning {
    /**
     * Used to indicate Type-C sources/cables/accessories/ports
     * whose issue is not listed below but do not meet
     * specification requirements from including but not limited to
     * USB Type-C Cable and Connector Specification, Universal Serial Bus
     * Power Delivery Specification, and Universal Serial Bus
     * 1.x/2.0/3.x/4.0.
     */
    OTHER = 1,
    /**
     * Used to indicate Type-C port partner
     * (cable/accessory/source) that identifies itself as debug
     * accessory source as defined in USB Type-C Cable and
     * Connector Specification. However, the specification
     * states that this is meant for debug only and shall not
     * be used for with commercial products.
     */
    DEBUG_ACCESSORY = 2,
    /**
     * Used to indicate Type-C port partner that does not
     * identify itself as one of the charging port types
     * (SDP/CDP/DCP etc) as defined by Battery Charging v1.2
     * Specification.
     */
    BC_1_2 = 3,
    /**
     * Used to indicate Type-C sources/cables that are missing
     * pull up resistors on the CC pins as required by USB
     * Type-C Cable and Connector Specification.
     */
    MISSING_RP = 4,
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.usb;
import android.hardware.usb.ContaminantDetectionStatus;
import android.hardware.usb.ContaminantDetectionStatus;
import android.hardware.usb.ContaminantProtectionMode;
import android.hardware.usb.ContaminantProtectionMode;
import android.hardware.usb.ContaminantProtectionStatus;
import android.hardware.usb.ContaminantProtectionStatus;
import android.hardware.usb.ComplianceWarning;
import android.hardware.usb.PortDataRole;
import android.hardware.usb.PortDataRole;
import android.hardware.usb.PortMode;
import android.hardware.usb.PortMode;
import android.hardware.usb.PortPowerRole;
import android.hardware.usb.PortPowerRole;
@@ -115,4 +116,15 @@ parcelable PortStatus {
     * Denotes whether Power brick is connected.
     * Denotes whether Power brick is connected.
     */
     */
    PowerBrickStatus powerBrickStatus;
    PowerBrickStatus powerBrickStatus;
    /**
     * True if the hal implementation can support identifying
     * non compliant USB power source/cable/accessory. False other
     * otherwise.
     */
    boolean supportsComplianceWarnings = false;
    /**
     * List of reasons as to why the attached USB
     * power source/cable/accessory is non compliant.
     */
    ComplianceWarning[] complianceWarnings = {};
}
}
Loading