Audio V4: Use string to identify audio Device
am: e605e03361
Change-Id: I7a5f4dd5b156b046d88ddb4884d11b816341ba39
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);
};
diff --git a/audio/4.0/config/audio_policy_configuration.xsd b/audio/4.0/config/audio_policy_configuration.xsd
index 924fb47..e5b4449 100644
--- a/audio/4.0/config/audio_policy_configuration.xsd
+++ b/audio/4.0/config/audio_policy_configuration.xsd
@@ -66,35 +66,6 @@
<xs:complexType name="globalConfiguration">
<xs:attribute name="speaker_drc_enabled" type="xs:boolean" use="required"/>
</xs:complexType>
- <!-- Enum values of IDevicesFactory::Device
- TODO: generate from hidl to avoid manual sync. -->
- <xs:simpleType name="halName">
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="primary"/>
- <xs:enumeration value="a2dp"/>
- <xs:enumeration value="usb"/>
- <xs:enumeration value="r_submix"/>
- <xs:enumeration value="codec_offload"/>
- <xs:enumeration value="stub"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:annotation>
- <xs:documentation xml:lang="en">
- Vendor eXtension names must be in the vx namespace.
- Vendor are encouraged to namespace their module names.
- Example for an hypothetical Google virtual reality HAL:
- <module name="vx_google_vr" halVersion="3.0"/>
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="vx_[_a-zA-Z0-9]+"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
<xs:complexType name="modules">
<xs:annotation>
<xs:documentation xml:lang="en">
@@ -133,7 +104,7 @@
<xs:element name="devicePorts" type="devicePorts" minOccurs="0"/>
<xs:element name="routes" type="routes" minOccurs="0"/>
</xs:sequence>
- <xs:attribute name="name" type="halName" use="required"/>
+ <xs:attribute name="name" type="xsd:string" use="required"/>
<xs:attribute name="halVersion" type="halVersion" use="required"/>
</xs:complexType>
<xs:unique name="mixPortNameUniqueness">