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

Commit c7e8d35e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "audio: Add IBluetooth core interface" am: 7d183a48

parents a43b7fea 7d183a48
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ aidl_interface {
        "android/hardware/audio/core/AudioMode.aidl",
        "android/hardware/audio/core/AudioPatch.aidl",
        "android/hardware/audio/core/AudioRoute.aidl",
        "android/hardware/audio/core/IBluetooth.aidl",
        "android/hardware/audio/core/IConfig.aidl",
        "android/hardware/audio/core/IModule.aidl",
        "android/hardware/audio/core/IStreamCallback.aidl",
+61 −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.
 */
///////////////////////////////////////////////////////////////////////////////
// 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 IBluetooth {
  android.hardware.audio.core.IBluetooth.ScoConfig setScoConfig(in android.hardware.audio.core.IBluetooth.ScoConfig config);
  android.hardware.audio.core.IBluetooth.HfpConfig setHfpConfig(in android.hardware.audio.core.IBluetooth.HfpConfig config);
  @JavaDerive(equals=true, toString=true) @VintfStability
  parcelable ScoConfig {
    @nullable android.media.audio.common.Boolean isEnabled;
    @nullable android.media.audio.common.Boolean isNrecEnabled;
    android.hardware.audio.core.IBluetooth.ScoConfig.Mode mode = android.hardware.audio.core.IBluetooth.ScoConfig.Mode.UNSPECIFIED;
    @nullable @utf8InCpp String debugName;
    @VintfStability
    enum Mode {
      UNSPECIFIED = 0,
      SCO = 1,
      SCO_WB = 2,
      SCO_SWB = 3,
    }
  }
  @JavaDerive(equals=true, toString=true) @VintfStability
  parcelable HfpConfig {
    @nullable android.media.audio.common.Boolean isEnabled;
    @nullable android.media.audio.common.Int sampleRate;
    @nullable android.media.audio.common.Float volume;
    const int VOLUME_MIN = 0;
    const int VOLUME_MAX = 1;
  }
}
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ package android.hardware.audio.core;
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();
  android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData);
  void disconnectExternalDevice(int portId);
  android.hardware.audio.core.AudioPatch[] getAudioPatches();
+127 −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.core;

import android.media.audio.common.Boolean;
import android.media.audio.common.Float;
import android.media.audio.common.Int;

/**
 * An instance of IBluetooth manages settings for the Hands-Free Profile (HFP)
 * and the SCO Link. This interface is optional to implement and provide by the
 * vendor. It needs to be provided only if the device actually supports BT SCO
 * or HFP.
 */
@VintfStability
interface IBluetooth {
    @JavaDerive(equals=true, toString=true)
    @VintfStability
    parcelable ScoConfig {
        /**
         * Whether BT SCO is enabled. The client might need to disable it
         * when another profile (for example, A2DP) is activated.
         */
        @nullable Boolean isEnabled;
        /**
         * Whether BT SCO Noise Reduction and Echo Cancellation are enabled.
         */
        @nullable Boolean isNrecEnabled;
        @VintfStability enum Mode { UNSPECIFIED, SCO, SCO_WB, SCO_SWB }
        /**
         * If set, specifies the SCO mode to use:
         *   regular, wide band (WB), or super wide band (SWB).
         */
        Mode mode = Mode.UNSPECIFIED;
        /**
         * The name of the BT SCO headset used for debugging purposes. Can be empty.
         */
        @nullable @utf8InCpp String debugName;
    }

    /**
     * Set the configuration of Bluetooth SCO.
     *
     * In the provided parcelable, the client sets zero, one or more parameters
     * which have to be updated on the HAL side. The parameters that are left
     * unset must retain their current values. It is allowed to change
     * parameters while the SCO profile is disabled (isEnabled.value == false).
     *
     * In the returned parcelable, all parameter fields known to the HAL module
     * must be populated to their current values. If the SCO profile is
     * currently disabled (isEnabled.value == false), the parameters must
     * reflect the last values that were in use.
     *
     * The client can pass an uninitialized parcelable in order to retrieve the
     * current configuration.
     *
     * @return The current configuration (after update). All fields known to
     *         the HAL must be populated.
     * @param config The configuration to set. Any number of fields may be left
     *               uninitialized.
     * @throws EX_UNSUPPORTED_OPERATION If BT SCO is not supported.
     * @throws EX_ILLEGAL_ARGUMENT If the requested combination of parameter
     *                             values is invalid.
     */
    ScoConfig setScoConfig(in ScoConfig config);

    @JavaDerive(equals=true, toString=true)
    @VintfStability
    parcelable HfpConfig {
        /**
         * Whether BT HFP is enabled.
         */
        @nullable Boolean isEnabled;
        /**
         * The sample rate of BT HFP, in Hertz. Must be a positive number.
         */
        @nullable Int sampleRate;

        const int VOLUME_MIN = 0;
        const int VOLUME_MAX = 1;
        /**
         * The output volume of BT HFP. 1.0f means unity gain, 0.0f is muted,
         * see VOLUME_* constants;
         */
        @nullable Float volume;
    }

    /**
     * Set the configuration of Bluetooth HFP.
     *
     * In the provided parcelable, the client sets zero, one or more parameters
     * which have to be updated on the HAL side. The parameters that are left
     * unset must retain their current values. It is allowed to change
     * parameters while the HFP profile is disabled (isEnabled.value == false).
     *
     * In the returned parcelable, all parameter fields known to the HAL module
     * must be populated to their current values. If the HFP profile is
     * currently disabled (isEnabled.value == false), the parameters must
     * reflect the last values that were in use.
     *
     * The client can pass an uninitialized parcelable in order to retrieve the
     * current configuration.
     *
     * @return The current configuration (after update). All fields known to
     *         the HAL must be populated.
     * @param config The configuration to set. Any number of fields may be left
     *               uninitialized.
     * @throws EX_UNSUPPORTED_OPERATION If BT HFP is not supported.
     * @throws EX_ILLEGAL_ARGUMENT If the requested combination of parameter
     *                             values is invalid.
     */
    HfpConfig setHfpConfig(in HfpConfig config);
}
+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.AudioMode;
import android.hardware.audio.core.AudioPatch;
import android.hardware.audio.core.AudioRoute;
import android.hardware.audio.core.IBluetooth;
import android.hardware.audio.core.IStreamCallback;
import android.hardware.audio.core.IStreamIn;
import android.hardware.audio.core.IStreamOut;
@@ -85,6 +86,20 @@ interface IModule {
     */
    @nullable ITelephony getTelephony();

    /**
     * Retrieve the interface to control Bluetooth SCO and HFP.
     *
     * If the HAL module supports either the SCO Link or Hands-Free Profile
     * functionality (or both) for Bluetooth, it must return an instance of the
     * IBluetooth interface. The same instance must be returned during the
     * lifetime of the HAL module. If the HAL module does not support BT SCO and
     * HFP, a null must be returned, without throwing any errors.
     *
     * @return An instance of the IBluetooth interface implementation.
     * @throws EX_ILLEGAL_STATE If there was an error creating an instance.
     */
    @nullable IBluetooth getBluetooth();

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