Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73145854 authored by Kevin Rocard's avatar Kevin Rocard Committed by android-build-merger
Browse files

Audio V4: Use string to identify audio Device

am: e605e033

Change-Id: I7a5f4dd5b156b046d88ddb4884d11b816341ba39
parents c1d56ee6 e605e033
Loading
Loading
Loading
Loading
+20 −25
Original line number Diff line number Diff line
@@ -19,41 +19,36 @@ package android.hardware.audio@4.0;
import android.hardware.audio.common@4.0;
import IDevice;

interface IDevicesFactory {
    /** Allows a HAL implementation to be split in multiple independent
/** 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 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
 *  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.
 */
    enum Device : int32_t {
        PRIMARY,
        A2DP,
        USB,
        R_SUBMIX,
        STUB,
        CODEC_OFFLOAD,
        SECONDARY,
        AUXILIARY,
        /** Multi Stream Decoder */
        MSD
    };
interface IDevicesFactory {

    /**
     * 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);
};
+1 −30
Original line number Diff line number Diff line
@@ -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">