summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware/usb
Commit message (Collapse)AuthorAgeFilesLines
* UsbDeviceManager: fix b/21429947 regression (try #2)Nick Kralevich2015-08-042-18/+0
| | | | | | | | | | | | | | | | | | | | | | As discussed in b/21429947 (commit 674019065bceb4150190bfb1aa63cda9de0a8560), MTP must always be enabled, even if access to the underlying MTP data is disabled. Otherwise, Android will not enumerate on the USB bus, and won't receive notifications from the kernel about USB state changes. This effectively prevents using MTP functionality on user builds, or on userdebug/eng builds with adb turned off. Always ensure that MTP is the default driver mode. Move the DISALLOW_USB_FILE_TRANSFER filtering of mUsbDataUnlocked from setting time to the time we post the sticky broadcast. Remove isUsbDataUnlocked(). It essentially duplicates data in the sticky broadcast. Bug: 22447614 Bug: 21429947 Change-Id: I9d0d94cadbf6db6281ebd77bfb7162f9d06520c2
* Add USB port manager.Jeff Brown2015-07-156-0/+537
| | | | | | | | | | | | | | | | Add some new internal APIs to enumerate USB Type C ports, query their status, determine whether they support changing power or data roles, and doing so. The API also adds a new ACTION_USB_PORT_CHANGED broadcast for port state changes. The implementation includes a mechanism for simulating the behavior of the USB stack. See 'adb shell dumpsys usb -h' for details. Note that the underlying kernel driver interface is still subject to change but its behavior has been encapsulated as much as possible. Bug: 21615151 Change-Id: I0c853ae179248a4550b3e60d02a7a7e65e4546b2
* Clean up USB Manager and fix ADB.Jeff Brown2015-07-092-44/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | Moved functions which parse the USB functions list into one common place on UsbManager. Deleted the no longer supported USB_FUNCTION_MASS_STORAGE. Ensured that the UserManager.DISALLOW_USB_FILE_TRANSFER rule is consistently applied during user switch and when changing the current USB functions and make sure it only affects MTP and PTP. Collapsed the boot completed and user switched receivers to ensure consistent ordering of side-effects. Validate the list of functions passed to setCurrentFunction() so that the separation of concerns is clearer. It was somewhat ambiguous as to whether functions such as ADB could / should be enabled through that interface. Improved the docs for clarity. Fixed a bunch of broken stuff related to the USB config persistent property (list of default functions) that could cause ADB and other functions to not work at all. Added new failsafes to ensure that we reliably get back into a happy state. Bug: 22206076 Change-Id: I02915ddfce7193a8f67a14f0d76bab22fc575dfa
* Fix USB access control when adb is disabled.Nick Kralevich2015-06-102-0/+50
| | | | | | | | | | | | | | | | | | | | When adb is disabled, the default usb mode would be "none", which would turn off the driver and prevent UsbDeviceManager from receiving any new USB connect / disconnect messages. This prevents the user from ever enabling MTP and sharing data when adb is turned off. As discussed in bug 21429947, we work around this problem by keeping the USB driver in MTP mode most of the time, so that we continue to receive USB connect / disconnect messages. To avoid leaking confidential user photos, this change introduces an unlocked state. Setting the mtp enabled function is now decoupled from exposing data on the USB connection. Only if MTP is enabled and USB data has been unlocked is confidential user data allowed to be shared. Bug: 21429947 Change-Id: Iefb5c7e22dc4962bf5226f2ed3d0155b5c7b413c
* Modify how USB connections are handled.Nick Kralevich2015-05-132-14/+35
| | | | | | | | | | | | | | | * Introduce a new "charger only" mode. In this mode, MTP is disabled, and no file transfers can occur. * Make charger only mode the default. * Modify "persist.sys.usb.config" so it now only holds the adb status. * Make the USB settings non-persistent. Unplugging the USB connection will reset the device back to "charger only" mode. * Fixup wording per UI guidelines. TODO: Re-implement MDM restrictions for USB / MTP access controls. Bug: 18905620 Change-Id: I99a50d9132a81e98187f431166fd9fef4d437e4f
* UsbManager / UsbService / UsbDeviceManager: delete unused codeNick Kralevich2015-05-102-40/+0
| | | | | | These functions are never called. Change-Id: Ic436e1036bed717d2c64701fddd9a810abb9443e
* UsbDevice: Add support for retrieving version string for a USB deviceMike Lockwood2015-04-291-3/+16
| | | | Change-Id: Ia8630f5ffd05f90347b971110a81f4927060cc4b
* MidiManager: Add USB peripheral MIDI supportMike Lockwood2015-01-291-0/+10
| | | | | | | This allows the android device to appear as a USB MIDI device to a USB host (like a Mac or a PC) using the f_midi USB gadget driver. Change-Id: I14f1ba73bcce2c894e77efb8810beac4ffe246d8
* Support for simultaneous USB Audio Devices connect/disconnectPaul McLean2015-01-091-0/+1
| | | | | | | | | | | | | | Attach/Detach logic Decoupling card# and list index Modern loop constructs Consistent logging flags Add class/type flags to device "address" string. Factored UsbAudioDevice out of UsbAudioManager. Bug: 18399845 Bug: 18717784 Change-Id: I6f185e1c24091d4c0d21eb7e922a1496748d32c3
* USB: Minor cleanup from API council reviewMike Lockwood2014-05-202-14/+18
| | | | | Bug: 15089961 Change-Id: I8a22fad94d2a52d2270c89240b2a47bd1cef17b5
* Add support for USB devices with multiple configurations and alternate ↵Mike Lockwood2014-02-274-23/+332
| | | | | | | | | | | | interfaces Added UsbConfiguration class, as well as accessors to UsbDevice to get configuration list Added methods to UsbDeviceConnection to select configurations and alternate interfaces. Also added accessors for USB descriptor name strings and fixed some memory leaks in the JNI code. Bug: 12425052 Change-Id: Idb990f4d5c054a8cb997eb3f440f6da9f83bce05
* am 43bc1c07: am d9e708e3: am 12ec2e6d: am 99206593: am 9607d78f: Merge ↵Mike Lockwood2014-01-081-3/+46
|\ | | | | | | | | | | | | "Added missing USB device descriptor fields needed for intent filters" * commit '43bc1c07d25b7f278a860bbb9118f46ac732593a': Added missing USB device descriptor fields needed for intent filters
| * Merge "Added missing USB device descriptor fields needed for intent filters"Mike Lockwood2014-01-081-3/+46
| |\
| | * Added missing USB device descriptor fields needed for intent filtersRobin Cutshaw2012-11-291-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UsbDevice object is missing the ManufacturerName, ProductName, and SerialNumber fields. These are needed by intent filters to further qualify a USB device that is plugged in while in host mode. These fields have been added in the jni UsbHostManager implementation and propagated through UsbHostManager and UsbDevice implementations. The UsbSettingsManager implementation has been modified to allow manufacturer-name, product-name, and serial-number tags in intents. File changes: modified: api/current.txt modified: core/java/android/hardware/usb/UsbDevice.java modified: services/java/com/android/server/usb/UsbHostManager.java modified: services/java/com/android/server/usb/UsbSettingsManager.java modified: services/jni/com_android_server_UsbHostManager.cpp Change-Id: I386884715d1b732b06a63feb77790be6b59b6fe6 Signed-off-by: Robin Cutshaw <robin.cutshaw@gmail.com>
* | | am 29eadb32: am 9a743575: am 71cdc73d: am 53acc7ae: am f5598210: Merge ↵Narayan Kamath2014-01-082-2/+2
|\ \ \ | |/ / | | | | | | | | | | | | | | | "AArch64: Use long for pointers in hardware classes" * commit '29eadb328a71f912b0d479860286cd606ed3dc87': AArch64: Use long for pointers in hardware classes
| * | AArch64: Use long for pointers in hardware classesAshok Bhat2014-01-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For storing pointers, long is used in hardware classes, as native pointers can be 64-bit. In addition, some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) Change-Id: Icdeb67f9273fb2d8f6d88ca68d7f7d0950796fc1 Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
* | | Remove unused imports from frameworks/base.John Spurlock2013-11-204-8/+0
|/ / | | | | | | Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
* | Undeprecate old UsbDeviceConnection methods.Jeff Brown2013-04-181-20/+22
| | | | | | | | | | | | | | | | Per api review, retain the overloads that do not accept a buffer start offset. Bug: 8656781 Change-Id: Ie00aca7d3a4708700c5ddf60e3309e609788a67f
* | Fix doc build.Ying Wang2013-03-281-2/+2
| | | | | | | | Change-Id: I479df06f2aed33bf29bb8d90be2339a80248beaa
* | Support specifying buffer start offset for USB requests.Jeff Brown2013-03-281-7/+68
| | | | | | | | | | | | | | | | | | | | | | | | Deprecated existing API which only supported passing buffer and length in favor of a new one that also supports passing the start. Being able to pass a start index is very important because the kernel imposes size limits on how much data can be transferred at a time so we often need to transmit large buffers in chunks. Change-Id: I3484b5e68f1ece61d4645ea04be8ee6a3b79169d
* | UsbDebuggingManager: Add interface to clear secure adb keysBenoit Goby2013-01-281-0/+3
|/ | | | | | | This is called from Settings that has a button to clear secure adb public keys installed on the device. Change-Id: I63ef499c049766ef13ea6cb0594ed6719f35e5f3
* Make USB services multi-user aware.Jeff Sharkey2012-10-021-4/+4
| | | | | | | | | | | | | | USB settings are now isolated per-user, since they revolve around installed packages. User-specific settings are returned based on calling user, or referenced by UserHandle passed to SystemUI. Each settings Context is wrapped as a specific user, so all broadcasts are sent correctly. Upgrades any existing USB settings to OWNER. Physical events, like new devices, are routed to the currently active user. Switch to using AtomicFile when persisting settings. Bug: 7244888 Change-Id: I8a723ad3d55ac1bff99276c5f3a3f5e8f013432f
* Add UsbDebuggingManager and UsbDebuggingActivityBenoit Goby2012-08-201-0/+8
| | | | | | | | | | | The UsbDebuggingManager listens to adbd requests and displays a dialog when the public key authentification fails, for the user to confirm if it wants to allow USB debugging from the attached host. If the user chooses to always allow USB debugging, the UsbDebuggingManager writes the public key to adbd's config file so that the public key authenfication succeeds next time. Change-Id: I115c828331d8e326c380844ee33915d5dff22260
* UsbRequest: set ByteBuffer.position() upon success.mike wakerly2012-08-091-4/+8
| | | | | | | | | | Also clears allocated buffer before copying. Closes http://b.android.com/28023 Bug: 5385026 Bug: 6766413 Change-Id: Icf2c1d45db4fb2a9bd1fcfdb29aa7308034faaf0
* Fix typo in UsbManager javadoc.mike wakerly2012-08-091-1/+1
| | | | | | Closes http://b.android.com/32863 Change-Id: I8fc03ee70209413f279f606b393e79c12ee9c0d2
* docs: fix several linksScott Main2012-06-221-1/+1
| | | | Change-Id: I89d9fd64dc22c90680bb05415cc966c255165af9
* UsbService: Add support for accessory initiating USB audio supportMike Lockwood2012-04-261-6/+19
| | | | | Change-Id: I0e468f4b841de9e1ca7b75a05fc58299dbc78222 Signed-off-by: Mike Lockwood <lockwood@google.com>
* Add Intents to notify when USB audio devices or accessories are attachedMike Lockwood2012-04-061-0/+10
| | | | | | | In this change, only the USB audio accessory support is implemented. Change-Id: Id9b411319b07a96dc56649ca74cc5f3f89a55a7c Signed-off-by: Mike Lockwood <lockwood@google.com>
* docs: Add developer guide cross-references, Project ACRE, round 4Joe Fernandez2011-12-225-6/+36
| | | | Change-Id: I1b43414aaec8ea217b39a0d780c80a25409d0991
* UsbManager: add getDefaultFunction()Mike Lockwood2011-08-021-0/+17
| | | | | | | Bug: 5108883 Change-Id: I211f1ee39987da4a5456d86b49b954c564fa3bf4 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbManager: document that passing null setCurrentFunction restores default ↵Mike Lockwood2011-07-181-2/+3
| | | | | | | function Change-Id: I4340b336f3e91b3b8242f2a66c34a7a7f5c3021f Signed-off-by: Mike Lockwood <lockwood@android.com>
* Combine UsbManager.setPrimaryFunction and setDefaultFunctionMike Lockwood2011-06-222-24/+7
| | | | | | | | | | | | | Due to the property trigger on persist.sys.usb.config, setting the default function also sets the current function. Now we combine both of these methods into setCurrentFunction, which has a "makeDefault" option to make the new function the default. This change should eliminate some problems with setting properties due to multiple property triggers happening at the same time. Change-Id: I9851299e9c2ee20475eada1a8104c0d50bf5a9e1 Signed-off-by: Mike Lockwood <lockwood@android.com>
* USB: Support for new USB gadget driversMike Lockwood2011-06-172-31/+52
| | | | | Change-Id: Id08df50acb873a94f4765a991ee6a6f5b898ddf5 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbManager: Clean up extras for ACTION_USB_STATE broadcastMike Lockwood2011-06-081-20/+19
| | | | | | | Also added name for new PTP USB function Change-Id: Ia2775ba2b23ef6a6108ca7e060239eb51c2eecc8 Signed-off-by: Mike Lockwood <lockwood@android.com>
* USB: Add method to access raw USB device descriptorsMike Lockwood2011-05-191-0/+12
| | | | | Change-Id: Id5b46ede14a838198a59bdc8ed4732942044cfa8 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Adding package description for android.hardware.usbRobert Ly2011-04-041-0/+9
| | | | Change-Id: I4d243424c6747531a1ac6ab2230c2af73bad4fed
* Improve Javadoc for USB Manager and MTP/PTP support.Mike Lockwood2011-04-018-36/+205
| | | | | | | Bug: 4091519 Change-Id: Ida79593d5a984f7ffd0934ae7bded23b8faf9eef Signed-off-by: Mike Lockwood <lockwood@android.com>
* Add support for USB accessory serial numbersMike Lockwood2011-03-141-5/+24
| | | | | Change-Id: I47b79f091b300ced60bfc61eff2f771139663aae Signed-off-by: Mike Lockwood <lockwood@android.com>
* USB: minor cleanup workMike Lockwood2011-03-112-4/+4
| | | | | | | Bug: 4067029 Change-Id: Icd8f912ab8732b5f770a217b9b3731092597ce02 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbManager: Hide APIs not needed for USB host or accessory support.Mike Lockwood2011-03-111-1/+25
| | | | | | | Bug: 4067029 Change-Id: Ib63ab95a6571d6a691834bfb583a68d2e4cfd22e Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbDevice: Move IO related methods to new UsbDeviceConnection classMike Lockwood2011-03-116-219/+203
| | | | | | | | | | | | UsbDevice is now just an immutable parcelable object like UsbInterface and UsbEndpoint. All IO related functionality is now contained in UsbDeviceConnection and UsbRequest. Bug: 4067029 Change-Id: Ia84da0b512a697acc940eee0c3566711c62e1a68 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbAccessory: Add URI string, replace type string with descriptionMike Lockwood2011-03-091-17/+37
| | | | | | | | | | | | | | | | This is a first step toward adding USB accessory URI support BUG: 4073248 Modified USB accessory matching logic to look only at manufacturer, model and version (description and URI are not considered when matching apps to accessories) Also added test for USB accessory protocol version to accessorytest BUG: 4080288 Change-Id: I992a3433c74efa7a7db37bf030f02c1f0c92f9e2 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbManager: Fix broken Javadoc linksMike Lockwood2011-03-091-7/+5
| | | | | Change-Id: Ia8ec7b29a7532feb00a28d6d325c129a9e041d2b Signed-off-by: Mike Lockwood <lockwood@android.com>
* Change UsbManager.requestPermission to only grant permission temporarilyMike Lockwood2011-03-094-4/+29
| | | | | | | | | | | | If the user approves an application to access a USB device or accessory without choosing it as the default application, then permission is granted only until the device or accessory is disconnected. Only applications chosen as the default choice have permissions assigned persistently. BUG: 4061035 Change-Id: Ic4f6271a91b2fc56bbeef82c579e26d88c63ae56 Signed-off-by: Mike Lockwood <lockwood@android.com>
* USB: Add API and dialog for apps to request permissions for USB devices and ↵Mike Lockwood2011-03-082-4/+114
| | | | | | | | | | | | | | | | | | | | accessories New APIs: UsbManager.hasPermission returns true if the caller has permission for the given device or accessory UsbManager.requestPermission poses a dialog to allow the user to give the caller permission for the device or accessory. Result is returned via a PendingIntent. No dialog is displayed if the caller already has permission. Also moved UsbResolverActivity to SystemUI package BUG: 4069037 Change-Id: I93be769501a8776b49ac26e468af19f8fa2114c9
* Move USB framework support from android.hardware to android.hardware.usb packageMike Lockwood2011-03-0112-0/+1514
Change-Id: I00fd4f0caaa4aebe48f71c576bb211b5f38bf88d Signed-off-by: Mike Lockwood <lockwood@android.com>