Merge "Fix cert-dcl16-c warnings"
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 50b54c3..3abfb31 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
@@ -37,4 +37,5 @@
   android.hardware.bluetooth.audio.PcmConfiguration pcmConfig;
   android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig;
   android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig;
+  android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig;
 }
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
index 7c0d825..c20c057 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
@@ -38,4 +38,5 @@
   SUCCESS = 1,
   UNSUPPORTED_CODEC_CONFIGURATION = 2,
   FAILURE = 3,
+  RECONFIGURATION = 4,
 }
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
similarity index 90%
rename from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
rename to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
index 5fa3926..7d53b0c 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
@@ -33,8 +33,9 @@
 
 package android.hardware.bluetooth.audio;
 @VintfStability
-parcelable BroadcastConfiguration {
-  android.hardware.bluetooth.audio.BroadcastConfiguration.BroadcastStreamMap[] streamMap;
+parcelable LeAudioBroadcastConfiguration {
+  android.hardware.bluetooth.audio.CodecType codecType;
+  android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap;
   @VintfStability
   parcelable BroadcastStreamMap {
     char streamHandle;
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index 2bc1791..edb6795 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -34,12 +34,13 @@
 package android.hardware.bluetooth.audio;
 @VintfStability
 parcelable LeAudioConfiguration {
-  android.hardware.bluetooth.audio.LeAudioMode mode;
-  android.hardware.bluetooth.audio.LeAudioConfiguration.LeAudioModeConfig modeConfig;
   android.hardware.bluetooth.audio.CodecType codecType;
+  android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap;
+  int peerDelayUs;
+  android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
   @VintfStability
-  union LeAudioModeConfig {
-    android.hardware.bluetooth.audio.UnicastConfiguration unicastConfig;
-    android.hardware.bluetooth.audio.BroadcastConfiguration broadcastConfig;
+  parcelable StreamMap {
+    char streamHandle;
+    int audioChannelAllocation;
   }
 }
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
deleted file mode 100644
index 766f637..0000000
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2021 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.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
-  UNKNOWN = 0,
-  UNICAST = 1,
-  BROADCAST = 2,
-}
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 72d7fb2..baec9c2 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
@@ -42,4 +42,6 @@
   LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5,
   LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6,
   LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7,
+  LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH = 8,
+  LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 9,
 }
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/UnicastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
deleted file mode 100644
index b385763..0000000
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2021 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.bluetooth.audio;
-@VintfStability
-parcelable UnicastConfiguration {
-  android.hardware.bluetooth.audio.UnicastConfiguration.UnicastStreamMap[] streamMap;
-  int peerDelay;
-  android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
-  @VintfStability
-  parcelable UnicastStreamMap {
-    char streamHandle;
-    int audioChannelAllocation;
-  }
-}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl
index 81b41dc..a06337e 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.LeAudioBroadcastConfiguration;
 import android.hardware.bluetooth.audio.LeAudioConfiguration;
 import android.hardware.bluetooth.audio.PcmConfiguration;
 
@@ -28,4 +29,5 @@
     PcmConfiguration pcmConfig;
     CodecConfiguration a2dpConfig;
     LeAudioConfiguration leAudioConfig;
+    LeAudioBroadcastConfiguration leAudioBroadcastConfig;
 }
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
index ec78445..9ddafe9 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
@@ -23,5 +23,6 @@
     SUCCESS = 1,
     UNSUPPORTED_CODEC_CONFIGURATION = 2,
     // General failure
-    FAILURE = 3
+    FAILURE = 3,
+    RECONFIGURATION = 4,
 }
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl
index cb63f88..f1301fb 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl
@@ -19,7 +19,6 @@
 import android.hardware.bluetooth.audio.AudioLocation;
 import android.hardware.bluetooth.audio.CodecType;
 import android.hardware.bluetooth.audio.Lc3Capabilities;
