android – How to evaluate the USB port to be connected or disconnected

I have this snippet of code in Android to access the USB port, can anyone tell me how I can evaluate the USB port to have been connected or disconnected ?, in what part of this code?

This is the code:

                    @Cancel
public void onResume () {
super.onResume ();
setFilters (); // Start listening to UsbService notifications
startService (UsbService.class, usbConnection, null); // Start UsbService (if it was not started before) and link it
}

Private vacuum start service (Class service, ServiceConnection serviceConnection, Bundle extras) {
if (! UsbService.SERVICE_CONNECTED) {
Intention startService = new Intent (this, service);
if (extras! = null &&! extras.isEmpty ()) {
Set keys = extras.keySet ();
for (String key: keys) {
String extra = extras.getString (key);
startService.putExtra (key, extra);
}
}
startService (startService);
}
Intent bindingIntent = new Intent (this, service);
bindService (bindingIntent, serviceConnection, Context.BIND_AUTO_CREATE);
statusUSB = true;
}

empty empty setFilters () {
Filter IntentFilter = new IntentFilter ();
filter.addAction (UsbService.ACTION_USB_PERMISSION_GRANTED);
filter.addAction (ACTION_NO_USB);
filter.addAction (UsbService.ACTION_USB_DISCONNECTED);
filter.addAction (UsbService.ACTION_USB_NOT_SUPPORTED);
filter.addAction (UsbService.ACTION_USB_PERMISSION_NOT_GRANTED);
registerReceiver (mUsbReceiver, filter);
}