Usb DisplayPort alt mode aidl interfaces

Adds enums for DisplayPortAltModeStatus and DisplayPortAltModePinAssignment.
Adds AltModeData and DisplayPortAltModeData.
Updates PortStatus to reflect these new enums and parcelables.

Test: atest VtsAidlUsbTargetTest
Bug: 253534975
Change-Id: I0fc62601dfc162b909e796586110686beed137ea
diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl
new file mode 100644
index 0000000..8e9dd00
--- /dev/null
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not us e 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;
+@VintfStability
+union AltModeData {
+  android.hardware.usb.AltModeData.DisplayPortAltModeData displayPortAltModeData;
+  @VintfStability
+  parcelable DisplayPortAltModeData {
+    android.hardware.usb.DisplayPortAltModeStatus partnerSinkStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN;
+    android.hardware.usb.DisplayPortAltModeStatus cableStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN;
+    android.hardware.usb.DisplayPortAltModePinAssignment pinAssignment = android.hardware.usb.DisplayPortAltModePinAssignment.NONE;
+  }
+}
diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl
new file mode 100644
index 0000000..5908117
--- /dev/null
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl
@@ -0,0 +1,44 @@
+/*
+ * 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 DisplayPortAltModePinAssignment {
+  NONE = 0,
+  A = 1,
+  B = 2,
+  C = 3,
+  D = 4,
+  E = 5,
+  F = 6,
+}
diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl
new file mode 100644
index 0000000..dc69b98
--- /dev/null
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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 DisplayPortAltModeStatus {
+  UNKNOWN = 0,
+  NOT_CAPABLE = 1,
+  CAPABLE = 2,
+  ENABLED = 3,
+}
diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl
new file mode 100644
index 0000000..e218544
--- /dev/null
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl
@@ -0,0 +1,42 @@
+/*
+ * 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 PlugOrientation {
+  UNKNOWN = 0,
+  UNPLUGGED = 1,
+  PLUGGED_UNKNOWN = 2,
+  PLUGGED_NORMAL = 3,
+  PLUGGED_FLIPPED = 4,
+}
diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl
index b0b7552..cefddba 100644
--- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl
@@ -52,4 +52,6 @@
   android.hardware.usb.PowerBrickStatus powerBrickStatus;
   boolean supportsComplianceWarnings = false;
   android.hardware.usb.ComplianceWarning[] complianceWarnings = {};
+  android.hardware.usb.PlugOrientation plugOrientation = android.hardware.usb.PlugOrientation.UNKNOWN;
+  android.hardware.usb.AltModeData[] supportedAltModes = {};
 }
diff --git a/usb/aidl/android/hardware/usb/AltModeData.aidl b/usb/aidl/android/hardware/usb/AltModeData.aidl
new file mode 100644
index 0000000..e103ff9
--- /dev/null
+++ b/usb/aidl/android/hardware/usb/AltModeData.aidl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not us e 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;
+
+import android.hardware.usb.DisplayPortAltModePinAssignment;
+import android.hardware.usb.DisplayPortAltModeStatus;
+
+@VintfStability
+union AltModeData {
+    /**
+     * Holds data necessary to communicate the current DisplayPort
+     * Alt Mode status.
+     */
+    @VintfStability
+    parcelable DisplayPortAltModeData {
+        /**
+         * Indicates the current DisplayPort Alt Mode Status of
+         * the port partner acting as a DisplayPort sink.
+         */
+        DisplayPortAltModeStatus partnerSinkStatus = DisplayPortAltModeStatus.UNKNOWN;
+        /**
+         * Indicates the current status of the attached DisplayPort
+         * Alt Mode cable/adapter.
+         */
+        DisplayPortAltModeStatus cableStatus = DisplayPortAltModeStatus.UNKNOWN;
+        /**
+         * Indicates the DisplayPort Alt Mode pin assignment
+         * negotiated between the device, port partner, and cable.
+         */
+        DisplayPortAltModePinAssignment pinAssignment = DisplayPortAltModePinAssignment.NONE;
+    }
+    DisplayPortAltModeData displayPortAltModeData;
+}
diff --git a/usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl b/usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl
new file mode 100644
index 0000000..d3284e5
--- /dev/null
+++ b/usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl
@@ -0,0 +1,75 @@
+/*
+ * 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 DisplayPort Alt Mode pin assignments whose port
+ * pin configurations are as defined by DisplayPort Alt Mode
+ * v1.0 for deprecated pin assignments A, B, and F and
+ * DisplayPort Alt Mode v2.x for pin assignments C, D, and E.
+ *
+ */
+enum DisplayPortAltModePinAssignment {
+    /**
+     * Indicates that the pin assignment has not yet been
+     * configured, the attached cable/adapter does not support
+     * DisplayPort Alt Mode, or no cable/adapter is attached.
+     */
+    NONE = 0,
+    /**
+     * Intended for use with USB-C-to-USB-C cables and with
+     * adapters from USB-C to other video formats using
+     * four lanes for DisplayPort transmission, and is
+     * restricted by the USB Type-C r1.0 Active Cable
+     * definition.
+     */
+    A = 1,
+    /**
+     * Intended for use with USB-C-to-USB-C cables and with
+     * adapters from USB-C to other video formats using
+     * two lanes for DisplayPort transmission and two for
+     * USB SuperSpeed,and is restricted by the USB Type-C
+     * r1.0 Active Cable definition.
+     */
+    B = 2,
+    /**
+     * Intended for use with USB-C-to-USB-C cables and with
+     * adapters from USB-C to other video formats using
+     * four lanes for DisplayPort transmission.
+     */
+    C = 3,
+    /**
+     * Intended for use with USB-C-to-USB-C cables and with
+     * adapters from USB-C to other video formats using
+     * two lanes for DisplayPort transmission and two for
+     * USB SuperSpeed.
+     */
+    D = 4,
+    /**
+     * Intended for use with adapters from USB-C-to-DP plugs
+     * or receptacles.
+     */
+    E = 5,
+    /**
+     * Intended for use with adapters from USB-C-to-DP plugs
+     * or receptacles that also support two lanes of USB
+     * SuperSpeed.
+     */
+    F = 6,
+}
diff --git a/usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl b/usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl
new file mode 100644
index 0000000..275ed15
--- /dev/null
+++ b/usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl
@@ -0,0 +1,85 @@
+/*
+ * 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")
+/**
+ * Port Partners:
+ * Indicates the current status of the of DisplayPort Alt Mode
+ * partner, which can either be a DisplayPort Alt Mode source
+ * (ex. computer, tablet, phone) or DisplayPort Alt Mode sink
+ * (monitor, hub, adapter).
+ *
+ * Cables:
+ * Indicates the current status of the Type-C cable/adapter
+ * connected to the local Android device.
+ *
+ */
+enum DisplayPortAltModeStatus {
+    /**
+     * Port Partners:
+     * The port partner status is currently unknown for one of
+     * the following reasons:
+     *     1. No port partner is connected to the device
+     *     2. The USB Power Delivery Discover Identity command
+     *        has not been issued to the port partner via SOP
+     *        messaging.
+     *
+     * Cables:
+     * The cable’s capabilities are not yet known to the
+     * device, or no cable is plugged in.
+     */
+    UNKNOWN = 0,
+    /**
+     * Port Partners:
+     * The current port partner does not list DisplayPort as
+     * one of its Alt Modes,does not list the capability to
+     * act as a DisplayPort Source or Sink device, or a compatible
+     * configuration could not be established.
+     *
+     * Cables:
+     * The cable/adapter’s capabilities do not list DisplayPort
+     * as one of its Alt Modes, or a compatible configuration could
+     * not be established.
+     */
+    NOT_CAPABLE = 1,
+    /**
+     * Port Partners:
+     * The current port partner lists compatible DisplayPort
+     * capabilities with the device, however may not yet have
+     * entered DisplayPort Alt Mode or has configured its
+     * port for data transmission.
+     *
+     * Cables:
+     * The Type-C cable/adapter’s capabilities have been
+     * discovered and list DisplayPort Alt Mode as one of its
+     * capabilities, however may not yet have entered DisplayPort
+     * Alt Mode or has been configured for data transmission.
+     */
+    CAPABLE = 2,
+    /**
+     * Port Partners:
+     * The port partner and device are both configured for
+     * DisplayPort Alt Mode.
+     *
+     * Cables:
+     * The Type-C cable/adapter is configured for DisplayPort
+     * Alt Mode.
+     */
+    ENABLED = 3,
+}
diff --git a/usb/aidl/android/hardware/usb/PlugOrientation.aidl b/usb/aidl/android/hardware/usb/PlugOrientation.aidl
new file mode 100644
index 0000000..3c09cfe
--- /dev/null
+++ b/usb/aidl/android/hardware/usb/PlugOrientation.aidl
@@ -0,0 +1,35 @@
+/*
+ * 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")
+/**
+ * Used to indicate plug orientation as defined by USB Type-C
+ * Cable and Connector Specification.
+ */
+enum PlugOrientation {
+    UNKNOWN = 0,
+    UNPLUGGED = 1,
+    /**
+     * The device can detect that a plug is inserted, but
+     * the plug may not present a normal or flipped orientation.
+     */
+    PLUGGED_UNKNOWN = 2,
+    PLUGGED_NORMAL = 3,
+    PLUGGED_FLIPPED = 4,
+}
diff --git a/usb/aidl/android/hardware/usb/PortStatus.aidl b/usb/aidl/android/hardware/usb/PortStatus.aidl
index d7e61ec..daed13c 100644
--- a/usb/aidl/android/hardware/usb/PortStatus.aidl
+++ b/usb/aidl/android/hardware/usb/PortStatus.aidl
@@ -16,10 +16,12 @@
 
 package android.hardware.usb;
 
