public boolean setStatus( int currentMode, boolean canChangeMode, int currentPowerRole, boolean canChangePowerRole, int currentDataRole, boolean canChangeDataRole, int supportedRoleCombinations) { mCanChangeMode = canChangeMode; mCanChangePowerRole = canChangePowerRole; mCanChangeDataRole = canChangeDataRole; if (mUsbPortStatus == null || mUsbPortStatus.getCurrentMode() != currentMode || mUsbPortStatus.getCurrentPowerRole() != currentPowerRole || mUsbPortStatus.getCurrentDataRole() != currentDataRole || mUsbPortStatus.getSupportedRoleCombinations() != supportedRoleCombinations) { mUsbPortStatus = new UsbPortStatus( currentMode, currentPowerRole, currentDataRole, supportedRoleCombinations); return true; } return false; }
public void updateHostState(UsbPort port, UsbPortStatus status) { boolean hostConnected = status.getCurrentDataRole() == UsbPort.DATA_ROLE_HOST; obtainMessage(MSG_UPDATE_HOST_STATE, hostConnected ? 1 : 0, 0).sendToTarget(); }