Search in sources :

Example 6 with UsbPort

use of android.hardware.usb.UsbPort in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UsbBackend method updatePorts.

private void updatePorts() {
    mPort = null;
    mPortStatus = null;
    List<UsbPort> ports = mUsbManager.getPorts();
    // For now look for a connected port, in the future we should identify port in the
    // notification and pick based on that.
    final int N = ports.size();
    for (int i = 0; i < N; i++) {
        UsbPortStatus status = ports.get(i).getStatus();
        if (status.isConnected()) {
            mPort = ports.get(i);
            mPortStatus = status;
            break;
        }
    }
}
Also used : UsbPortStatus(android.hardware.usb.UsbPortStatus) UsbPort(android.hardware.usb.UsbPort)

Aggregations

UsbPort (android.hardware.usb.UsbPort)6 UsbPortStatus (android.hardware.usb.UsbPortStatus)4 Test (org.junit.Test)2 Config (org.robolectric.annotation.Config)2 TargetApi (android.annotation.TargetApi)1