+import android.hardware.usb.AltModeData;
+import android.hardware.usb.ComplianceWarning;
 import android.hardware.usb.ContaminantDetectionStatus;
 import android.hardware.usb.ContaminantProtectionMode;
 import android.hardware.usb.ContaminantProtectionStatus;
-import android.hardware.usb.ComplianceWarning;
+import android.hardware.usb.PlugOrientation;
 import android.hardware.usb.PortDataRole;
 import android.hardware.usb.PortMode;
 import android.hardware.usb.PortPowerRole;
@@ -102,7 +104,8 @@
     /**
      * Current status of contaminant detection algorithm.
      */
-    ContaminantDetectionStatus contaminantDetectionStatus = ContaminantDetectionStatus.NOT_SUPPORTED;
+    ContaminantDetectionStatus contaminantDetectionStatus =
+            ContaminantDetectionStatus.NOT_SUPPORTED;
     /**
      * UsbData status of the port.
      * Lists reasons for USB data being disabled.
@@ -127,4 +130,14 @@
      * power source/cable/accessory is non compliant.
      */
     ComplianceWarning[] complianceWarnings = {};
+    /**
+     * Indicates the current orientation of the cable/adapter
+     * plugged into the device.
+     */
+    PlugOrientation plugOrientation = PlugOrientation.UNKNOWN;
+    /**
+     * Lists Alt Modes supported by the device and holds their
+     * current information.
+     */
+    AltModeData[] supportedAltModes = {};
 }