-import android.hardware.bluetooth.audio.LeAudioMode;
 
 /**
  * Used to specify the le audio broadcast codec capabilities for hardware offload.
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
similarity index 87%
rename from bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
rename to bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
index cfc9d3a..e9a1a0c 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
@@ -16,14 +16,15 @@
 
 package android.hardware.bluetooth.audio;
 
+import android.hardware.bluetooth.audio.CodecType;
 import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
 
 @VintfStability
-parcelable BroadcastConfiguration {
+parcelable LeAudioBroadcastConfiguration {
     @VintfStability
     parcelable BroadcastStreamMap {
         /*
-         * The connection handle used for a unicast or a broadcast group.
+         * The connection handle used for a broadcast group.
          * Range: 0x0000 to 0xEFFF
          */
         char streamHandle;
@@ -35,5 +36,6 @@
         int audioChannelAllocation;
         LeAudioCodecConfiguration leAudioCodecConfig;
     }
+    CodecType codecType;
     BroadcastStreamMap[] streamMap;
 }
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index 515794b..0d1e3de 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -16,22 +16,28 @@
 
 package android.hardware.bluetooth.audio;
 
-import android.hardware.bluetooth.audio.BroadcastConfiguration;
 import android.hardware.bluetooth.audio.CodecType;
-import android.hardware.bluetooth.audio.LeAudioMode;
-import android.hardware.bluetooth.audio.UnicastConfiguration;
+import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
 
 @VintfStability
 parcelable LeAudioConfiguration {
     @VintfStability
-    union LeAudioModeConfig {
-        UnicastConfiguration unicastConfig;
-        BroadcastConfiguration broadcastConfig;
+    parcelable StreamMap {
+        /*
+         * The connection handle used for a unicast group.
+         * Range: 0x0000 to 0xEFFF
+         */
+        char streamHandle;
+        /*
+         * Audio channel allocation is  a bit field, each enabled bit means that given audio
+         * direction, i.e. "left", or "right" is used. Ordering of audio channels comes from the
+         * least significant bit to the most significant bit. The valus follows the Bluetooth SIG
+         * Audio Location assigned number.
+         */
+        int audioChannelAllocation;
     }
-    /*
-     * The mode of the LE audio
-     */
-    LeAudioMode mode;
-    LeAudioModeConfig modeConfig;
     CodecType codecType;
+    StreamMap[] streamMap;
+    int peerDelayUs;
+    LeAudioCodecConfiguration leAudioCodecConfig;
 }
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
deleted file mode 100644
index 2cf019e..0000000
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2021 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;
-
-@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
-    UNKNOWN,
-    UNICAST,
-    BROADCAST,
-}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
index 30faae3..95beee7 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
@@ -33,19 +33,33 @@
      */
     HEARING_AID_SOFTWARE_ENCODING_DATAPATH,
     /**
-     * Used when encoded by Bluetooth Stack and streaming to LE Audio device
+     * Used when audio is encoded by the Bluetooth Stack and is streamed to LE
+     * Audio unicast device.
      */
     LE_AUDIO_SOFTWARE_ENCODING_DATAPATH,
     /**
-     * Used when decoded by Bluetooth Stack and streaming to audio framework
+     * Used when audio is decoded by the Bluetooth Stack and is streamed to LE
+     * Audio unicast device.
      */
     LE_AUDIO_SOFTWARE_DECODING_DATAPATH,
     /**
-     * Encoding is done by HW an there is control only
+     * Used when audio is encoded by hardware offload and is streamed to LE
+     * Audio unicast device. This is a control path only.
      */
     LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
     /**
-     * Decoding is done by HW an there is control only
+     * Used when audio is decoded by hardware offload and is streamed to LE
+     * Audio unicast device. This is a control path only.
      */
     LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH,
+    /**
+     * Used when audio is encoded by the Bluetooth stack and is streamed to LE
+     * Audio broadcast channels.
+     */
+    LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH,
+    /**
+     * Used when audio is encoded by hardware offload and is streamed to LE
+     * Audio broadcast channels. This is a control path only.
+     */
+    LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
 }
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl
index cd8a4c1..f8a924a 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl
@@ -19,7 +19,6 @@
 import android.hardware.bluetooth.audio.AudioLocation;
 import android.hardware.bluetooth.audio.CodecType;
 import android.hardware.bluetooth.audio.Lc3Capabilities;
