summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorPaul McLean <pmclean@google.com>2019-10-08 11:07:29 -0600
committerPaul McLean <pmclean@google.com>2019-10-18 11:08:52 -0600
commita7e7f94f98ab425e72403e60d9a5e06cc0e30dc7 (patch)
tree4823b4f5aa26cb901f312a1ae8ccfbd6e7702b3d /core/java/android
parent5c12df642b380fdca90ef16d30c2e368fffe8097 (diff)
Add video class-specific descriptors to UsbDescriptorParser framework.
Also add mHasVideoCapture and mHasVideoPlayback members to UsbDevice. Bug: 142321590 Test: Build, flash, connect USB Video Camera, examine logs Change-Id: Ia6ae687182ec0b007c1688478545829395191984
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/usb/UsbDevice.java37
1 files changed, 32 insertions, 5 deletions
diff --git a/core/java/android/hardware/usb/UsbDevice.java b/core/java/android/hardware/usb/UsbDevice.java
index 11f4ffb4c225..ee2e2622b314 100644
--- a/core/java/android/hardware/usb/UsbDevice.java
+++ b/core/java/android/hardware/usb/UsbDevice.java
@@ -63,6 +63,8 @@ public class UsbDevice implements Parcelable {
private final boolean mHasAudioPlayback;
private final boolean mHasAudioCapture;
private final boolean mHasMidi;
+ private final boolean mHasVideoPlayback;
+ private final boolean mHasVideoCapture;
/** All interfaces on the device. Initialized on first call to getInterfaceList */
@UnsupportedAppUsage
@@ -77,7 +79,8 @@ public class UsbDevice implements Parcelable {
int protocol, @Nullable String manufacturerName, @Nullable String productName,
@NonNull String version, @NonNull UsbConfiguration[] configurations,
@NonNull IUsbSerialReader serialNumberReader,
- boolean hasAudioPlayback, boolean hasAudioCapture, boolean hasMidi) {
+ boolean hasAudioPlayback, boolean hasAudioCapture, boolean hasMidi,
+ boolean hasVideoPlayback, boolean hasVideoCapture) {
mName = Preconditions.checkNotNull(name);
mVendorId = vendorId;
mProductId = productId;
@@ -92,6 +95,8 @@ public class UsbDevice implements Parcelable {
mHasAudioPlayback = hasAudioPlayback;
mHasAudioCapture = hasAudioCapture;
mHasMidi = hasMidi;
+ mHasVideoPlayback = hasVideoPlayback;
+ mHasVideoCapture = hasVideoCapture;
// Make sure the binder belongs to the system
if (ActivityThread.isSystem()) {
@@ -236,6 +241,16 @@ public class UsbDevice implements Parcelable {
return mHasMidi;
}
+ /** @hide */
+ public boolean getHasVideoPlayback() {
+ return mHasVideoPlayback;
+ }
+
+ /** @hide */
+ public boolean getHasVideoCapture() {
+ return mHasVideoCapture;
+ }
+
/**
* Returns the {@link UsbConfiguration} at the given index.
*
@@ -316,6 +331,8 @@ public class UsbDevice implements Parcelable {
+ ", mHasAudioPlayback=" + mHasAudioPlayback
+ ", mHasAudioCapture=" + mHasAudioCapture
+ ", mHasMidi=" + mHasMidi
+ + ", mHasVideoCapture=" + mHasVideoCapture
+ + ", mHasVideoPlayback=" + mHasVideoPlayback
+ ", mConfigurations=[");
for (int i = 0; i < mConfigurations.length; i++) {
builder.append("\n");
@@ -345,10 +362,12 @@ public class UsbDevice implements Parcelable {
boolean hasAudioPlayback = in.readInt() == 1;
boolean hasAudioCapture = in.readInt() == 1;
boolean hasMidi = in.readInt() == 1;
-
+ boolean hasVideoPlayback = in.readInt() == 1;
+ boolean hasVideoCapture = in.readInt() == 1;
UsbDevice device = new UsbDevice(name, vendorId, productId, clasz, subClass, protocol,
manufacturerName, productName, version, configurations, serialNumberReader,
- hasAudioPlayback, hasAudioCapture, hasMidi);
+ hasAudioPlayback, hasAudioCapture, hasMidi,
+ hasVideoPlayback, hasVideoCapture);
return device;
}
@@ -377,6 +396,8 @@ public class UsbDevice implements Parcelable {
parcel.writeInt(mHasAudioPlayback ? 1 : 0);
parcel.writeInt(mHasAudioCapture ? 1 : 0);
parcel.writeInt(mHasMidi ? 1 : 0);
+ parcel.writeInt(mHasVideoPlayback ? 1 : 0);
+ parcel.writeInt(mHasVideoCapture ? 1 : 0);
}
public static int getDeviceId(String name) {
@@ -407,6 +428,8 @@ public class UsbDevice implements Parcelable {
private final boolean mHasAudioPlayback;
private final boolean mHasAudioCapture;
private final boolean mHasMidi;
+ private final boolean mHasVideoPlayback;
+ private final boolean mHasVideoCapture;
// Temporary storage for serial number. Serial number reader need to be wrapped in a
// IUsbSerialReader as they might be used as PII.
@@ -416,7 +439,8 @@ public class UsbDevice implements Parcelable {
int protocol, @Nullable String manufacturerName, @Nullable String productName,
@NonNull String version, @NonNull UsbConfiguration[] configurations,
@Nullable String serialNumber,
- boolean hasAudioPlayback, boolean hasAudioCapture, boolean hasMidi) {
+ boolean hasAudioPlayback, boolean hasAudioCapture, boolean hasMidi,
+ boolean hasVideoPlayback, boolean hasVideoCapture) {
mName = Preconditions.checkNotNull(name);
mVendorId = vendorId;
mProductId = productId;
@@ -431,6 +455,8 @@ public class UsbDevice implements Parcelable {
mHasAudioPlayback = hasAudioPlayback;
mHasAudioCapture = hasAudioCapture;
mHasMidi = hasMidi;
+ mHasVideoPlayback = hasVideoPlayback;
+ mHasVideoCapture = hasVideoCapture;
}
/**
@@ -443,7 +469,8 @@ public class UsbDevice implements Parcelable {
public UsbDevice build(@NonNull IUsbSerialReader serialReader) {
return new UsbDevice(mName, mVendorId, mProductId, mClass, mSubclass, mProtocol,
mManufacturerName, mProductName, mVersion, mConfigurations, serialReader,
- mHasAudioPlayback, mHasAudioCapture, mHasMidi);
+ mHasAudioPlayback, mHasAudioCapture, mHasMidi,
+ mHasVideoPlayback, mHasVideoCapture);
}
}
}