@Implements(value=android.hardware.usb.UsbManager.class) public class ShadowUsbManager extends java.lang.Object
Robolectric implementation of UsbManager
.
Constructor and Description |
---|
ShadowUsbManager() |
Modifier and Type | Method and Description |
---|---|
void |
addOrUpdateUsbDevice(android.hardware.usb.UsbDevice usbDevice,
boolean hasPermission)
Adds a USB device into available USB devices map with permission value.
|
protected java.util.HashMap<java.lang.String,android.hardware.usb.UsbDevice> |
getDeviceList()
Returns a HashMap containing all USB devices currently attached.
|
protected boolean |
hasPermission(android.hardware.usb.UsbDevice device)
Returns true if the caller has permission to access the device.
|
protected android.os.ParcelFileDescriptor |
openAccessory(android.hardware.usb.UsbAccessory accessory)
Opens a file descriptor from a temporary file.
|
void |
removeUsbDevice(android.hardware.usb.UsbDevice usbDevice)
Removes a USB device from available USB devices map.
|
void |
reset()
Clears all the data of
ShadowUsbManager . |
@Implementation protected boolean hasPermission(android.hardware.usb.UsbDevice device)
Returns true if the caller has permission to access the device.
@Implementation protected java.util.HashMap<java.lang.String,android.hardware.usb.UsbDevice> getDeviceList()
Returns a HashMap containing all USB devices currently attached. USB device name is the key for the returned HashMap. The result will be empty if no devices are attached, or if USB host mode is inactive or unsupported.
public void reset()
Clears all the data of ShadowUsbManager
.
public void addOrUpdateUsbDevice(android.hardware.usb.UsbDevice usbDevice, boolean hasPermission)
Adds a USB device into available USB devices map with permission value. If the USB device already exists, updates the USB device with new permission value.
public void removeUsbDevice(android.hardware.usb.UsbDevice usbDevice)
Removes a USB device from available USB devices map.
@Implementation protected android.os.ParcelFileDescriptor openAccessory(android.hardware.usb.UsbAccessory accessory)
Opens a file descriptor from a temporary file.