-import android.hardware.bluetooth.audio.LeAudioMode;
 
 /**
  * Used to specify the le audio unicast codec capabilities for hardware offload.
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
deleted file mode 100644
index 7be2c5b..0000000
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2021 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.LeAudioCodecConfiguration;
-
-@VintfStability
-parcelable UnicastConfiguration {
-    @VintfStability
-    parcelable UnicastStreamMap {
-        /*
-         * The connection handle used for a unicast or a broadcast group.
-         * Range: 0x0000 to 0xEFFF
-         */
-        char streamHandle;
-        /*
-         * Audio channel allocation is  a bit field, each enabled bit means that given audio
-         * direction, i.e. "left", or "right" is used. Ordering of audio channels comes from the
-         * least significant bit to the most significant bit. The valus follows the Bluetooth SIG
-         * Audio Location assigned number.
-         */
-        int audioChannelAllocation;
-    }
-    UnicastStreamMap[] streamMap;
-    int peerDelay;
-    LeAudioCodecConfiguration leAudioCodecConfig;
-}
diff --git a/bluetooth/audio/aidl/default/Android.bp b/bluetooth/audio/aidl/default/Android.bp
index fc882d4..13a5440 100644
--- a/bluetooth/audio/aidl/default/Android.bp
+++ b/bluetooth/audio/aidl/default/Android.bp
@@ -19,6 +19,7 @@
         "HearingAidAudioProvider.cpp",
         "LeAudioOffloadAudioProvider.cpp",
         "LeAudioSoftwareAudioProvider.cpp",
+        "service.cpp",
     ],
     export_include_dirs: ["."],
     header_libs: ["libhardware_headers"],
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
index 1e55a0b..1e1680a 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
@@ -64,6 +64,14 @@
     case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
       provider = ndk::SharedRefBase::make<LeAudioOffloadInputAudioProvider>();
       break;
+    case SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH:
+      provider =
+          ndk::SharedRefBase::make<LeAudioSoftwareBroadcastAudioProvider>();
+      break;
+    case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+      provider =
+          ndk::SharedRefBase::make<LeAudioOffloadBroadcastAudioProvider>();
+      break;
     default:
       provider = nullptr;
       break;
@@ -93,7 +101,10 @@
   } else if (session_type ==
                  SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
              session_type ==
-                 SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+                 SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+             session_type ==
+                 SessionType::
+                     LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
     std::vector<LeAudioCodecCapabilitiesSetting> db_codec_capabilities =
         BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities(session_type);
     if (db_codec_capabilities.size()) {
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
index 72ac9bd..7a28513 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
@@ -38,6 +38,12 @@
   session_type_ = SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH;
 }
 
+LeAudioOffloadBroadcastAudioProvider::LeAudioOffloadBroadcastAudioProvider()
+    : LeAudioOffloadAudioProvider() {
+  session_type_ =
+      SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
+}
+
 LeAudioOffloadAudioProvider::LeAudioOffloadAudioProvider()
     : BluetoothAudioProvider() {}
 
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
index a27a2e7..6509a9e 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
@@ -48,6 +48,12 @@
   LeAudioOffloadInputAudioProvider();
 };
 
+class LeAudioOffloadBroadcastAudioProvider
+    : public LeAudioOffloadAudioProvider {
+ public:
+  LeAudioOffloadBroadcastAudioProvider();
+};
+
 }  // namespace audio
 }  // namespace bluetooth
 }  // namespace hardware
diff --git a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp
index 67b7d60..0fe205e 100644
--- a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp
@@ -55,6 +55,11 @@
   session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH;
 }
 
+LeAudioSoftwareBroadcastAudioProvider::LeAudioSoftwareBroadcastAudioProvider()
+    : LeAudioSoftwareAudioProvider() {
+  session_type_ = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH;
+}
+
 LeAudioSoftwareAudioProvider::LeAudioSoftwareAudioProvider()
     : BluetoothAudioProvider(), data_mq_(nullptr) {}
 
@@ -78,7 +83,9 @@
   }
 
   uint32_t buffer_modifier = 0;
