@Implementation(minSdk = M) @HiddenApi protected void setPortRoles( /* UsbPort */ Object port, /* int */ Object powerRole, /* int */ Object dataRole) { UsbPortStatus status = usbPorts.get(port); usbPorts.put( (UsbPort) port, new UsbPortStatus( status.getCurrentMode(), (int) powerRole, (int) dataRole, status.getSupportedRoleCombinations())); application.sendBroadcast(new Intent(UsbManager.ACTION_USB_PORT_CHANGED)); }
/** Adds a USB port to UsbManager. */ public void addPort(String portId) { usbPorts.put( callConstructor(UsbPort.class, from(String.class, portId), from(int.class, getStaticField(UsbPort.class, "MODE_DUAL"))), new UsbPortStatus( getStaticField(UsbPort.class, "MODE_DUAL"), getStaticField(UsbPort.class, "POWER_ROLE_SINK"), getStaticField(UsbPort.class, "DATA_ROLE_DEVICE"), 0)); }
/** Adds a USB port to UsbManager. */ public void addPort(String portId) { usbPorts.put( new UsbPort(portId, UsbPort.MODE_DUAL), new UsbPortStatus(UsbPort.MODE_DUAL, UsbPort.POWER_ROLE_SINK, UsbPort.DATA_ROLE_DEVICE, 0)); }
@Implementation(minSdk = M) @HiddenApi protected void setPortRoles( /* UsbPort */ Object port, /* int */ Object powerRole, /* int */ Object dataRole) { UsbPortStatus status = usbPorts.get(port); usbPorts.put( (UsbPort) port, new UsbPortStatus( status.getCurrentMode(), (int) powerRole, (int) dataRole, status.getSupportedRoleCombinations())); application.sendBroadcast(new Intent(UsbManager.ACTION_USB_PORT_CHANGED)); }