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

Commit 2076105d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "audio-hal-v4-pi-dev" into pi-dev

* changes:
  Audio V4: Declare support for 4.0 interface
  Audio V4: Implement the shim core 4.0 -> legacy
  Audio V4: Add its own function to open the primary device
  Audio V4: Move service entry point to common
  Audio V4: Implement the shim effect 4.0 -> legacy
  Audio V4: Update .hal doc to removal of audioSource
  Audio V4: Use string to identify audio Device
  Fix potential missing '\0' when wrapping to legacy
  Audio V4: Cast conversion now deduce both types
  Audio V4: Add V4 common utils
  Audio V4: Do not forward notification detail
  Audio V4: Remove system only enum values
parents 9892569a bee7f4eb
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ interface IDevice {
     * @param device device type and (if needed) address.
     * @param config stream configuration.
     * @param flags additional flags.
     * @param source source specification.
     * @param sinkMetadata Description of the audio that is suggested by the client.
     *                     May be used by implementations to configure hardware effects.
     * @return retval operation completion status.
+36 −25
Original line number Diff line number Diff line
@@ -18,42 +18,53 @@ package android.hardware.audio@4.0;

import android.hardware.audio.common@4.0;
import IDevice;
import IPrimaryDevice;

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 exception:
 *  - 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);

    /**
     * Opens the Primary audio device that must be present.
     * This function is not optional and must return successfully the primary device.
     *
     * This device must have the name "primary".
     *
     * The telephony stack uses this device to control the audio during a voice call.
     *
     * @return retval operation completion status. Must be SUCCESS.
     *         For debuging, return INVALID_ARGUMENTS if there is no corresponding
     *         hardware module found, NOT_INITIALIZED if an error occurred
     *         while opening the hardware module.
     * @return result the interface for the created device.
     */
    openPrimaryDevice() generates (Result retval, IPrimaryDevice 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">
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H

#include <android/hardware/audio/common/2.0/types.h>

namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace V2_0 {
namespace implementation {

typedef common::V2_0::AudioDevice AudioDeviceBitfield;
typedef common::V2_0::AudioChannelMask AudioChannelBitfield;
typedef common::V2_0::AudioOutputFlag AudioOutputFlagBitfield;
typedef common::V2_0::AudioInputFlag AudioInputFlagBitfield;

}  // namespace implementation
}  // namespace V2_0
}  // namespace common
}  // namespace audio
}  // namespace hardware
}  // namespace android

#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
+47 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

cc_library_shared {
    name: "android.hardware.audio.common@4.0-util",
    defaults: ["hidl_defaults"],
    vendor_available: true,
    vndk: {
        enabled: true,
    },
    srcs: [
        "HidlUtils.cpp",
    ],

    export_include_dirs: ["."],

    static_libs: [
    ],

    shared_libs: [
        "liblog",
        "libutils",
        "libhidlbase",
        "android.hardware.audio.common-util",
        "android.hardware.audio.common@4.0",
    ],
    export_shared_lib_headers: [
        "android.hardware.audio.common-util"
    ],

    header_libs: [
        "libaudio_system_headers",
        "libhardware_headers",
    ],
}
Loading