shadows/framework/src/main/java/org/robolectric/shadows/ShadowUsbManager.java
public void addPort(String portId) {
    if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.Q) {
      usbPorts.put(
          (UsbPort) createUsbPort(realUsbManager, portId, UsbPortStatus.MODE_DUAL),
          (UsbPortStatus) createUsbPortStatus(
              UsbPortStatus.MODE_DUAL,
              UsbPortStatus.POWER_ROLE_SINK,
              UsbPortStatus.DATA_ROLE_DEVICE,
              0));
      return;
    }

    usbPorts.put(
        callConstructor(UsbPort.class,
            from(String.class, portId),
            from(int.class, getStaticField(UsbPort.class, "MODE_DUAL"))),
        (UsbPortStatus) createUsbPortStatus(
            getStaticField(UsbPort.class, "MODE_DUAL"),
            getStaticField(UsbPort.class, "POWER_ROLE_SINK"),
            getStaticField(UsbPort.class, "DATA_ROLE_DEVICE"),
            0));
  }
public void addPort(String portId) {
    if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.Q) {
      usbPorts.put(
          (UsbPort) createUsbPort(realUsbManager, portId, UsbPortStatus.MODE_DUAL),
          (UsbPortStatus) createUsbPortStatus(
              UsbPortStatus.MODE_DUAL,
              UsbPortStatus.POWER_ROLE_SINK,
              UsbPortStatus.DATA_ROLE_DEVICE,
              0));
      return;
    }

    usbPorts.put(
        callConstructor(UsbPort.class,
            from(String.class, portId),
            from(int.class, getStaticField(UsbPort.class, "MODE_DUAL"))),
        (UsbPortStatus) createUsbPortStatus(
            getStaticField(UsbPort.class, "MODE_DUAL"),
            getStaticField(UsbPort.class, "POWER_ROLE_SINK"),
            getStaticField(UsbPort.class, "DATA_ROLE_DEVICE"),
            0));
  }
public void addPort ( String portId ) { if ( RuntimeEnvironment . getApiLevel ( ) >= Build . VERSION_CODES . Q ) { usbPorts . put ( ( UsbPort ) createUsbPort ( realUsbManager , portId , UsbPortStatus . MODE_DUAL ) , ( UsbPortStatus ) createUsbPortStatus ( UsbPortStatus . MODE_DUAL , UsbPortStatus . POWER_ROLE_SINK , UsbPortStatus . DATA_ROLE_DEVICE , 0 ) ) ; return ; } usbPorts . put ( callConstructor ( UsbPort . class , from ( String . class , portId ) , from ( int . class , getStaticField ( UsbPort . class , "MODE_DUAL" ) ) ) , ( UsbPortStatus ) createUsbPortStatus ( getStaticField ( UsbPort . class , "MODE_DUAL" ) , getStaticField ( UsbPort . class , "POWER_ROLE_SINK" ) , getStaticField ( UsbPort . class , "DATA_ROLE_DEVICE" ) , 0 ) ) ; }
Adds a USB port to UsbManager.
Adds a USB port to UsbManager .