Skip to content
Snippets Groups Projects
Commit 7dbfa572 authored by RD Babiera's avatar RD Babiera Committed by Android (Google) Code Review
Browse files

Merge "frameworks/base: usb: Add enableUsbData to dumpsys commands" into main

parents 8aa6f211 8a2f8ae2
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.IDisplayPortAltModeInfoListener;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.IUsbOperationInternal;
import android.hardware.usb.ParcelableUsbPort;
import android.hardware.usb.UsbAccessory;
......@@ -46,7 +46,6 @@ import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.hardware.usb.UsbPort;
import android.hardware.usb.UsbPortStatus;
import android.hardware.usb.DisplayPortAltModeInfo;
import android.os.Binder;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
......@@ -1215,6 +1214,20 @@ public class UsbService extends IUsbManager.Stub {
mPortManager.dump(new DualDumpOutputStream(new IndentingPrintWriter(pw, " ")),
"", 0);
}
} else if ("enable-usb-data".equals(args[0]) && args.length == 3) {
final String portId = args[1];
final boolean enable = Boolean.parseBoolean(args[2]);
if (mPortManager != null) {
for (UsbPort p : mPortManager.getPorts()) {
if (p.getId().equals(portId)) {
int res = p.enableUsbData(enable);
Slog.i(TAG, "enableUsbData " + portId + " status " + res);
break;
}
}
}
} else if ("ports".equals(args[0]) && args.length == 1) {
if (mPortManager != null) {
mPortManager.dump(new DualDumpOutputStream(new IndentingPrintWriter(pw, " ")),
......@@ -1293,6 +1306,11 @@ public class UsbService extends IUsbManager.Stub {
pw.println("reset-displayport-status can also be used in order to set");
pw.println("the DisplayPortInfo to default values.");
pw.println();
pw.println("Example enableUsbData");
pw.println("This dumpsys command functions for both simulated and real ports.");
pw.println(" dumpsys usb enable-usb-data \"matrix\" true");
pw.println(" dumpsys usb enable-usb-data \"matrix\" false");
pw.println();
pw.println("Example USB device descriptors:");
pw.println(" dumpsys usb dump-descriptors -dump-short");
pw.println(" dumpsys usb dump-descriptors -dump-tree");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment