USB: HAL: Add USB audio device bus reset recovery

During a USB bus reset, the USB host stack does not generate a removal
uevent to the USB framework.  The UsbHostManager class only relies on the
remove uevent to signal USB ALSA to stop routing audio data to the USB
headset.  Due to this limitation, when a bus reset occurs, ALSA assumes the
USB headset path is still active, and attempts to play audio to it.
However, since the audio session is never re-initialized, it results in
muted audio.

Recovery summary:
- Utilizes the authorized sysfs file to generate a device disconnect, so
that userspace can detect proper headset removal.
- Triggers off unbinding of the USB audio interfaces (not removal), which
occurs during bus reset.
- Limited to when USB headsets are connected directly to the root hub. (do
not want to disturb non-audio devices connected to an external hub)

If a disconnect is not seen after all interfaces have been unbinded (300ms
timeout) then the disconnect monitor pthread will de-authorize the root
hub.  This will generate a disconnect uevent, in which parameters are
cleaned up based on the session.  If an external hub (and devices) are
connected, then the interface counter will never reach 0, and the recovery
does not happen when a bus reset occurs (expected).

Change-Id: Ic41daf4c742e22b2aba13a270ff4d63249c0279e
1 file changed
tree: 032068258d2d8416735d7650f09f120e7a191f9d
  1. etc/
  2. hal/
  3. vendor_product.mk