summaryrefslogtreecommitdiffstats
path: root/audio/4.0
diff options
context:
space:
mode:
authorKevin Rocard <krocard@google.com>2018-02-28 15:15:07 -0800
committerKevin Rocard <krocard@google.com>2018-03-06 11:30:51 -0800
commite605e033619977f98a57b6ac4b38145079ea3d69 (patch)
treea75926cdd759ffc0345913180ba51b626f8b82fc /audio/4.0
parent2b275704bc174199687d11bd5b6ed6e1f0dcaaea (diff)
downloadandroid_hardware_interfaces-e605e033619977f98a57b6ac4b38145079ea3d69.tar.gz
android_hardware_interfaces-e605e033619977f98a57b6ac4b38145079ea3d69.tar.bz2
android_hardware_interfaces-e605e033619977f98a57b6ac4b38145079ea3d69.zip
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 Merged-In: I9f3ac1928de8116974257951e016108c5820eded Cherry-picked from master Signed-off-by: Kevin Rocard <krocard@google.com>
Diffstat (limited to 'audio/4.0')
-rw-r--r--audio/4.0/IDevicesFactory.hal45
-rw-r--r--audio/4.0/config/audio_policy_configuration.xsd31
2 files changed, 21 insertions, 55 deletions
diff --git a/audio/4.0/IDevicesFactory.hal b/audio/4.0/IDevicesFactory.hal
index c552c6ddd..987fd68e5 100644
--- a/audio/4.0/IDevicesFactory.hal
+++ b/audio/4.0/IDevicesFactory.hal
@@ -19,41 +19,36 @@ package android.hardware.audio@4.0;
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 924fb4715..e5b444994 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">