Thanks to Chris, all of my questions were answered by running dmesg
via adb shell
.
"What are the possible scenarios which would cause UsbManager.ACTION_USB_DEVICE_DETACHED to be broadcast? Is it only when a device is physically disconnected or are there other software related "detachments"?"
Physically unplugging the USB cable causes a UsbManager.ACTION_USB_DEVICE_DETACHED message to be broadcast but it is not the only cause. The message can also be broadcast if the USB port is reset, which happens if there is too much noise (EMI) on the line:
<3>[ 114.337430] c0 hub 2-0:1.0: port 1 disabled by hub (EMI?), re-enabling...
"If there are multiple scenarios, is there a way that I can obtain more information about each individual disconnect (i.e. the cause) so that I can recover from them gracefully?"
Run dmesg
from adb shell
after receiving the broadcast to determine the root cause of the disconnect. In this case, my cable was susceptible to noise which caused the port to be disabled then re-enabled. My solution was to shield the cable in the location where I modified it.