Audio V4: Use string to identify audio Device
The name of an audio device is an opaque string that the
framework does not interpret (there are exceptions, see documentation)
and only uses as an ID to link
the audio_policy_configuration.xml and the audio device factory.
Previously it was an enum which meant that the vendors
could not implement the interface more than a set number of time
and that generic meaningless (secondary, auxiliary) names had
to be introduced.
Bug: 38184704
Test: compile
Change-Id: I9f3ac1928de8116974257951e016108c5820eded
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/4.0/IDevicesFactory.hal b/audio/4.0/IDevicesFactory.hal
index c552c6d..987fd68 100644
--- a/audio/4.0/IDevicesFactory.hal
+++ b/audio/4.0/IDevicesFactory.hal
@@ -19,41 +19,36 @@
import android.hardware.audio.common@4.0;
import IDevice;
+/** This factory allows a HAL implementation to be split in multiple independent
+ * devices (called module in the pre-treble API).
+ * Note that this division is arbitrary and implementation are free
+ * to only have a Primary.
+ * The framework will query the devices according to audio_policy_configuration.xml
+ *
+ * Each device name is arbitrary, provided by the vendor's audio_policy_configuration.xml
+ * and only used to identify a device in this factory.
+ * The framework must not interpret the name, treating it as a vendor opaque data
+ * with the following exceptions:
+ * - the "primary" device must always be present and is the device used by the telephony framework.
+ * - the "r_submix" device that must be present to support policyMixes (Eg: Android projected).
+ * Note that this Device is included by default in a build derived from AOSP.
+ *
+ * Note that on AOSP Oreo (including MR1) the "a2dp" module is not using this API
+ * but is loaded directly from the system partition using the legacy API
+ * due to limitations with the Bluetooth framework.
+ */
interface IDevicesFactory {
- /** Allows a HAL implementation to be split in multiple independent
- * devices (called module in the pre-treble API).
- * Note that this division is arbitrary and implementation are free
- * to only have a Primary.
- * The framework will query the devices according to audio_policy_configuration.xml
- *
- * Each Device value is interchangeable with any other and the framework
- * does not differentiate between values with the following exceptions:
- * - the Primary device must always be present
- * - the R_SUBMIX that is used to forward audio of REMOTE_SUBMIX DEVICES
- */
- enum Device : int32_t {
- PRIMARY,
- A2DP,
- USB,
- R_SUBMIX,
- STUB,
- CODEC_OFFLOAD,
- SECONDARY,
- AUXILIARY,
- /** Multi Stream Decoder */
- MSD
- };
/**
* Opens an audio device. To close the device, it is necessary to release
* references to the returned device object.
*
- * @param device device type.
+ * @param device device name.
* @return retval operation completion status. Returns INVALID_ARGUMENTS
* if there is no corresponding hardware module found,
* NOT_INITIALIZED if an error occured while opening the hardware
* module.
* @return result the interface for the created device.
*/
- openDevice(Device device) generates (Result retval, IDevice result);
+ openDevice(string device) generates (Result retval, IDevice result);
};