summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/UsbService.java
Commit message (Collapse)AuthorAgeFilesLines
* UsbManager: Enhancements for managing USB devices and accessoriesMike Lockwood2011-02-281-522/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a USB device or accessory is connected, the UsbService now asks the user which application to associate with the device or accessory. Applications interested in devices or accessories must specify the devices they work with via meta-data attached to their manifest. Permission to communicate with the device is assigned when the user chooses the activity to use for the device. The user has the option of clicking the "always use this application" checkbox to make the assignment automatic in the future. The user may later clear this preference and revoke permission for an application to have permission to communicate with the device by clicking the "Clear defaults" button for the activity in the Manage Applications panel in Settings. Added class UsbResolveActivity (a subclass or ResolveActivity for choosing an activity for a USB device or accessory) Added UsbDeviceManager, which manages the mapping between USB devices/accessories and applications, including default applications for devices and accessories, and manages application permissions. Add interface to allow Settings to clear device and accessory preferences and permissions for an application. Remove obsolete ACCESS_USB permission. Add new signatureOrSystem MANAGE_USB permission to allow administrating preferences and permissions. Moved UsbService.java to a "usb" subdirectory, along with new classes UsbResolveActivity and UsbDeviceManager. Change-Id: I92554381e9779e68ce380daaee4e1401fb875703 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbManager: Remove redundant Intent extras from USB device and accessory ↵Mike Lockwood2011-02-231-20/+1
| | | | | | | | | | | | broadcasts These extras are also accessable via the UsbDevice and UsbAccessory classes, which are also included as extras. Since you can't filter Intents based on extras there is no point in duplicating this information as separate extras. Change-Id: I4c8d1e70d66023a1800b3f8f06118898da6b37af Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbService: Re-enable previously enabled functions when exiting accessory modeMike Lockwood2011-02-221-56/+113
| | | | | | | Also added comments and cleaned up synchronization Change-Id: I92ce1f84f6eeac8d640687506083b96a59fc71b5 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbManager: New APIs for USB accessoriesMike Lockwood2011-02-161-29/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB accessories are peripherals that connect to android devices as a USB host. When connected, the accessory will first identify itself to the android device by sending manufacturer, product, accessory type and version strings to the device, and then request the device to enter USB accessory mode. The device will then enable the USB accessory kernel driver and disable all other USB functionality except possibly adb (adb can be used while the android device is connected to the PC and the PC is running software that emulates a USB accessory) The class android.hardware.UsbAccessory is used to describe the currently attached USB accessory. UsbAccessory contains the manufacturer, product, accessory type and version strings to identify the accessory. The accessory can be opened as a ParcelFileDescriptor, which can be used to communicate with the accessory over two bulk endpoints. The Intents UsbManager.USB_ACCESSORY_ATTACHED and UsbManager.USB_ACCESSORY_DETACHED are broadcast when accessories are connected and disconnected to the device. The USB_ACCESSORY_ATTACHED contains a UsbAccessory object for the attached accessory as an extra. The Intent also contains string extras for the manufacturer, product, accessory type and version strings to allow filtering on these strings. Change-Id: Ie77cbf51814a4aa44a6b1e62673bfe4c6aa81755 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbService: Blacklist HID boot subclass devices (keyboards and mice)Mike Lockwood2011-02-011-13/+22
| | | | | Change-Id: I80558c6205e041ad730c7815aba97cb80132e820 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbService: Add support for blacklisting certain USB bussesMike Lockwood2011-02-011-0/+23
| | | | | | | | This can be used to prevent applications from connecting to sensitive internal USB devices (like the modem) Change-Id: I6587f58018e3f8d8f78405d4004cce64db23b628 Signed-off-by: Mike Lockwood <lockwood@android.com>
* New APIs for USB host support:Mike Lockwood2011-01-221-3/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | UsbManager: - is now a service retrievable via Context.getSystemService(Context.USB_SERVICE). - provides support for returning a list all connected USB devices - broadcasts ACTION_USB_DEVICE_ATTACHED and USB_DEVICE_DETACHED when devices are added and removed from the USB host bus UsbDevice: - represents an attached USB device. UsbInterface: - represents an interface on a USB device - devices may have multiple interfaces if they provide multiple sets of functionality (for example, android phones typically have interfaces for both USB mass storage and adb) UsbEndpoint: - represents an endpoint on a USB interface - endpoints are used for sending or receiving data (only in one or the other direction) UsbRequest: - encapsulates a send or receive request to be sent over an endpoint Change-Id: Ieef3e434c62760770ea839070cf5eba1a705967a Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbService: Remove stack-trace message during boot.David 'Digit' Turner2011-01-171-4/+9
| | | | | | | | | | | This removes a stack trace message during the boot under emulation. The observers tried to access a null reference when no USB configuration is supported by the emulated device. So do not start them in this case. + Change a Slog.w into a Slog.i since this is an acceptable condition. Change-Id: I126b7f05c9648e39a060eb0974cc6f4ac7533791
* Temporarily remove UsbManager support for USB host.Mike Lockwood2011-01-061-27/+1
| | | | | | | A new USB host API will be added in an upcoming commit Change-Id: I5816c10c7acd236d31ab8ae255fc83c77121eea0 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Clean up USB notifications:Mike Lockwood2010-12-141-42/+67
| | | | | | | | | | | | | | | Add support for separate USB connected and configuration events Include both USB connected/disconnected and configuration state in USB_STATE Intent Remove redundant USB_CONNECTED and USB_DISCONNECTED Intents Now we just have the sticky USB_STATE broadcast Move USB disconnnect rebouncing from Tethering to UsbService Change-Id: Id13eb0c5d51152d2a538985d680ba1db7d2241dc Signed-off-by: Mike Lockwood <lockwood@android.com>
* Rename android.hardware.Usb to UsbManager and UsbObserver to UsbServiceMike Lockwood2010-12-091-0/+248
In preparation for an upcoming change that will make UsbService into a real system service Change-Id: Id85d624cfc6b10b49a08105cfaaacc667a492c12 Signed-off-by: Mike Lockwood <lockwood@android.com>