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

Commit a0cd9449 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

Audio HAL V7.1: Interfaces & types

Introduced V7.1 of the core HAL. The only added methods of
the interfaces are those for creating objects implementing
the new version. HIDL types are from V7.0.

APM XSD is cloned for adding new enums. Provided the minor
update for the enums utility library.

CTS-Coverage-Bug: 215647214
Bug: 214426419
Test: m
Change-Id: I3caa2fda2fb5d7d8e8292e23fb2cf0e32e05c146
parent ee0a1fe5
Loading
Loading
Loading
Loading

audio/7.1/Android.bp

0 → 100644
+30 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["hardware_interfaces_license"],
}

hidl_interface {
    name: "android.hardware.audio@7.1",
    root: "android.hardware",
    srcs: [
        "IDevice.hal",
        "IDevicesFactory.hal",
        "IPrimaryDevice.hal",
        "IStreamIn.hal",
        "IStreamOut.hal",
    ],
    interfaces: [
        "android.hardware.audio@7.0",
        "android.hardware.audio.common@7.0",
        "android.hidl.base@1.0",
        "android.hidl.safe_union@1.0",
    ],
    gen_java: false,
    gen_java_constants: false,
}

audio/7.1/IDevice.hal

0 → 100644
+88 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.
 */

package android.hardware.audio@7.1;

import android.hardware.audio.common@7.0;
import @7.0::AudioInOutFlag;
import @7.0::IDevice;
import @7.0::Result;
import IStreamIn;
import IStreamOut;

interface IDevice extends @7.0::IDevice {
    /**
     * This method creates and opens the audio hardware output stream.
     * If the stream can not be opened with the proposed audio config,
     * HAL must provide suggested values for the audio config.
     *
     * Note: INVALID_ARGUMENTS is returned both in the case when the
     * HAL can not use the provided config and in the case when
     * the value of any argument is invalid. In the latter case the
     * HAL must provide a default initialized suggested config.
     *
     * @param ioHandle handle assigned by AudioFlinger.
     * @param device device type and (if needed) address.
     * @param config stream configuration.
     * @param flags additional flags.
     * @param sourceMetadata Description of the audio that will be played.
                             May be used by implementations to configure hardware effects.
     * @return retval operation completion status.
     * @return outStream created output stream.
     * @return suggestedConfig in the case of rejection of the proposed config,
     *                         a config suggested by the HAL.
     */
    openOutputStream_7_1(
            AudioIoHandle ioHandle,
            DeviceAddress device,
            AudioConfig config,
            vec<AudioInOutFlag> flags,
            SourceMetadata sourceMetadata) generates (
                    Result retval,
                    IStreamOut outStream,
                    AudioConfig suggestedConfig);

    /**
     * This method creates and opens the audio hardware input stream.
     * If the stream can not be opened with the proposed audio config,
     * HAL must provide suggested values for the audio config.
     *
     * Note: INVALID_ARGUMENTS is returned both in the case when the
     * HAL can not use the provided config and in the case when
     * the value of any argument is invalid. In the latter case the
     * HAL must provide a default initialized suggested config.
     *
     * @param ioHandle handle assigned by AudioFlinger.
     * @param device device type and (if needed) address.
     * @param config stream configuration.
     * @param flags additional flags.
     * @param sinkMetadata Description of the audio that is suggested by the client.
     *                     May be used by implementations to configure processing effects.
     * @return retval operation completion status.
     * @return inStream in case of success, created input stream.
     * @return suggestedConfig in the case of rejection of the proposed config,
     *                         a config suggested by the HAL.
     */
    openInputStream_7_1(
            AudioIoHandle ioHandle,
            DeviceAddress device,
            AudioConfig config,
            vec<AudioInOutFlag> flags,
            SinkMetadata sinkMetadata) generates (
                    Result retval,
                    IStreamIn inStream,
                    AudioConfig suggestedConfig);
};
+73 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.
 */

package android.hardware.audio@7.1;

import @7.0::IDevicesFactory;
import @7.0::Result;
import IDevice;
import IPrimaryDevice;

/**
 * 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 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.
 */
interface IDevicesFactory extends @7.0::IDevicesFactory {

    /**
     * Opens an audio device. To close the device, it is necessary to call
     * 'close' method on the returned device object.
     *
     * Important note: due to rules of HIDL, @7.1::IPrimaryDevice extends
     * @7.0::IPrimaryDevice, rather than @7.1::IDevice. Thus the returned
     * IDevice interface can not be up-casted to @7.1::IPrimaryDevice for the
     * primary device. The client needs to use IPrimaryDevice instead of this
     * method if it needs full functionality of the IPrimaryDevice interface.
     *
     * @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 occurred while opening the hardware
     *         module.
     * @return result the interface for the created device.
     */
    openDevice_7_1(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 debugging, 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_7_1() generates (Result retval, IPrimaryDevice result);
};
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.
 */

package android.hardware.audio@7.1;

import android.hardware.audio.common@7.0;
import @7.0::IPrimaryDevice;
import IDevice;

interface IPrimaryDevice extends @7.0::IPrimaryDevice {
    /**
     * Retrieve the generic @7.1::IDevice interface.
     *
     * Since @7.1::IPrimaryDevice extends @7.0::IPrimaryDevice, the interface
     * reference can not be downcasted to @7.1::IDevice using standard methods.
     * For this reason a dedicated interface method is provided.
     *
     * @return result the generic part of the interface.
     */
    getDevice() generates (IDevice result);
};
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.
 */

package android.hardware.audio@7.1;

import @7.0::IStreamIn;

interface IStreamIn extends @7.0::IStreamIn {
};
Loading