diff options
| author | Paul Mclean <pmclean@google.com> | 2019-10-21 17:24:11 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-10-21 17:24:11 +0000 |
| commit | b151f19422cfdfadeb6e6ee1a83c65b2279ff67c (patch) | |
| tree | aa80453264ef121d508e6a8581f24e1ce4678887 /core/java | |
| parent | 08fddb89b54af4de3e10da3483755a6a4f404a5c (diff) | |
| parent | a7e7f94f98ab425e72403e60d9a5e06cc0e30dc7 (diff) | |
Merge "Add video class-specific descriptors to UsbDescriptorParser framework."
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/hardware/usb/UsbDevice.java | 37 |
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); } } } |