-  if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH)
+  if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
+      session_type_ ==
+          SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH)
     buffer_modifier = kBufferOutCount;
   else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH)
     buffer_modifier = kBufferInCount;
diff --git a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h
index fa58182..ace4bff 100644
--- a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h
+++ b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h
@@ -51,6 +51,12 @@
   LeAudioSoftwareInputAudioProvider();
 };
 
+class LeAudioSoftwareBroadcastAudioProvider
+    : public LeAudioSoftwareAudioProvider {
+ public:
+  LeAudioSoftwareBroadcastAudioProvider();
+};
+
 }  // namespace audio
 }  // namespace bluetooth
 }  // namespace hardware
diff --git a/bluetooth/audio/aidl/default/service.cpp b/bluetooth/audio/aidl/default/service.cpp
new file mode 100644
index 0000000..f8f9cde
--- /dev/null
+++ b/bluetooth/audio/aidl/default/service.cpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "BtAudioAIDLService"
+
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <utils/Log.h>
+
+#include "BluetoothAudioProviderFactory.h"
+
+using ::aidl::android::hardware::bluetooth::audio::
+    BluetoothAudioProviderFactory;
+
+extern "C" __attribute__((visibility("default"))) binder_status_t
+createIBluetoothAudioProviderFactory() {
+  auto factory = ::ndk::SharedRefBase::make<BluetoothAudioProviderFactory>();
+  const std::string instance_name =
+      std::string() + BluetoothAudioProviderFactory::descriptor + "/default";
+  binder_status_t aidl_status = AServiceManager_addService(
+      factory->asBinder().get(), instance_name.c_str());
+  ALOGW_IF(aidl_status != STATUS_OK, "Could not register %s, status=%d",
+           instance_name.c_str(), aidl_status);
+  return aidl_status;
+}
\ No newline at end of file
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
index a8d8817..a6fd798 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
@@ -132,9 +132,13 @@
 // Stores the supported setting of audio location, connected device, and the
 // channel count for each device
 std::vector<std::tuple<AudioLocation, uint8_t, uint8_t>>
-    supportedDeviceSetting = {std::make_tuple(stereoAudio, 2, 1),
-                              std::make_tuple(monoAudio, 1, 2),
-                              std::make_tuple(monoAudio, 1, 1)};
+    supportedDeviceSetting = {
+        // Stereo, two connected device, one for L one for R
+        std::make_tuple(stereoAudio, 2, 1),
+        // Stereo, one connected device for both L and R
+        std::make_tuple(stereoAudio, 1, 2),
+        // Mono
+        std::make_tuple(monoAudio, 1, 1)};
 
 template <class T>
 bool BluetoothAudioCodecs::ContainedInVector(
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
index 96cd9ef..dd29011 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
@@ -94,6 +94,8 @@
       case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
       case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
         return AudioConfiguration(LeAudioConfiguration{});
+      case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+        return AudioConfiguration(LeAudioBroadcastConfiguration{});
       default:
         return AudioConfiguration(PcmConfiguration{});
     }
@@ -137,6 +139,8 @@
            SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
        session_type_ ==
            SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+       session_type_ ==
+           SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
        (data_mq_ != nullptr && data_mq_->isValid()));
   return stack_iface_ != nullptr && is_mq_valid && audio_config_ != nullptr;
 }
@@ -259,7 +263,9 @@
       (session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
        session_type_ == SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH ||
        session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH ||
-       session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH);
+       session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
+       session_type_ ==
+           SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH);
   bool is_offload_a2dp_session =
       (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
   bool is_offload_le_audio_session =
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h
index aff01e5..451a31f 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h
@@ -86,6 +86,8 @@
       case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
       case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
         return AudioConfiguration(LeAudioConfiguration{});
+      case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+        return AudioConfiguration(LeAudioBroadcastConfiguration{});
       default:
         return AudioConfiguration(PcmConfiguration{});
     }
