Add hpd and link training status to displayport alt mode api
Adds isHotPlugDetectActive() and getLinkTraining() status to DisplayPortAltModeInfo as well as necessary enums within LINK_TRAINING_STATUS_ Test: atest CtsUsbManagerTestCases Bug: 253534975 Change-Id: Ibbd3cd979b352f49819a7da01f030abfcae66444
This commit is contained in:
@@ -5798,14 +5798,19 @@ package android.hardware.usb {
|
||||
public final class DisplayPortAltModeInfo implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public int getCableStatus();
|
||||
method public int getLinkTrainingStatus();
|
||||
method public int getNumberOfLanes();
|
||||
method public int getPartnerSinkStatus();
|
||||
method public boolean isHotPlugDetectActive();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.DisplayPortAltModeInfo> CREATOR;
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_CAPABLE = 2; // 0x2
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_ENABLED = 3; // 0x3
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_NOT_CAPABLE = 1; // 0x1
|
||||
field public static final int DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN = 0; // 0x0
|
||||
field public static final int LINK_TRAINING_STATUS_FAILURE = 2; // 0x2
|
||||
field public static final int LINK_TRAINING_STATUS_SUCCESS = 1; // 0x1
|
||||
field public static final int LINK_TRAINING_STATUS_UNKNOWN = 0; // 0x0
|
||||
}
|
||||
|
||||
public class UsbDeviceConnection {
|
||||
|
||||
@@ -39,8 +39,8 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
private final @DisplayPortAltModeStatus int mPartnerSinkStatus;
|
||||
private final @DisplayPortAltModeStatus int mCableStatus;
|
||||
private final int mNumLanes;
|
||||
private final boolean mHpd;
|
||||
private final int mLinkTrainingStatus;
|
||||
private final boolean mHotPlugDetect;
|
||||
private final @LinkTrainingStatus int mLinkTrainingStatus;
|
||||
|
||||
/**
|
||||
* Port Partners:
|
||||
@@ -90,6 +90,25 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
*/
|
||||
public static final int DISPLAYPORT_ALT_MODE_STATUS_ENABLED = 3;
|
||||
|
||||
/*
|
||||
* Indicates that DisplayPort Alt Mode link training has not initiated or completed.
|
||||
*/
|
||||
public static final int LINK_TRAINING_STATUS_UNKNOWN = 0;
|
||||
|
||||
/*
|
||||
* Indicates that DisplayPort Alt Mode link training has completed and the optimal data
|
||||
* transmission settings between the device and the connected port partner have successfully
|
||||
* been negotiated.
|
||||
*/
|
||||
public static final int LINK_TRAINING_STATUS_SUCCESS = 1;
|
||||
|
||||
/*
|
||||
* Indicates that DisplayPort Alt Mode link training has completed but no data transmission
|
||||
* settings between the device and the connected port partner could be established, and that the
|
||||
* link initialization has terminated.
|
||||
*/
|
||||
public static final int LINK_TRAINING_STATUS_FAILURE = 2;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "DISPLAYPORT_ALT_MODE_STATUS_" }, value = {
|
||||
DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
@@ -100,22 +119,31 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DisplayPortAltModeStatus {}
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "LINK_TRAINING_STATUS_" }, value = {
|
||||
LINK_TRAINING_STATUS_UNKNOWN,
|
||||
LINK_TRAINING_STATUS_SUCCESS,
|
||||
LINK_TRAINING_STATUS_FAILURE,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface LinkTrainingStatus {}
|
||||
|
||||
/** @hide */
|
||||
public DisplayPortAltModeInfo() {
|
||||
mPartnerSinkStatus = DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN;
|
||||
mCableStatus = DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN;
|
||||
mNumLanes = 0;
|
||||
mHpd = false;
|
||||
mLinkTrainingStatus = 0;
|
||||
mHotPlugDetect = false;
|
||||
mLinkTrainingStatus = LINK_TRAINING_STATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public DisplayPortAltModeInfo(int partnerSinkStatus, int cableStatus,
|
||||
int numLanes, boolean hpd, int linkTrainingStatus) {
|
||||
int numLanes, boolean hotPlugDetect, int linkTrainingStatus) {
|
||||
mPartnerSinkStatus = partnerSinkStatus;
|
||||
mCableStatus = cableStatus;
|
||||
mNumLanes = numLanes;
|
||||
mHpd = hpd;
|
||||
mHotPlugDetect = hotPlugDetect;
|
||||
mLinkTrainingStatus = linkTrainingStatus;
|
||||
}
|
||||
|
||||
@@ -151,6 +179,21 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
return mNumLanes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the Hot Plug Detect (HPD) value of the connected DisplayPort Alt Mode
|
||||
* partner sink is active.
|
||||
*/
|
||||
public boolean isHotPlugDetectActive() {
|
||||
return mHotPlugDetect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DisplayPort Alt Mode link training status.
|
||||
*/
|
||||
public @LinkTrainingStatus int getLinkTrainingStatus() {
|
||||
return mLinkTrainingStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -161,7 +204,7 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
dest.writeInt(mPartnerSinkStatus);
|
||||
dest.writeInt(mCableStatus);
|
||||
dest.writeInt(mNumLanes);
|
||||
dest.writeBoolean(mHpd);
|
||||
dest.writeBoolean(mHotPlugDetect);
|
||||
dest.writeInt(mLinkTrainingStatus);
|
||||
}
|
||||
|
||||
@@ -174,8 +217,8 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
+ mCableStatus
|
||||
+ " numLanes="
|
||||
+ mNumLanes
|
||||
+ " hpd="
|
||||
+ mHpd
|
||||
+ " hotPlugDetect="
|
||||
+ mHotPlugDetect
|
||||
+ " linkTrainingStatus="
|
||||
+ mLinkTrainingStatus
|
||||
+ "}";
|
||||
@@ -192,12 +235,15 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
DisplayPortAltModeInfo other = (DisplayPortAltModeInfo) o;
|
||||
return this.mPartnerSinkStatus == other.mPartnerSinkStatus
|
||||
&& this.mCableStatus == other.mCableStatus
|
||||
&& this.mNumLanes == other.mNumLanes;
|
||||
&& this.mNumLanes == other.mNumLanes
|
||||
&& this.mHotPlugDetect == other.mHotPlugDetect
|
||||
&& this.mLinkTrainingStatus == other.mLinkTrainingStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mPartnerSinkStatus, mCableStatus, mNumLanes);
|
||||
return Objects.hash(mPartnerSinkStatus, mCableStatus, mNumLanes, mHotPlugDetect,
|
||||
mLinkTrainingStatus);
|
||||
}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<DisplayPortAltModeInfo> CREATOR =
|
||||
@@ -207,10 +253,10 @@ public final class DisplayPortAltModeInfo implements Parcelable {
|
||||
int partnerSinkStatus = in.readInt();
|
||||
int cableStatus = in.readInt();
|
||||
int numLanes = in.readInt();
|
||||
boolean hpd = in.readBoolean();
|
||||
boolean hotPlugDetect = in.readBoolean();
|
||||
int linkTrainingStatus = in.readInt();
|
||||
return new DisplayPortAltModeInfo(partnerSinkStatus, cableStatus, numLanes, hpd,
|
||||
linkTrainingStatus);
|
||||
return new DisplayPortAltModeInfo(partnerSinkStatus, cableStatus, numLanes,
|
||||
hotPlugDetect, linkTrainingStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.usb;
|
||||
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN;
|
||||
import static android.hardware.usb.DisplayPortAltModeInfo.LINK_TRAINING_STATUS_UNKNOWN;
|
||||
import static android.hardware.usb.UsbOperationInternal.USB_OPERATION_ERROR_INTERNAL;
|
||||
import static android.hardware.usb.UsbPortStatus.DATA_ROLE_DEVICE;
|
||||
import static android.hardware.usb.UsbPortStatus.DATA_ROLE_HOST;
|
||||
@@ -1188,11 +1190,11 @@ public class UsbService extends IUsbManager.Stub {
|
||||
final String portId = args[1];
|
||||
if (mPortManager != null) {
|
||||
mPortManager.simulateDisplayPortAltModeInfo(portId,
|
||||
DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
DisplayPortAltModeInfo.DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
DISPLAYPORT_ALT_MODE_STATUS_UNKNOWN,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
LINK_TRAINING_STATUS_UNKNOWN,
|
||||
pw);
|
||||
pw.println();
|
||||
mPortManager.dump(new DualDumpOutputStream(new IndentingPrintWriter(pw, " ")),
|
||||
@@ -1271,7 +1273,7 @@ public class UsbService extends IUsbManager.Stub {
|
||||
pw.println(" <cable>: type DisplayPortAltModeStatus");
|
||||
pw.println(" <num-lanes>: type int, expected 0, 2, or 4");
|
||||
pw.println(" <hpd>: type boolean, expected true or false");
|
||||
pw.println(" <link-training-status>: type int with range [0,2]");
|
||||
pw.println(" <link-training-status>: type LinkTrainingStatus");
|
||||
pw.println(" dumpsys usb reset-displayport-status \"matrix\"");
|
||||
pw.println("reset-displayport-status can also be used in order to set");
|
||||
pw.println("the DisplayPortInfo to default values.");
|
||||
|
||||
Reference in New Issue
Block a user