Add svc usb resetUsbGadget method

Add svc usb resetUsbGadget method for usb control.

Bug: 138702846
Test: adb shell svc usb resetUsbGadget
Change-Id: I260a280f20cc924e28201baf2f5ccbd67318772f
This commit is contained in:
Howard Yen
2019-11-26 15:43:37 +08:00
parent db8f11654b
commit 5665bacc22

View File

@@ -42,7 +42,9 @@ public class UsbCommand extends Svc.Command {
+ " Sets the functions which, if the device was charging, become current on"
+ "screen unlock. If function is blank, turn off this feature.\n"
+ " svc usb getFunctions\n"
+ " Gets the list of currently enabled functions\n\n"
+ " Gets the list of currently enabled functions\n"
+ " svc usb resetUsbGadget\n"
+ " Reset usb gadget\n\n"
+ "possible values of [function] are any of 'mtp', 'ptp', 'rndis', 'midi'\n";
}
@@ -75,6 +77,13 @@ public class UsbCommand extends Svc.Command {
System.err.println("Error communicating with UsbManager: " + e);
}
return;
} else if ("resetUsbGadget".equals(args[1])) {
try {
usbMgr.resetUsbGadget();
} catch (RemoteException e) {
System.err.println("Error communicating with UsbManager: " + e);
}
return;
}
}
System.err.println(longHelp());