diff --git a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
index 632a389..1ef9365 100644
--- a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
+++ b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
@@ -418,100 +418,89 @@
 }
 
 inline Lc3CodecConfig_2_1 to_hidl_leaudio_config_2_1(
-    const LeAudioConfiguration& leaudio_config) {
+    const LeAudioConfiguration& unicast_config) {
   Lc3CodecConfig_2_1 hidl_lc3_codec_config = {
       .audioChannelAllocation = 0,
   };
-  if (leaudio_config.modeConfig.getTag() ==
-      LeAudioConfiguration::LeAudioModeConfig::unicastConfig) {
-    auto& unicast_config =
-        leaudio_config.modeConfig
-            .get<LeAudioConfiguration::LeAudioModeConfig::unicastConfig>();
-    if (unicast_config.leAudioCodecConfig.getTag() ==
-        LeAudioCodecConfiguration::lc3Config) {
-      LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
-    }
-    auto& le_codec_config = unicast_config.leAudioCodecConfig
-                                .get<LeAudioCodecConfiguration::lc3Config>();
-
-    hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
-
-    for (const auto& map : unicast_config.streamMap) {
-      hidl_lc3_codec_config.audioChannelAllocation |=
-          map.audioChannelAllocation;
-    }
-  } else {
-    // NOTE: Broadcast is not officially supported in HIDL
-    auto& bcast_config =
-        leaudio_config.modeConfig
-            .get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>();
-    if (bcast_config.streamMap.empty()) {
-      return hidl_lc3_codec_config;
-    }
-    if (bcast_config.streamMap[0].leAudioCodecConfig.getTag() !=
-        LeAudioCodecConfiguration::lc3Config) {
-      LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
-    }
-    auto& le_codec_config =
-        bcast_config.streamMap[0]
-            .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>();
-    hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
-
-    for (const auto& map : bcast_config.streamMap) {
-      hidl_lc3_codec_config.audioChannelAllocation |=
-          map.audioChannelAllocation;
-    }
+  if (unicast_config.leAudioCodecConfig.getTag() ==
+      LeAudioCodecConfiguration::lc3Config) {
+    LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
   }
+  auto& le_codec_config = unicast_config.leAudioCodecConfig
+                              .get<LeAudioCodecConfiguration::lc3Config>();
 
+  hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
+
+  for (const auto& map : unicast_config.streamMap) {
+    hidl_lc3_codec_config.audioChannelAllocation |= map.audioChannelAllocation;
+  }
+  return hidl_lc3_codec_config;
+}
+
+inline Lc3CodecConfig_2_1 to_hidl_leaudio_broadcast_config_2_1(
+    const LeAudioBroadcastConfiguration& broadcast_config) {
+  Lc3CodecConfig_2_1 hidl_lc3_codec_config = {
+      .audioChannelAllocation = 0,
+  };
+  // NOTE: Broadcast is not officially supported in HIDL
+  if (broadcast_config.streamMap.empty()) {
+    return hidl_lc3_codec_config;
+  }
+  if (broadcast_config.streamMap[0].leAudioCodecConfig.getTag() !=
+      LeAudioCodecConfiguration::lc3Config) {
+    LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
+  }
+  auto& le_codec_config =
+      broadcast_config.streamMap[0]
+          .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>();
+  hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
+
+  for (const auto& map : broadcast_config.streamMap) {
+    hidl_lc3_codec_config.audioChannelAllocation |= map.audioChannelAllocation;
+  }
   return hidl_lc3_codec_config;
 }
 
 inline LeAudioConfig_2_2 to_hidl_leaudio_config_2_2(
-    const LeAudioConfiguration& leaudio_config) {
+    const LeAudioConfiguration& unicast_config) {
   LeAudioConfig_2_2 hidl_leaudio_config;
+  hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST;
+  ::android::hardware::bluetooth::audio::V2_2::UnicastConfig
+      hidl_unicast_config;
+  hidl_unicast_config.peerDelay =
+      static_cast<uint32_t>(unicast_config.peerDelayUs / 1000);
 
-  if (leaudio_config.modeConfig.getTag() ==
-      LeAudioConfiguration::LeAudioModeConfig::unicastConfig) {
-    hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST;
-    auto& unicast_config =
-        leaudio_config.modeConfig
-            .get<LeAudioConfiguration::LeAudioModeConfig::unicastConfig>();
-    ::android::hardware::bluetooth::audio::V2_2::UnicastConfig
-        hidl_unicast_config;
-    hidl_unicast_config.peerDelay =
-        static_cast<uint32_t>(unicast_config.peerDelay);
+  auto& lc3_config = unicast_config.leAudioCodecConfig
+                         .get<LeAudioCodecConfiguration::lc3Config>();
+  hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
 
-    auto& lc3_config = unicast_config.leAudioCodecConfig
-                           .get<LeAudioCodecConfiguration::lc3Config>();
-    hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
+  hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size());
+  for (int i = 0; i < unicast_config.streamMap.size(); i++) {
+    hidl_unicast_config.streamMap[i].audioChannelAllocation =
+        static_cast<uint32_t>(
+            unicast_config.streamMap[i].audioChannelAllocation);
+    hidl_unicast_config.streamMap[i].streamHandle =
+        static_cast<uint16_t>(unicast_config.streamMap[i].streamHandle);
+  }
+  return hidl_leaudio_config;
+}
 
-    hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size());
-    for (int i = 0; i < unicast_config.streamMap.size(); i++) {
-      hidl_unicast_config.streamMap[i].audioChannelAllocation =
-          static_cast<uint32_t>(
-              unicast_config.streamMap[i].audioChannelAllocation);
-      hidl_unicast_config.streamMap[i].streamHandle =
-          static_cast<uint16_t>(unicast_config.streamMap[i].streamHandle);
-    }
-  } else if (leaudio_config.modeConfig.getTag() ==
-             LeAudioConfiguration::LeAudioModeConfig::broadcastConfig) {
-    hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
-    auto bcast_config =
-        leaudio_config.modeConfig
-            .get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>();
-    ::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
-        hidl_bcast_config;
-    hidl_bcast_config.streamMap.resize(bcast_config.streamMap.size());
-    for (int i = 0; i < bcast_config.streamMap.size(); i++) {
-      hidl_bcast_config.streamMap[i].audioChannelAllocation =
-          static_cast<uint32_t>(
-              bcast_config.streamMap[i].audioChannelAllocation);
-      hidl_bcast_config.streamMap[i].streamHandle =
-          static_cast<uint16_t>(bcast_config.streamMap[i].streamHandle);
-      hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
-          bcast_config.streamMap[i]
-              .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
-    }
+inline LeAudioConfig_2_2 to_hidl_leaudio_broadcast_config_2_2(
+    const LeAudioBroadcastConfiguration& broadcast_config) {
+  LeAudioConfig_2_2 hidl_leaudio_config;
+  hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
+  ::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
+      hidl_bcast_config;
+  hidl_bcast_config.streamMap.resize(broadcast_config.streamMap.size());
+  for (int i = 0; i < broadcast_config.streamMap.size(); i++) {
+    hidl_bcast_config.streamMap[i].audioChannelAllocation =
+        static_cast<uint32_t>(
+            broadcast_config.streamMap[i].audioChannelAllocation);
+    hidl_bcast_config.streamMap[i].streamHandle =
+        static_cast<uint16_t>(broadcast_config.streamMap[i].streamHandle);
+    hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
+        broadcast_config.streamMap[i]
+            .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
   }
   return hidl_leaudio_config;
 }
@@ -532,6 +521,10 @@
       hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_config_2_1(
           audio_config.get<AudioConfiguration::leAudioConfig>()));
       break;
+    case AudioConfiguration::leAudioBroadcastConfig:
+      hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_broadcast_config_2_1(
+          audio_config.get<AudioConfiguration::leAudioBroadcastConfig>()));
+      break;
   }
   return hidl_audio_config;
 }
@@ -552,6 +545,10 @@
       hidl_audio_config.leAudioConfig(to_hidl_leaudio_config_2_2(
           audio_config.get<AudioConfiguration::leAudioConfig>()));
       break;
+    case AudioConfiguration::leAudioBroadcastConfig:
+      hidl_audio_config.leAudioConfig(to_hidl_leaudio_broadcast_config_2_2(
+          audio_config.get<AudioConfiguration::leAudioBroadcastConfig>()));
+      break;
   }
   return hidl_audio_config;
 }