diff --git a/usb/aidl/default/Usb.cpp b/usb/aidl/default/Usb.cpp
index dd12da0..593dd4f 100644
--- a/usb/aidl/default/Usb.cpp
+++ b/usb/aidl/default/Usb.cpp
@@ -517,11 +517,11 @@
             (*currentPortStatus)[i].usbDataStatus.push_back(UsbDataStatus::ENABLED);
 
             ALOGI("%d:%s connected:%d canChangeMode:%d canChagedata:%d canChangePower:%d "
-                "usbDataEnabled:%d",
-                i, port.first.c_str(), port.second,
-                (*currentPortStatus)[i].canChangeMode,
-                (*currentPortStatus)[i].canChangeDataRole,
-                (*currentPortStatus)[i].canChangePowerRole, 0);
+                  "usbDataEnabled:%d plugOrientation:%d",
+                  i, port.first.c_str(), port.second, (*currentPortStatus)[i].canChangeMode,
+                  (*currentPortStatus)[i].canChangeDataRole,
+                  (*currentPortStatus)[i].canChangePowerRole, 0,
+                  (*currentPortStatus)[i].plugOrientation);
         }
 
         return Status::SUCCESS;
diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp
index d87f1f4..7b86d68 100644
--- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp
+++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp
@@ -42,10 +42,14 @@
 
 #define TIMEOUT_PERIOD 10
 
