From e50be86fd4bbe0c27f877d7adc381e1a0f68c115 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Thu, 26 Oct 2023 16:00:30 -0700 Subject: [PATCH] Add HFP AIDL design Bug: 265057196 Test: m android.hardware.bluetooth.audio-update-api Change-Id: I066c8c0db7516da8709c32558fe3b21ddbd91054 --- .../bluetooth/audio/AudioConfiguration.aidl | 1 + .../bluetooth/audio/HfpConfiguration.aidl | 41 +++++++++++++++++ .../hardware/bluetooth/audio/SessionType.aidl | 3 ++ .../bluetooth/audio/AudioConfiguration.aidl | 2 + .../bluetooth/audio/HfpConfiguration.aidl | 44 +++++++++++++++++++ .../hardware/bluetooth/audio/SessionType.aidl | 13 ++++++ 6 files changed, 104 insertions(+) create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/HfpConfiguration.aidl create mode 100644 bluetooth/audio/aidl/android/hardware/bluetooth/audio/HfpConfiguration.aidl diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl index 3abfb31b7b..edb9ee27f5 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl @@ -38,4 +38,5 @@ union AudioConfiguration { android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig; android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig; android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig; + android.hardware.bluetooth.audio.HfpConfiguration hfpConfig; } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/HfpConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/HfpConfiguration.aidl new file mode 100644 index 0000000000..490a05d3f1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/HfpConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable HfpConfiguration { + android.hardware.bluetooth.audio.CodecId codecId; + int connectionHandle; + boolean nrec; + boolean controllerCodec; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl index 4b2c10f71d..71cca5364f 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl @@ -46,4 +46,7 @@ enum SessionType { LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH, A2DP_SOFTWARE_DECODING_DATAPATH, A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH, + HFP_SOFTWARE_ENCODING_DATAPATH, + HFP_SOFTWARE_DECODING_DATAPATH, + HFP_HARDWARE_OFFLOAD_DATAPATH, } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl index a06337ec4a..b7f7f292ea 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl @@ -17,6 +17,7 @@ package android.hardware.bluetooth.audio; import android.hardware.bluetooth.audio.CodecConfiguration; +import android.hardware.bluetooth.audio.HfpConfiguration; import android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration; import android.hardware.bluetooth.audio.LeAudioConfiguration; import android.hardware.bluetooth.audio.PcmConfiguration; @@ -30,4 +31,5 @@ union AudioConfiguration { CodecConfiguration a2dpConfig; LeAudioConfiguration leAudioConfig; LeAudioBroadcastConfiguration leAudioBroadcastConfig; + HfpConfiguration hfpConfig; } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/HfpConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/HfpConfiguration.aidl new file mode 100644 index 0000000000..9494bb986b --- /dev/null +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/HfpConfiguration.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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.bluetooth.audio; + +import android.hardware.bluetooth.audio.CodecId; + +@VintfStability +parcelable HfpConfiguration { + /** + * Codec identifier. + */ + CodecId codecId; + + /** + * The connection handle used for SCO connection. + * Range: 0x0000 to 0x0EFF. + */ + int connectionHandle; + + /** + * Echo canceling and noise reduction functions resident in the AG. + */ + boolean nrec; + + /** + * Indicate whether the codec is encoded and decoded in the controller. + * If the codec is inside the DSP, then it would be transparent mode. + */ + boolean controllerCodec; +} diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl index 7acb5c6e49..35292a1731 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl @@ -70,4 +70,17 @@ enum SessionType { * The decoding of AVDTP media is done by HW and there is control only */ A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH, + /** + * Used when audio is encoded by Bluetooth Stack and is streaming to HFP device. + */ + HFP_SOFTWARE_ENCODING_DATAPATH, + /** + * Used when audio is decoded by Bluetooth Stack and is streaming to HFP device. + */ + HFP_SOFTWARE_DECODING_DATAPATH, + /** + * Used when encoded and decoded by hardware offload and is streamed to HFP device. + * This is a control path only. + */ + HFP_HARDWARE_OFFLOAD_DATAPATH, }