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

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

Merge "audio: Add IBluetoothA2dp" into udc-dev

parents b964c8b7 3caf6591
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ aidl_interface {
        "android/hardware/audio/core/AudioPatch.aidl",
        "android/hardware/audio/core/AudioRoute.aidl",
        "android/hardware/audio/core/IBluetooth.aidl",
        "android/hardware/audio/core/IBluetoothA2dp.aidl",
        "android/hardware/audio/core/IConfig.aidl",
        "android/hardware/audio/core/IModule.aidl",
        "android/hardware/audio/core/IStreamCallback.aidl",
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.audio.core;
@VintfStability
interface IBluetoothA2dp {
  boolean isEnabled();
  void setEnabled(boolean enabled);
  boolean supportsOffloadReconfiguration();
  void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters);
}
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ interface IModule {
  void setModuleDebug(in android.hardware.audio.core.ModuleDebug debug);
  @nullable android.hardware.audio.core.ITelephony getTelephony();
  @nullable android.hardware.audio.core.IBluetooth getBluetooth();
  @nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp();
  android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData);
  void disconnectExternalDevice(int portId);
  android.hardware.audio.core.AudioPatch[] getAudioPatches();
+83 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.core;

import android.hardware.audio.core.VendorParameter;

/**
 * An instance of IBluetoothA2dp manages settings for the A2DP (Advanced Audio
 * Distribution Profile) profiles. This interface is optional to implement by
 * the vendor. It needs to be provided only if the device actually supports BT
 * A2DP.
 *
 * This interface is separate from IBluetooth interface which manages SCO & HFP.
 * The HAL module can handle both SCO and A2DP profiles or only one of them.
 */
@VintfStability
interface IBluetoothA2dp {
    /**
     * Whether BT A2DP is enabled.
     *
     * Returns the current state of A2DP support. The client might need to
     * disable (suspend) A2DP when another profile (for example, SCO) is
     * activated.
     *
     * @return Whether BT A2DP is enabled.
     */
    boolean isEnabled();

    /**
     * Enable or disable A2DP.
     *
     * Sets the current state of A2DP support. The client might need to
     * disable (suspend) A2DP when another profile (for example, SCO) is
     * activated.
     *
     * @param enabled Whether BT A2DP must be enabled or suspended.
     * @throws EX_ILLEGAL_STATE If there was an error performing the operation.
     */
    void setEnabled(boolean enabled);

    /**
     * Indicates whether the module supports reconfiguration of offloaded codecs.
     *
     * Offloaded coded implementations may need to be reconfigured when the
     * active A2DP device changes. This method indicates whether the HAL module
     * supports the reconfiguration event. The result returned from this method
     * must not change over time.
     *
     * @return Whether reconfiguration offload of offloaded codecs is supported.
     */
    boolean supportsOffloadReconfiguration();

    /**
     * Instructs the HAL module to reconfigure offloaded codec.
     *
     * Offloaded coded implementations may need to be reconfigured when the
     * active A2DP device changes. This method is a notification for the HAL
     * module to commence reconfiguration.
     *
     * Note that 'EX_UNSUPPORTED_OPERATION' may only be thrown when
     * 'supportsOffloadReconfiguration' returns 'false'.
     *
     * @param parameter Optional vendor-specific parameters, can be left empty.
     * @throws EX_ILLEGAL_STATE If there was an error performing the operation,
     *                          or the operation can not be commenced in the current state.
     * @throws EX_UNSUPPORTED_OPERATION If the module does not support codec reconfiguration.
     */
    void reconfigureOffload(in VendorParameter[] parameters);
}
+15 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.hardware.audio.common.SourceMetadata;
import android.hardware.audio.core.AudioPatch;
import android.hardware.audio.core.AudioRoute;
import android.hardware.audio.core.IBluetooth;
import android.hardware.audio.core.IBluetoothA2dp;
import android.hardware.audio.core.IStreamCallback;
import android.hardware.audio.core.IStreamIn;
import android.hardware.audio.core.IStreamOut;
@@ -102,6 +103,20 @@ interface IModule {
     */
    @nullable IBluetooth getBluetooth();

    /**
     * Retrieve the interface to control Bluetooth A2DP.
     *
     * If the HAL module supports A2DP Profile functionality for Bluetooth, it
     * must return an instance of the IBluetoothA2dp interface. The same
     * instance must be returned during the lifetime of the HAL module. If the
     * HAL module does not support BT A2DP, a null must be returned, without
     * throwing any errors.
     *
     * @return An instance of the IBluetoothA2dp interface implementation.
     * @throws EX_ILLEGAL_STATE If there was an error creating an instance.
     */
    @nullable IBluetoothA2dp getBluetoothA2dp();

    /**
     * Set a device port of an external device into connected state.
     *
Loading