diff options
author | Jerry Zhang <zhangjerry@google.com> | 2017-02-15 14:15:30 -0800 |
---|---|---|
committer | Jerry Zhang <zhangjerry@google.com> | 2017-02-16 13:14:50 -0800 |
commit | ca1663a093b43e0d1211017adeb77a8ecd53b9f2 (patch) | |
tree | ef12e85942af2b294bedeee8165316b29727784c /cmds/svc/src | |
parent | 30a2d638c0fa8e48bc27494b22ae6e49c231809a (diff) |
Add data unlock argument to set function command.
This allows automated switches into file transfer mode,
which makes automated Mtp testing possible.
Test: adb shell svc setFunction mtp true
Bug: 25596495
Change-Id: I67be58853b002789dc22b75d82af9eb6cfb7a361
Diffstat (limited to 'cmds/svc/src')
-rw-r--r-- | cmds/svc/src/com/android/commands/svc/UsbCommand.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmds/svc/src/com/android/commands/svc/UsbCommand.java b/cmds/svc/src/com/android/commands/svc/UsbCommand.java index 4dcb05e4f85d..adbe9d015626 100644 --- a/cmds/svc/src/com/android/commands/svc/UsbCommand.java +++ b/cmds/svc/src/com/android/commands/svc/UsbCommand.java @@ -36,8 +36,8 @@ public class UsbCommand extends Svc.Command { public String longHelp() { return shortHelp() + "\n" + "\n" - + "usage: svc usb setFunction [function]\n" - + " Set the current usb function.\n\n" + + "usage: svc usb setFunction [function] [usbDataUnlocked=false]\n" + + " Set the current usb function and optionally the data lock state.\n\n" + " svc usb getFunction\n" + " Gets the list of currently enabled functions\n"; } @@ -49,8 +49,12 @@ public class UsbCommand extends Svc.Command { if ("setFunction".equals(args[1])) { IUsbManager usbMgr = IUsbManager.Stub.asInterface(ServiceManager.getService( Context.USB_SERVICE)); + boolean unlockData = false; + if (args.length >= 4) { + unlockData = Boolean.valueOf(args[3]); + } try { - usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null), false); + usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null), unlockData); } catch (RemoteException e) { System.err.println("Error communicating with UsbManager: " + e); } |