Loading core/java/android/hardware/usb/AccessoryFilter.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package android.hardware.usb; import android.annotation.NonNull; import android.service.usb.UsbAccessoryFilterProto; import com.android.internal.util.dump.DualDumpOutputStream; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -142,4 +147,17 @@ public class AccessoryFilter { "\", mModel=\"" + mModel + "\", mVersion=\"" + mVersion + "\"]"; } /** * Write a description of the filter to a dump stream. */ public void dump(@NonNull DualDumpOutputStream dump, String idName, long id) { long token = dump.start(idName, id); dump.write("manufacturer", UsbAccessoryFilterProto.MANUFACTURER, mManufacturer); dump.write("model", UsbAccessoryFilterProto.MODEL, mModel); dump.write("version", UsbAccessoryFilterProto.VERSION, mVersion); dump.end(token); } } core/java/android/hardware/usb/DeviceFilter.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package android.hardware.usb; import android.annotation.NonNull; import android.service.usb.UsbDeviceFilterProto; import android.util.Slog; import com.android.internal.util.dump.DualDumpOutputStream; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -310,4 +314,22 @@ public class DeviceFilter { ",mProductName=" + mProductName + ",mSerialNumber=" + mSerialNumber + "]"; } /** * Write a description of the filter to a dump stream. */ public void dump(@NonNull DualDumpOutputStream dump, String idName, long id) { long token = dump.start(idName, id); dump.write("vendor_id", UsbDeviceFilterProto.VENDOR_ID, mVendorId); dump.write("product_id", UsbDeviceFilterProto.PRODUCT_ID, mProductId); dump.write("class", UsbDeviceFilterProto.CLASS, mClass); dump.write("subclass", UsbDeviceFilterProto.SUBCLASS, mSubclass); dump.write("protocol", UsbDeviceFilterProto.PROTOCOL, mProtocol); dump.write("manufacturer_name", UsbDeviceFilterProto.MANUFACTURER_NAME, mManufacturerName); dump.write("product_name", UsbDeviceFilterProto.PRODUCT_NAME, mProductName); dump.write("serial_number", UsbDeviceFilterProto.SERIAL_NUMBER, mSerialNumber); dump.end(token); } } core/java/android/hardware/usb/UsbConfiguration.java +12 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import com.android.internal.util.Preconditions; /** Loading Loading @@ -105,6 +106,17 @@ public class UsbConfiguration implements Parcelable { return (mAttributes & ATTR_REMOTE_WAKEUP) != 0; } /** * Returns the attributes of this configuration * * @return the configuration's attributes * * @hide */ public int getAttributes() { return mAttributes; } /** * Returns the configuration's max power consumption, in milliamps. * Loading core/java/android/hardware/usb/UsbConstants.java +12 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware.usb; import android.service.ServiceProtoEnums; /** * Contains constants for the USB protocol. * These constants correspond to definitions in linux/usb/ch9.h in the linux kernel. Loading @@ -35,12 +37,12 @@ public final class UsbConstants { * Used to signify direction of data for a {@link UsbEndpoint} is OUT (host to device) * @see UsbEndpoint#getDirection */ public static final int USB_DIR_OUT = 0; public static final int USB_DIR_OUT = ServiceProtoEnums.USB_ENDPOINT_DIR_OUT; // 0 /** * Used to signify direction of data for a {@link UsbEndpoint} is IN (device to host) * @see UsbEndpoint#getDirection */ public static final int USB_DIR_IN = 0x80; public static final int USB_DIR_IN = ServiceProtoEnums.USB_ENDPOINT_DIR_IN; // 0x80 /** * Bitmask used for extracting the {@link UsbEndpoint} number its address field. Loading @@ -63,22 +65,26 @@ public final class UsbConstants { * Control endpoint type (endpoint zero) * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_CONTROL = 0; public static final int USB_ENDPOINT_XFER_CONTROL = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_CONTROL; // 0 /** * Isochronous endpoint type (currently not supported) * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_ISOC = 1; public static final int USB_ENDPOINT_XFER_ISOC = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_ISOC; // 1 /** * Bulk endpoint type * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_BULK = 2; public static final int USB_ENDPOINT_XFER_BULK = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_BULK; // 2 /** * Interrupt endpoint type * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_INT = 3; public static final int USB_ENDPOINT_XFER_INT = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_INT; // 3 /** Loading core/java/com/android/internal/print/DumpUtils.java +4 −34 Original line number Diff line number Diff line Loading @@ -16,10 +16,9 @@ package com.android.internal.print; import static com.android.internal.util.dump.DumpUtils.writeComponentName; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; import android.content.ComponentNameProto; import android.content.Context; import android.print.PageRange; import android.print.PrintAttributes; Loading @@ -40,41 +39,12 @@ import android.service.print.PrinterIdProto; import android.service.print.PrinterInfoProto; import android.service.print.ResolutionProto; import com.android.internal.util.dump.DualDumpOutputStream; /** * Utilities for dumping print related proto buffer */ public class DumpUtils { /** * Write a string to a proto if the string is not {@code null}. * * @param proto The proto to write to * @param idName Clear text name of the proto-id * @param id The proto-id of the string * @param string The string to write */ public static void writeStringIfNotNull(@NonNull DualDumpOutputStream proto, String idName, long id, @Nullable String string) { if (string != null) { proto.write(idName, id, string); } } /** * Write a {@link ComponentName} to a proto. * * @param proto The proto to write to * @param idName Clear text name of the proto-id * @param id The proto-id of the component name * @param component The component name to write */ public static void writeComponentName(@NonNull DualDumpOutputStream proto, String idName, long id, @NonNull ComponentName component) { long token = proto.start(idName, id); proto.write("package_name", ComponentNameProto.PACKAGE_NAME, component.getPackageName()); proto.write("class_name", ComponentNameProto.CLASS_NAME, component.getClassName()); proto.end(token); } /** * Write a {@link PrinterId} to a proto. * Loading Loading
core/java/android/hardware/usb/AccessoryFilter.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package android.hardware.usb; import android.annotation.NonNull; import android.service.usb.UsbAccessoryFilterProto; import com.android.internal.util.dump.DualDumpOutputStream; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -142,4 +147,17 @@ public class AccessoryFilter { "\", mModel=\"" + mModel + "\", mVersion=\"" + mVersion + "\"]"; } /** * Write a description of the filter to a dump stream. */ public void dump(@NonNull DualDumpOutputStream dump, String idName, long id) { long token = dump.start(idName, id); dump.write("manufacturer", UsbAccessoryFilterProto.MANUFACTURER, mManufacturer); dump.write("model", UsbAccessoryFilterProto.MODEL, mModel); dump.write("version", UsbAccessoryFilterProto.VERSION, mVersion); dump.end(token); } }
core/java/android/hardware/usb/DeviceFilter.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package android.hardware.usb; import android.annotation.NonNull; import android.service.usb.UsbDeviceFilterProto; import android.util.Slog; import com.android.internal.util.dump.DualDumpOutputStream; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -310,4 +314,22 @@ public class DeviceFilter { ",mProductName=" + mProductName + ",mSerialNumber=" + mSerialNumber + "]"; } /** * Write a description of the filter to a dump stream. */ public void dump(@NonNull DualDumpOutputStream dump, String idName, long id) { long token = dump.start(idName, id); dump.write("vendor_id", UsbDeviceFilterProto.VENDOR_ID, mVendorId); dump.write("product_id", UsbDeviceFilterProto.PRODUCT_ID, mProductId); dump.write("class", UsbDeviceFilterProto.CLASS, mClass); dump.write("subclass", UsbDeviceFilterProto.SUBCLASS, mSubclass); dump.write("protocol", UsbDeviceFilterProto.PROTOCOL, mProtocol); dump.write("manufacturer_name", UsbDeviceFilterProto.MANUFACTURER_NAME, mManufacturerName); dump.write("product_name", UsbDeviceFilterProto.PRODUCT_NAME, mProductName); dump.write("serial_number", UsbDeviceFilterProto.SERIAL_NUMBER, mSerialNumber); dump.end(token); } }
core/java/android/hardware/usb/UsbConfiguration.java +12 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import com.android.internal.util.Preconditions; /** Loading Loading @@ -105,6 +106,17 @@ public class UsbConfiguration implements Parcelable { return (mAttributes & ATTR_REMOTE_WAKEUP) != 0; } /** * Returns the attributes of this configuration * * @return the configuration's attributes * * @hide */ public int getAttributes() { return mAttributes; } /** * Returns the configuration's max power consumption, in milliamps. * Loading
core/java/android/hardware/usb/UsbConstants.java +12 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware.usb; import android.service.ServiceProtoEnums; /** * Contains constants for the USB protocol. * These constants correspond to definitions in linux/usb/ch9.h in the linux kernel. Loading @@ -35,12 +37,12 @@ public final class UsbConstants { * Used to signify direction of data for a {@link UsbEndpoint} is OUT (host to device) * @see UsbEndpoint#getDirection */ public static final int USB_DIR_OUT = 0; public static final int USB_DIR_OUT = ServiceProtoEnums.USB_ENDPOINT_DIR_OUT; // 0 /** * Used to signify direction of data for a {@link UsbEndpoint} is IN (device to host) * @see UsbEndpoint#getDirection */ public static final int USB_DIR_IN = 0x80; public static final int USB_DIR_IN = ServiceProtoEnums.USB_ENDPOINT_DIR_IN; // 0x80 /** * Bitmask used for extracting the {@link UsbEndpoint} number its address field. Loading @@ -63,22 +65,26 @@ public final class UsbConstants { * Control endpoint type (endpoint zero) * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_CONTROL = 0; public static final int USB_ENDPOINT_XFER_CONTROL = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_CONTROL; // 0 /** * Isochronous endpoint type (currently not supported) * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_ISOC = 1; public static final int USB_ENDPOINT_XFER_ISOC = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_ISOC; // 1 /** * Bulk endpoint type * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_BULK = 2; public static final int USB_ENDPOINT_XFER_BULK = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_BULK; // 2 /** * Interrupt endpoint type * @see UsbEndpoint#getType */ public static final int USB_ENDPOINT_XFER_INT = 3; public static final int USB_ENDPOINT_XFER_INT = ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_INT; // 3 /** Loading
core/java/com/android/internal/print/DumpUtils.java +4 −34 Original line number Diff line number Diff line Loading @@ -16,10 +16,9 @@ package com.android.internal.print; import static com.android.internal.util.dump.DumpUtils.writeComponentName; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; import android.content.ComponentNameProto; import android.content.Context; import android.print.PageRange; import android.print.PrintAttributes; Loading @@ -40,41 +39,12 @@ import android.service.print.PrinterIdProto; import android.service.print.PrinterInfoProto; import android.service.print.ResolutionProto; import com.android.internal.util.dump.DualDumpOutputStream; /** * Utilities for dumping print related proto buffer */ public class DumpUtils { /** * Write a string to a proto if the string is not {@code null}. * * @param proto The proto to write to * @param idName Clear text name of the proto-id * @param id The proto-id of the string * @param string The string to write */ public static void writeStringIfNotNull(@NonNull DualDumpOutputStream proto, String idName, long id, @Nullable String string) { if (string != null) { proto.write(idName, id, string); } } /** * Write a {@link ComponentName} to a proto. * * @param proto The proto to write to * @param idName Clear text name of the proto-id * @param id The proto-id of the component name * @param component The component name to write */ public static void writeComponentName(@NonNull DualDumpOutputStream proto, String idName, long id, @NonNull ComponentName component) { long token = proto.start(idName, id); proto.write("package_name", ComponentNameProto.PACKAGE_NAME, component.getPackageName()); proto.write("class_name", ComponentNameProto.CLASS_NAME, component.getClassName()); proto.end(token); } /** * Write a {@link PrinterId} to a proto. * Loading