Android devices can work in USB host or device mode. Host is the one which controls USB communication. PCs mostly operate in host mode. Device is the one which is being powered and controlled by the host. Flash drive is a common example of USB device. Linux/Android kernel supports device mode through different gadget drivers. UMS, MTP, ADB are different gadget modes on Android devices.
Audio over USB in Device Mode
On Android devices, technically it's possible to stream Audio over USB both in host and device mode. Since Android 4.1 the latter mode is “provided by Android Open Accessory (AOA) 2.0 and provides limited audio capabilityâ€. It uses the USB Audio Gadget Driver in kernel (built with CONFIG_USB_AUDIO
option) and the accessories supporting AOAv2 protocol are built using Accessory Development Kit (ADK). Custom Accessories page states:
AOA protocol specifies how an accessory can establish communication with an Android device via USB. Due to the low power output of Android devices, AOA requires the accessory to act as a USB host, meaning the connecting accessory must power the bus.
But as per official documentation:
Accessory mode audio has not been widely adopted, and is not currently recommended for new designs.
And the AOA protocol documentation warns:
Caution: AOAv2 audio support has been deprecated in Android 8.0.
It means Android 9+ devices won't be able to function in device mode while streaming audio over USB. So the Audio Source USB configuration option is no more there.
Audio over USB in Host Mode
However Android devices support audio peripherals in host mode (kernel must be built with CONFIG_SND_USB_AUDIO
). Since AOA is specific to Android, such accessories aren't usable with other hosts like PCs. So there was a demand from audio peripheral manufacturers, device OEMs and ROM developers community to support standard USB audio out capability in host mode (e.g. see this, this and this). Support for a subset of USB audio class 1 (UAC1) features was added in Android 5.0.
USB Device classes specify the standard protocols for USB peripheral functions so that the host can inter-operate with them without requiring any hardware-specifc driver (i.e. in driverless mode). USB Mass Storage (UMS) is a common example. All Mass Storage Class (MSC) compliant thumb drives work on all OSes including Linux, Android and Windows, irrespective of the device vendor. In the same way the USB audio peripherals which are USB Audio Class 1 compliant work with Android devices like on any other USB hosts e.g. PCs.
So host mode USB audio covers wide range of USB-based peripherals including the headsets that follow the USB headset specification.
When a UAC1 compatible peripheral device (like a DAC) is connected to USB port on Android device, digital audio is automatically routed to that peripheral. However if an app wants to use advanced USB host APIs to interact with the peripheral (and not simply the audio routing) , it's possible to Disable USB audio routing in Developer Options.