+using ::aidl::android::hardware::usb::AltModeData;
 using ::aidl::android::hardware::usb::BnUsbCallback;
 using ::aidl::android::hardware::usb::ComplianceWarning;
+using ::aidl::android::hardware::usb::DisplayPortAltModePinAssignment;
+using ::aidl::android::hardware::usb::DisplayPortAltModeStatus;
 using ::aidl::android::hardware::usb::IUsb;
 using ::aidl::android::hardware::usb::IUsbCallback;
+using ::aidl::android::hardware::usb::PlugOrientation;
 using ::aidl::android::hardware::usb::PortDataRole;
 using ::aidl::android::hardware::usb::PortMode;
 using ::aidl::android::hardware::usb::PortPowerRole;
@@ -639,6 +643,60 @@
     ALOGI("UsbAidlTest nonCompliantChargerValues end");
 }
 
+/*
+ * Test PlugOrientation Values are within range in PortStatus
+ */
+TEST_P(UsbAidlTest, plugOrientationValues) {
+    ALOGI("UsbAidlTest plugOrientationValues start");
+    int64_t transactionId = rand() % 10000;
+    const auto& ret = usb->queryPortStatus(transactionId);
+    ASSERT_TRUE(ret.isOk());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(2, usb_last_cookie);
+    EXPECT_EQ(transactionId, last_transactionId);
+
+    EXPECT_TRUE((int)usb_last_port_status.plugOrientation >= (int)PlugOrientation::UNKNOWN);
+    EXPECT_TRUE((int)usb_last_port_status.plugOrientation <= (int)PlugOrientation::PLUGGED_FLIPPED);
+}
+
+/*
+ * Test DisplayPortAltMode Values when DisplayPort Alt Mode
+ * is active.
+ */
+TEST_P(UsbAidlTest, dpAltModeValues) {
+    ALOGI("UsbAidlTest dpAltModeValues start");
+    int64_t transactionId = rand() % 10000;
+    const auto& ret = usb->queryPortStatus(transactionId);
+    ASSERT_TRUE(ret.isOk());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(2, usb_last_cookie);
+    EXPECT_EQ(transactionId, last_transactionId);
+
+    // Discover DisplayPort Alt Mode
+    for (AltModeData altMode : usb_last_port_status.supportedAltModes) {
+      if (altMode.getTag() == AltModeData::displayPortAltModeData) {
+        AltModeData::DisplayPortAltModeData displayPortAltModeData =
+                altMode.get<AltModeData::displayPortAltModeData>();
+        EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus >=
+                    (int)DisplayPortAltModeStatus::UNKNOWN);
+        EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus <=
+                    (int)DisplayPortAltModeStatus::ENABLED);
+
+        EXPECT_TRUE((int)displayPortAltModeData.cableStatus >=
+                    (int)DisplayPortAltModeStatus::UNKNOWN);
+        EXPECT_TRUE((int)displayPortAltModeData.cableStatus <=
+                    (int)DisplayPortAltModeStatus::ENABLED);
+
+        EXPECT_TRUE((int)displayPortAltModeData.pinAssignment >=
+                    (int)DisplayPortAltModePinAssignment::NONE);
+        EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <=
+                    (int)DisplayPortAltModePinAssignment::F);
+      }
+    }
+
+    ALOGI("UsbAidlTest dpAltModeValues end");
+}
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UsbAidlTest);
 INSTANTIATE_TEST_SUITE_P(
         PerInstance, UsbAidlTest,