Merge "Allow CompOS to use DICE from C++"
diff --git a/audio/7.1/Android.bp b/audio/7.1/Android.bp
index 52980e2..cede72a 100644
--- a/audio/7.1/Android.bp
+++ b/audio/7.1/Android.bp
@@ -17,7 +17,6 @@
         "IDevice.hal",
         "IDevicesFactory.hal",
         "IPrimaryDevice.hal",
-        "IStreamIn.hal",
         "IStreamOut.hal",
         "IStreamOutLatencyModeCallback.hal",
     ],
diff --git a/audio/7.1/IDevice.hal b/audio/7.1/IDevice.hal
index 373d17f..c158e7e 100644
--- a/audio/7.1/IDevice.hal
+++ b/audio/7.1/IDevice.hal
@@ -20,7 +20,6 @@
 import @7.0::AudioInOutFlag;
 import @7.0::IDevice;
 import @7.0::Result;
-import IStreamIn;
 import IStreamOut;
 
 interface IDevice extends @7.0::IDevice {
@@ -56,33 +55,14 @@
                     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.
+     * Notifies the device module about the connection state of an input/output
+     * device attached to it. The devicePort identifies the device and may also
+     * provide extra information such as raw audio descriptors.
      *
-     * 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.
+     * @param devicePort audio device port.
+     * @param connected whether the device is connected.
      * @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);
+    setConnectedState_7_1(AudioPort devicePort, bool connected)
+            generates (Result retval);
 };
diff --git a/audio/7.1/IStreamIn.hal b/audio/7.1/IStreamIn.hal
deleted file mode 100644
index abebe6a..0000000
--- a/audio/7.1/IStreamIn.hal
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 {
-};
diff --git a/audio/7.1/config/api/current.txt b/audio/7.1/config/api/current.txt
index 0a0eb02..2963904 100644
--- a/audio/7.1/config/api/current.txt
+++ b/audio/7.1/config/api/current.txt
@@ -462,6 +462,7 @@
     method @Nullable public String getName();
     method @Nullable public java.util.List<android.audio.policy.configuration.V7_1.AudioUsage> getPreferredUsage();
     method @Nullable public java.util.List<android.audio.policy.configuration.V7_1.Profile> getProfile();
+    method @Nullable public long getRecommendedMuteDurationMs();
     method @Nullable public android.audio.policy.configuration.V7_1.Role getRole();
     method public void setFlags(@Nullable java.util.List<android.audio.policy.configuration.V7_1.AudioInOutFlag>);
     method public void setGains(@Nullable android.audio.policy.configuration.V7_1.Gains);
@@ -469,6 +470,7 @@
     method public void setMaxOpenCount(@Nullable long);
     method public void setName(@Nullable String);
     method public void setPreferredUsage(@Nullable java.util.List<android.audio.policy.configuration.V7_1.AudioUsage>);
+    method public void setRecommendedMuteDurationMs(@Nullable long);
     method public void setRole(@Nullable android.audio.policy.configuration.V7_1.Role);
   }
 
diff --git a/audio/7.1/config/audio_policy_configuration.xsd b/audio/7.1/config/audio_policy_configuration.xsd
index defb506..414552e 100644
--- a/audio/7.1/config/audio_policy_configuration.xsd
+++ b/audio/7.1/config/audio_policy_configuration.xsd
@@ -226,6 +226,7 @@
                              </xs:documentation>
                         </xs:annotation>
                     </xs:attribute>
+                    <xs:attribute name="recommendedMuteDurationMs" type="xs:unsignedInt"/>
                 </xs:complexType>
                 <xs:unique name="mixPortProfileUniqueness">
                     <xs:selector xpath="profile"/>
diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp
index 86380a5..df688fd 100644
--- a/audio/core/all-versions/default/Android.bp
+++ b/audio/core/all-versions/default/Android.bp
@@ -48,6 +48,8 @@
         "libhidlbase",
         "liblog",
         "libmedia_helper",
+        "libmediautils_vendor",
+        "libmemunreachable",
         "libutils",
         "android.hardware.audio.common-util",
     ],
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index 98a59b9..b954fcd 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -30,6 +30,8 @@
 #include <algorithm>
 
 #include <android/log.h>
+#include <mediautils/MemoryLeakTrackUtil.h>
+#include <memunreachable/memunreachable.h>
 
 #include <HidlUtils.h>
 
@@ -346,16 +348,6 @@
     _hidl_cb(result, streamOut, suggestedConfig);
     return Void();
 }
-
-Return<void> Device::openInputStream_7_1(int32_t ioHandle, const DeviceAddress& device,
-                                         const AudioConfig& config, const AudioInputFlags& flags,
-                                         const SinkMetadata& sinkMetadata,
-                                         openInputStream_7_1_cb _hidl_cb) {
-    auto [result, streamIn, suggestedConfig] =
-            openInputStreamImpl(ioHandle, device, config, flags, sinkMetadata);
-    _hidl_cb(result, streamIn, suggestedConfig);
-    return Void();
-}
 #endif  // V7.1
 
 Return<bool> Device::supportsAudioPatches() {
@@ -501,9 +493,32 @@
 }
 #endif
 
-Return<void> Device::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /* options */) {
+Return<void> Device::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
     if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
-        analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0]));
+        const int fd0 = fd->data[0];
+        bool dumpMem = false;
+        bool unreachableMemory = false;
+        for (const auto& option : options) {
+            if (option == "-m") {
+                dumpMem = true;
+            } else if (option == "--unreachable") {
+                unreachableMemory = true;
+            }
+        }
+
+        if (dumpMem) {
+            dprintf(fd0, "\nDumping memory:\n");
+            std::string s = dumpMemoryAddresses(100 /* limit */);
+            write(fd0, s.c_str(), s.size());
+        }
+        if (unreachableMemory) {
+            dprintf(fd0, "\nDumping unreachable memory:\n");
+            // TODO - should limit be an argument parameter?
+            std::string s = GetUnreachableMemoryString(true /* contents */, 100 /* limit */);
+            write(fd0, s.c_str(), s.size());
+        }
+
+        analyzeStatus("dump", mDevice->dump(mDevice, fd0));
     }
     return Void();
 }
@@ -591,6 +606,21 @@
 
 #endif
 
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+Return<Result> Device::setConnectedState_7_1(const AudioPort& devicePort, bool connected) {
+    if (version() >= AUDIO_DEVICE_API_VERSION_3_2 &&
+        mDevice->set_device_connected_state_v7 != nullptr) {
+        audio_port_v7 halPort;
+        if (status_t status = HidlUtils::audioPortToHal(devicePort, &halPort); status != NO_ERROR) {
+            return analyzeStatus("audioPortToHal", status);
+        }
+        return analyzeStatus("set_device_connected_state_v7",
+                             mDevice->set_device_connected_state_v7(mDevice, &halPort, connected));
+    }
+    return Result::NOT_SUPPORTED;
+}
+#endif
+
 }  // namespace implementation
 }  // namespace CPP_VERSION
 }  // namespace audio
diff --git a/audio/core/all-versions/default/include/core/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h
index 0aeb6b3..0696f97 100644
--- a/audio/core/all-versions/default/include/core/default/Device.h
+++ b/audio/core/all-versions/default/include/core/default/Device.h
@@ -123,10 +123,6 @@
                                       const AudioConfig& config, const AudioOutputFlags& flags,
                                       const SourceMetadata& sourceMetadata,
                                       openOutputStream_7_1_cb _hidl_cb) override;
-    Return<void> openInputStream_7_1(int32_t ioHandle, const DeviceAddress& device,
-                                     const AudioConfig& config, const AudioInputFlags& flags,
-                                     const SinkMetadata& sinkMetadata,
-                                     openInputStream_7_1_cb _hidl_cb) override;
 #endif
 
     Return<bool> supportsAudioPatches() override;
@@ -163,6 +159,9 @@
                                   const hidl_vec<AudioPortConfig>& sinks,
                                   createAudioPatch_cb _hidl_cb) override;
 #endif
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+    Return<Result> setConnectedState_7_1(const AudioPort& devicePort, bool connected) override;
+#endif
     Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
 
     // Utility methods for extending interfaces.
diff --git a/audio/core/all-versions/default/include/core/default/StreamIn.h b/audio/core/all-versions/default/include/core/default/StreamIn.h
index a6346e5..4627eec 100644
--- a/audio/core/all-versions/default/include/core/default/StreamIn.h
+++ b/audio/core/all-versions/default/include/core/default/StreamIn.h
@@ -17,7 +17,9 @@
 #ifndef ANDROID_HARDWARE_AUDIO_STREAMIN_H
 #define ANDROID_HARDWARE_AUDIO_STREAMIN_H
 
-#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h)
+// clang-format off
+#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/IStreamIn.h)
+// clang-format on
 
 #include "Device.h"
 #include "Stream.h"
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
index a567cf9..83ca9eb 100644
--- a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
@@ -15,9 +15,9 @@
  */
 
 // clang-format off
-#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h)
-#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h)
+#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/IStreamIn.h)
 #include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h)
+#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h)
 #include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h)
 // clang-format on
 #include <hidl/HidlSupport.h>
diff --git a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
index b750f56..d82d4ad 100644
--- a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
@@ -16,3 +16,34 @@
 
 // pull in all the <= 7.0 tests
 #include "7.0/AudioPrimaryHidlHalTest.cpp"
+
+TEST_P(AudioHidlDeviceTest, SetConnectedState_7_1) {
+    doc::test("Check that the HAL can be notified of device connection and disconnection");
+    using AD = xsd::AudioDevice;
+    for (auto deviceType : {AD::AUDIO_DEVICE_OUT_HDMI, AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE,
+                            AD::AUDIO_DEVICE_IN_USB_HEADSET}) {
+        SCOPED_TRACE("device=" + toString(deviceType));
+        for (bool state : {true, false}) {
+            SCOPED_TRACE("state=" + ::testing::PrintToString(state));
+            DeviceAddress address = {};
+            address.deviceType = toString(deviceType);
+            if (deviceType == AD::AUDIO_DEVICE_IN_USB_HEADSET) {
+                address.address.alsa({0, 0});
+            }
+            AudioPort devicePort;
+            devicePort.ext.device(address);
+            auto ret = getDevice()->setConnectedState_7_1(devicePort, state);
+            ASSERT_TRUE(ret.isOk());
+            if (ret == Result::NOT_SUPPORTED) {
+                doc::partialTest("setConnectedState_7_1 is not supported");
+                break;  // other deviceType might be supported
+            }
+            ASSERT_OK(ret);
+        }
+    }
+
+    // Because there is no way of knowing if the devices were connected before
+    // calling setConnectedState, there is no way to restore the HAL to its
+    // initial state. To workaround this, destroy the HAL at the end of this test.
+    ASSERT_TRUE(resetDevice());
+}
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index 404532a..fa3ee7f 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -91,8 +91,9 @@
 using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
 using namespace ::android::hardware::audio::common::test::utility;
 using namespace ::android::hardware::audio::CPP_VERSION;
-using ReadParameters = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadParameters;
-using ReadStatus = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadStatus;
+using ReadParameters =
+        ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn::ReadParameters;
+using ReadStatus = ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn::ReadStatus;
 using WriteCommand = ::android::hardware::audio::CPP_VERSION::IStreamOut::WriteCommand;
 using WriteStatus = ::android::hardware::audio::CPP_VERSION::IStreamOut::WriteStatus;
 #if MAJOR_VERSION >= 7
@@ -1089,7 +1090,7 @@
 
 class StreamReader : public StreamWorker<StreamReader> {
   public:
-    using IStreamIn = ::android::hardware::audio::CPP_VERSION::IStreamIn;
+    using IStreamIn = ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn;
 
     StreamReader(IStreamIn* stream, size_t bufferSize)
         : mStream(stream), mBufferSize(bufferSize), mData(mBufferSize) {}
@@ -1204,7 +1205,8 @@
     EventFlag* mEfGroup = nullptr;
 };
 
-class InputStreamTest : public OpenStreamTest<::android::hardware::audio::CPP_VERSION::IStreamIn> {
+class InputStreamTest
+    : public OpenStreamTest<::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn> {
     void SetUp() override {
         ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp());  // setup base
 #if MAJOR_VERSION <= 6
@@ -1226,13 +1228,8 @@
         auto flags = getInputFlags();
         testOpen(
                 [&](AudioIoHandle handle, AudioConfig config, auto cb) {
-#if MAJOR_VERSION < 7 || (MAJOR_VERSION == 7 && MINOR_VERSION == 0)
                     return getDevice()->openInputStream(handle, address, config, flags,
                                                         initMetadata, cb);
-#elif MAJOR_VERSION == 7 && MINOR_VERSION == 1
-                    return getDevice()->openInputStream_7_1(handle, address, config, flags,
-                                                            initMetadata, cb);
-#endif
                 },
                 config);
     }
@@ -1605,8 +1602,9 @@
                             "InputStream::setGain");
 }
 
-static void testPrepareForReading(::android::hardware::audio::CPP_VERSION::IStreamIn* stream,
-                                  uint32_t frameSize, uint32_t framesCount) {
+static void testPrepareForReading(
+        ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn* stream, uint32_t frameSize,
+        uint32_t framesCount) {
     Result res;
     // Ignore output parameters as the call should fail
     ASSERT_OK(stream->prepareForReading(frameSize, framesCount,
diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp
index 4acfd82..623097c 100644
--- a/automotive/audiocontrol/aidl/Android.bp
+++ b/automotive/audiocontrol/aidl/Android.bp
@@ -13,11 +13,17 @@
     name: "android.hardware.automotive.audiocontrol",
     vendor_available: true,
     srcs: ["android/hardware/automotive/audiocontrol/*.aidl"],
+    imports: [
+        "android.media.audio.common.types",
+        "android.hardware.audio.common",
+    ],
     stability: "vintf",
     backend: {
         java: {
-            sdk_version: "module_current",
+            platform_apis: true,
         },
     },
-    versions: ["1"],
+    versions: [
+        "1",
+    ],
 }
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
index 3dc393a..58a3667 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// 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 changes to the AIDL files built
+// 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
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
similarity index 85%
rename from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
rename to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
index 766f637..fb6ac65 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 The Android Open Source Project
+ * 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.
@@ -31,10 +31,10 @@
 // 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,
+package android.hardware.automotive.audiocontrol;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable AudioGainConfigInfo {
+  int zoneId;
+  String devicePortAddress;
+  int volumeIndex;
 }
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
index 6d729e2..23abb46 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// 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 changes to the AIDL files built
+// 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
@@ -22,4 +38,5 @@
   String[] deviceAddressesToDuck;
   String[] deviceAddressesToUnduck;
   String[] usagesHoldingFocus;
+  @nullable android.hardware.audio.common.PlaybackTrackMetadata[] playbackMetaDataHoldingFocus;
 }
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index bc4162b..8dc5ffe 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// 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 changes to the AIDL files built
+// 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
@@ -18,10 +34,16 @@
 package android.hardware.automotive.audiocontrol;
 @VintfStability
 interface IAudioControl {
+  /**
+   * @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead.
+   */
   oneway void onAudioFocusChange(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
   oneway void onDevicesToDuckChange(in android.hardware.automotive.audiocontrol.DuckingInfo[] duckingInfos);
   oneway void onDevicesToMuteChange(in android.hardware.automotive.audiocontrol.MutingInfo[] mutingInfos);
   oneway void registerFocusListener(in android.hardware.automotive.audiocontrol.IFocusListener listener);
   oneway void setBalanceTowardRight(in float value);
   oneway void setFadeTowardFront(in float value);
+  oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
+  oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains);
+  oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback);
 }
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
similarity index 82%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
index 766f637..17a087f 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 The Android Open Source Project
+ * 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.
@@ -31,10 +31,8 @@
 // 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,
+package android.hardware.automotive.audiocontrol;
+@VintfStability
+interface IAudioGainCallback {
+  oneway void onAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains);
 }
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
index f00f042..3e17552 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// 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 changes to the AIDL files built
+// 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
@@ -20,4 +36,6 @@
 interface IFocusListener {
   oneway void abandonAudioFocus(in String usage, in int zoneId);
   oneway void requestAudioFocus(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain);
+  oneway void abandonAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId);
+  oneway void requestAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain);
 }
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
index ab902ec..b25ed0f 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// 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 changes to the AIDL files built
+// 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
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/Reasons.aidl
similarity index 79%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/Reasons.aidl
index 766f637..c1e22d4 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/Reasons.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 The Android Open Source Project
+ * 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.
@@ -31,10 +31,17 @@
 // 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,
+package android.hardware.automotive.audiocontrol;
+@Backing(type="int") @VintfStability
+enum Reasons {
+  FORCED_MASTER_MUTE = 1,
+  REMOTE_MUTE = 2,
+  TCU_MUTE = 4,
+  ADAS_DUCKING = 8,
+  NAV_DUCKING = 16,
+  PROJECTION_DUCKING = 32,
+  THERMAL_LIMITATION = 64,
+  SUSPEND_EXIT_VOL_LIMITATION = 128,
+  EXTERNAL_AMP_VOL_FEEDBACK = 256,
+  OTHER = -2147483648,
 }
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
new file mode 100644
index 0000000..c938296
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
@@ -0,0 +1,50 @@
+/*
+ * 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.automotive.audiocontrol;
+
+/**
+ * NOTE:
+ * Was expecting to reuse android.media.audio types... Limit info to minimum to prevent
+ * duplicating aidl_api. Will follow up if AudioGainConfig is exposed by android.media AIDL API.
+ */
+@JavaDerive(equals=true, toString=true)
+@VintfStability
+parcelable AudioGainConfigInfo {
+    /**
+     * The identifier for the audio zone the audio device port associated to this gain belongs to.
+     *
+     */
+    int zoneId;
+
+    /**
+     * The Audio Output Device Port Address.
+     *
+     * This is the address that can be retrieved at JAVA layer using the introspection
+     * {@link android.media.AudioManager#listAudioDevicePorts} API then
+     * {@link audio.media.AudioDeviceInfo#getAddress} API.
+     *
+     * At HAL layer, it corresponds to audio_port_v7.audio_port_device_ext.address.
+     *
+     * Devices that does not have an address will indicate an empty string "".
+     */
+    String devicePortAddress;
+
+    /**
+     * UI Index of the corresponding AudioGain in AudioPort.gains.
+     */
+    int volumeIndex;
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
index e95fe9b..c30d5f6 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
- package android.hardware.automotive.audiocontrol;
+package android.hardware.automotive.audiocontrol;
+
+import android.hardware.audio.common.PlaybackTrackMetadata;
 
  /**
   * The current ducking information for a single audio zone.
@@ -48,7 +50,15 @@
      /**
       * List of usages currently holding focus for this audio zone.
       *
+      * This field was deprecated in version 2.
+      * Use playbackMetaDataHoldingFocus instead.
+      *
       * <p> See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
       */
      String[] usagesHoldingFocus;
- }
\ No newline at end of file
+
+     /**
+      *  List of output stream metadata associated with the current focus holder for this audio zone
+      */
+     @nullable PlaybackTrackMetadata[] playbackMetaDataHoldingFocus;
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index 3a02245..100f1ba 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -20,6 +20,40 @@
 import android.hardware.automotive.audiocontrol.DuckingInfo;
 import android.hardware.automotive.audiocontrol.MutingInfo;
 import android.hardware.automotive.audiocontrol.IFocusListener;
+import android.hardware.automotive.audiocontrol.IAudioGainCallback;
+import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
+import android.hardware.automotive.audiocontrol.Reasons;
+
+/**
+ * Important note on Metadata:
+ * Metadata qualifies a playback track for an output stream.
+ * This is highly closed to {@link android.media.AudioAttributes}.
+ * It allows to identify the audio stream rendered / requesting / abandonning the focus.
+ *
+ * AudioControl 1.0 was limited to identification through {@code AttributeUsage} listed as
+ * {@code audioUsage} in audio_policy_configuration.xsd.
+ *
+ * Any new OEM needs would not be possible without extension.
+ *
+ * Relying on {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata} allows
+ * to use a combination of {@code AttributeUsage}, {@code AttributeContentType} and
+ * {@code AttributeTags} to identify the use case / routing thanks to
+ * {@link android.media.audiopolicy.AudioProductStrategy}.
+ * The belonging to a strategy is deduced by an AOSP logic (in sync at native and java layer).
+ *
+ * IMPORTANT NOTE ON TAGS:
+ * To limit the possibilies and prevent from confusion, we expect the String to follow
+ * a given formalism that will be enforced.
+ *
+ * 1 / By convention, tags shall be a "key=value" pair.
+ * Vendor must namespace their tag's key (for example com.google.strategy=VR) to avoid conflicts.
+ * vendor specific applications and must be prefixed by "VX_". Vendor must
+ *
+ * 2 / Tags reported here shall be the same as the tags used to define a given
+ * {@link android.media.audiopolicy.AudioProductStrategy} and so in
+ * audio_policy_engine_configuration.xml file.
+ */
+import android.hardware.audio.common.PlaybackTrackMetadata;
 
 /**
  * Interacts with the car's audio subsystem to manage audio sources and volumes
@@ -36,8 +70,12 @@
      * The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
      * is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
      *
+     * This method was deprecated in version 2 to allow getting rid of usages limitation.
+     * Use {@link IAudioControl#onAudioFocusChangeWithMetaData} instead.
+     *
      * @param usage The audio usage associated with the focus change {@code AttributeUsage}. See
      * {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+     * @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead.
      * @param zoneId The identifier for the audio zone that the HAL is playing the stream in
      * @param focusChange the AudioFocusChange that has occurred.
      */
@@ -99,4 +137,51 @@
      * range.
      */
     oneway void setFadeTowardFront(in float value);
-}
\ No newline at end of file
+
+    /**
+     * Notifies HAL of changes in audio focus status for focuses requested or abandoned by the HAL.
+     *
+     * This will be called in response to IFocusListener's requestAudioFocus and
+     * abandonAudioFocus, as well as part of any change in focus being held by the HAL due focus
+     * request from other activities or services.
+     *
+     * The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
+     * is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
+     *
+     * @param playbackMetaData The output stream metadata associated with the focus request
+     * @param zoneId The identifier for the audio zone that the HAL is playing the stream in
+     * @param focusChange the AudioFocusChange that has occurred.
+     */
+    oneway void onAudioFocusChangeWithMetaData(in PlaybackTrackMetadata playbackMetaData,
+        in int zoneId, in AudioFocusChange focusChange);
+
+     /**
+     * Notifies HAL of changes in output devices that the HAL should apply gain change to
+     * and the reason(s) why
+     *
+     * This may be called in response to changes in audio focus, and will include a list of
+     * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} objects per audio zone
+     * that experienced a change in audo focus.
+     *
+     * @param reasons List of reasons that triggered the given gains changed.
+     *                This must be one or more of the
+     *                {@link android.hardware.automotive.audiocontrol.Reasons} constants.
+     *
+     * @param gains List of gains the change is intended to.
+      */
+     oneway void setAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains);
+
+    /**
+     * Registers callback to be used by HAL for reporting unexpected gain(s) changed and the
+     * reason(s) why.
+     *
+     * It is expected that there will only ever be a single callback registered. If the
+     * observer dies, the HAL implementation must unregister observer automatically. If called when
+     * a listener is already registered, the existing one should be unregistered and replaced with
+     * the new callback.
+     *
+     * @param callback The {@link android.hardware.automotive.audiocontrol.IAudioGainCallback}
+     *                 interface.
+     */
+    oneway void registerGainCallback(in IAudioGainCallback callback);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
new file mode 100644
index 0000000..17b4341
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
@@ -0,0 +1,65 @@
+/*
+ * 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.automotive.audiocontrol;
+
+import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
+import android.hardware.automotive.audiocontrol.Reasons;
+
+/**
+ * Interface definition for a callback to be invoked when the gain(s) of the device port(s) is(are)
+ * updated at HAL layer.
+ *
+ * <p>This defines counter part API of
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#onDevicesToDuckChange},
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#onDevicesToMuteChange} and
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#setAudioDeviceGainsChanged} APIs.
+ *
+ * The previous API defines Mute/Duck order decided by the client (e.g. CarAudioService)
+ * and delegated to AudioControl for application.
+ *
+ * This callback interface defines Mute/Duck notification decided by AudioControl HAL (due to
+ * e.g. - external conditions from Android IVI subsystem
+ *      - regulation / need faster decision rather than using
+ *        {@link android.hardware.automotive.audiocontrol.IAudioControl#onAudioFocusChange} to
+ *        report the use case and then waiting for CarAudioService decision to Mute/Duck.
+ */
+@VintfStability
+oneway interface IAudioGainCallback {
+    /**
+     * Used to indicated the one or more audio device port gains have changed unexpectidely, i.e.
+     * initiated by HAL, not by CarAudioService.
+     * This is the counter part of the
+     *      {@link android.hardware.automotive.audiocontrol.onDevicesToDuckChange},
+     *      {@link android.hardware.automotive.audiocontrol.onDevicesToMuteChange} and
+     *      {@link android.hardware.automotive.audiocontrol.setAudioDeviceGainsChanged} APIs.
+     *
+     * Flexibility is given to OEM to mute/duck in HAL or in CarAudioService.
+     * For critical use cases (i.e. when regulation is required), better to handle mute/duck in
+     * HAL layer and informs upper layer.
+     * Non critical use case may report gain and focus and CarAudioService to decide of duck/mute.
+     *
+     * @param reasons List of reasons that triggered the given gains changed.
+     *                This must be one or more of the
+     *                {@link android.hardware.automotive.audiocontrol.Reasons} constants.
+     *                It will define if the port has been muted/ducked or must now affected
+     *                by gain limitation that shall be notified/enforced at CarAudioService
+     *                layer.
+     *
+     * @param gains List of gains affected by the change.
+     */
+    void onAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
index b79295a..1ce1f40 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
@@ -18,10 +18,13 @@
 
 import android.hardware.automotive.audiocontrol.AudioFocusChange;
 
+import android.hardware.audio.common.PlaybackTrackMetadata;
+
 /**
  * Callback interface for audio focus listener.
  *
  * For typical configuration, the listener the car audio service.
+ *
  */
 @VintfStability
 interface IFocusListener {
@@ -33,6 +36,9 @@
      * interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
      * before stopping audio playback.
      *
+     * Deprecated in version 2 to allow generic interface callback listener.
+     * Use {@link IFocusListener#abandonHalAudioFocusWithMetaData} instead.
+     *
      * @param usage The audio usage for which the HAL is abandoning focus {@code AttributeUsage}.
      * See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
      * @param zoneId The identifier for the audio zone that the HAL abandoning focus
@@ -47,6 +53,9 @@
      * interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
      * before playing audio.
      *
+     * Deprecated in version 2 to allow generic interface callback listener.
+     * Use {@link IFocusListener#requestAudioFocusWithMetaData} instead.
+     *
      * @param usage The audio usage associated with the focus request {@code AttributeUsage}. See
      * {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
      * @param zoneId The identifier for the audio zone where the HAL is requesting focus
@@ -54,4 +63,29 @@
      * following: GAIN, GAIN_TRANSIENT, GAIN_TRANSIENT_MAY_DUCK, GAIN_TRANSIENT_EXCLUSIVE.
      */
     oneway void requestAudioFocus(in String usage, in int zoneId, in AudioFocusChange focusGain);
-}
\ No newline at end of file
+
+    /**
+     * Used to indicate that the audio output stream associated with
+     * {@link android.hardware.audio.common.PlaybackTrackMetadata} has released
+     * the focus.
+     *
+     * @param playbackMetaData The output stream metadata associated with the focus request
+     * @param zoneId The identifier for the audio zone that the HAL abandoning focus
+     */
+    oneway void abandonAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData,
+            in int zoneId);
+
+    /**
+     * Used to indicate that the audio output stream associated with
+     * {@link android.hardware.audio.common.PlaybackTrackMetadata} has taken the focus.
+     *
+     * @param playbackMetaData The output stream metadata associated with the focus request
+     * @param zoneId The identifier for the audio zone that the HAL abandoning focus
+     * @param focusGain The focus type requested.
+     *                  This must be one of the
+     *                  {@link android.hardware.automotive.audiocontrol.AudioFocusChange}
+     *                  constants.
+     */
+    oneway void requestAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData,
+          in int zoneId, in AudioFocusChange focusGain);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl
new file mode 100644
index 0000000..3d9e8a2
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl
@@ -0,0 +1,85 @@
+/*
+ * 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.automotive.audiocontrol;
+
+/**
+ * Enum to identify the reason(s) of
+ * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} changed event
+ */
+@Backing(type="int")
+@VintfStability
+enum Reasons {
+    /**
+     * Magic Key Code (may be SWRC button combination) to force muting all audio sources.
+     * This may be used for example in case of cyber attach to ensure driver can safely drive back
+     * to garage to restore sw.
+     */
+    FORCED_MASTER_MUTE               = 0x1,
+    /**
+    * Reports a mute request outside the IVI (Android) system.
+    * It may target to mute the list of
+    * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo}.
+    * A focus request may also be reported in addition if the use case that initiates the mute
+    * has matching {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata}
+    * For regulation issue, the action of mute could be managed by HAL itself.
+     */
+    REMOTE_MUTE                     = 0x2,
+    /**
+    * Reports a mute initiated by the TCU. It may be applied to all audio source (no
+    * associated {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} reported, or
+    * it may target to mute only the given list of ports.
+    * A focus request may also be reported in addition.
+    * For regulation issue, the action of mute could be managed by HAL itself.
+     */
+    TCU_MUTE                        = 0x4,
+    /**
+     * Reports a duck due to ADAS use case. A focus request may also be reported in addition.
+     * For regulation issue, the action of duck could be managed by HAL itself.
+     * It gives a chance to CarAudioService to decide whether contextual volume change may be
+     * applied from the ducked index base or not.
+     */
+    ADAS_DUCKING                    = 0x8,
+    /**
+     * Reports a duck due to navigation use case. It gives a chance to CarAudioService to decide
+     * whether contextual volume change may be applied from the ducked index base or not.
+     */
+    NAV_DUCKING                     = 0x10,
+    /**
+     * Some device projection stack may send signal to IVI to duck / unduck main audio stream.
+     * In this case, Contextual Volume Policy may be adapted to control the alternate / secondary
+     * audio stream.
+     */
+    PROJECTION_DUCKING              = 0x20,
+    /**
+     * When the amplifier is overheating, it may be recovered by limiting the volume.
+     */
+    THERMAL_LIMITATION              = 0x40,
+    /**
+     * Before the system enters suspend, it may ensure while exiting suspend or during cold boot
+     * that the volume is limited to prevent from sound explosion.
+     */
+    SUSPEND_EXIT_VOL_LIMITATION     = 0x80,
+    /**
+     * When using an external amplifier, it may be required to keep volume in sync and have
+     * asynchronous notification of effective volume change.
+     */
+    EXTERNAL_AMP_VOL_FEEDBACK       = 0x100,
+    /**
+     * For other OEM use.
+     */
+    OTHER                           = 0x80000000,
+}
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/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/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
index 54e82d1..8090d26 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
@@ -131,6 +131,8 @@
     return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
   }
   LOG(INFO) << __func__ << " - allowed " << allowed;
+  BluetoothAudioSessionReport::ReportLowLatencyModeAllowedChanged(
+    session_type_, allowed);
   return ndk::ScopedAStatus::ok();
 }
 
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..b90a656 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 =
@@ -410,6 +416,22 @@
   }
 }
 
+void BluetoothAudioSession::ReportLowLatencyModeAllowedChanged(bool allowed) {
+  std::lock_guard<std::recursive_mutex> guard(mutex_);
+  if (observers_.empty()) {
+    LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+                 << " has NO port state observer";
+    return;
+  }
+  for (auto& observer : observers_) {
+    uint16_t cookie = observer.first;
+    std::shared_ptr<PortStatusCallbacks> callback = observer.second;
+    LOG(INFO) << __func__
+              << " - allowed=" << (allowed ? " allowed" : " disallowed");
+    callback->low_latency_mode_allowed_cb_(cookie, allowed);
+  }
+}
+
 bool BluetoothAudioSession::GetPresentationPosition(
     PresentationPosition& presentation_position) {
   std::lock_guard<std::recursive_mutex> guard(mutex_);
@@ -577,4 +599,4 @@
 }  // namespace bluetooth
 }  // namespace hardware
 }  // namespace android
-}  // namespace aidl
\ No newline at end of file
+}  // namespace aidl
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
index 5adc0e2..7725331 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
@@ -92,6 +92,15 @@
    * @param: cookie - indicates which bluetooth_audio output should handle
    ***/
   std::function<void(uint16_t cookie)> audio_configuration_changed_cb_;
+  /***
+   * low_latency_mode_allowed_cb_ - when the Bluetooth stack low latency mode
+   * allowed or disallowed, the BluetoothAudioProvider will invoke
+   * this callback to report to the bluetooth_audio module.
+   * @param: cookie - indicates which bluetooth_audio output should handle
+   * @param: allowed - indicates if low latency mode is allowed
+   ***/
+  std::function<void(uint16_t cookie, bool allowed)>
+      low_latency_mode_allowed_cb_;
 };
 
 class BluetoothAudioSession {
@@ -156,6 +165,13 @@
   void ReportAudioConfigChanged(const AudioConfiguration& audio_config);
 
   /***
+   * The report function is used to report that the Bluetooth stack has notified
+   * the low latency mode allowed changed, and will invoke
+   * low_latency_mode_allowed_changed_cb to notify registered bluetooth_audio
+   * outputs
+   ***/
+  void ReportLowLatencyModeAllowedChanged(bool allowed);
+  /***
    * Those control functions are for the bluetooth_audio module to start,
    * suspend, stop stream, to check position, and to update metadata.
    ***/
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/BluetoothAudioSessionReport.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
index 18569c3..03776b5 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
@@ -78,6 +78,18 @@
       session_ptr->ReportAudioConfigChanged(audio_config);
     }
   }
+  /***
+   * The API reports the Bluetooth stack has replied the changed of the low
+   * latency audio allowed, and will inform registered bluetooth_audio outputs
+   ***/
+  static void ReportLowLatencyModeAllowedChanged(
+    const SessionType& session_type, bool allowed) {
+    std::shared_ptr<BluetoothAudioSession> session_ptr =
+        BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+    if (session_ptr != nullptr) {
+      session_ptr->ReportLowLatencyModeAllowedChanged(allowed);
+    }
+  }
 };
 
 }  // namespace audio
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;
 }
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
index 4c99b0f..decff70 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
+++ b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
@@ -77,9 +77,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)};
 
 bool IsOffloadLeAudioConfigurationValid(
     const ::android::hardware::bluetooth::audio::V2_1::SessionType&
diff --git a/health/utils/libhealthloop/HealthLoop.cpp b/health/utils/libhealthloop/HealthLoop.cpp
index 3f4b5bc..4190769 100644
--- a/health/utils/libhealthloop/HealthLoop.cpp
+++ b/health/utils/libhealthloop/HealthLoop.cpp
@@ -40,8 +40,6 @@
 using namespace android;
 using namespace std::chrono_literals;
 
-#define POWER_SUPPLY_SUBSYSTEM "power_supply"
-
 namespace android {
 namespace hardware {
 namespace health {
@@ -143,7 +141,7 @@
     cp = msg;
 
     while (*cp) {
-        if (!strcmp(cp, "SUBSYSTEM=" POWER_SUPPLY_SUBSYSTEM)) {
+        if (!strcmp(cp, "SUBSYSTEM=power_supply")) {
             ScheduleBatteryUpdate();
             break;
         }
diff --git a/identity/support/include/cppbor/cppbor.h b/identity/support/include/cppbor/cppbor.h
index a755db1..af5d82e 100644
--- a/identity/support/include/cppbor/cppbor.h
+++ b/identity/support/include/cppbor/cppbor.h
@@ -274,7 +274,7 @@
     virtual std::unique_ptr<Item> clone() const override { return std::make_unique<Nint>(mValue); }
 
   private:
-    uint64_t addlInfo() const { return -1ll - mValue; }
+    uint64_t addlInfo() const { return -1LL - mValue; }
 
     int64_t mValue;
 };
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index eddf83f..6caac63 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -203,9 +203,8 @@
             }
             int64_t delayUs = finishBy - android::ALooper::GetNowUs();
             if (delayUs < 0) return toStatus(android::TIMED_OUT);
-            (timeoutUs < 0)
-                ? msgCondition.wait(msgLock)
-                : msgCondition.waitRelative(msgLock, delayUs * 1000ll);
+            (timeoutUs < 0) ? msgCondition.wait(msgLock)
+                            : msgCondition.waitRelative(msgLock, delayUs * 1000LL);
         }
     }
 
diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl
index 85c924f..1f44ba7 100644
--- a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl
@@ -39,7 +39,8 @@
   long deadlineNs;
   ParcelFileDescriptor[] modelCache;
   ParcelFileDescriptor[] dataCache;
-  byte[] cacheToken;
+  byte[32] cacheToken;
   android.hardware.neuralnetworks.TokenValuePair[] compilationHints;
   android.hardware.neuralnetworks.ExtensionNameAndPrefix[] extensionNameToPrefix;
+  const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
 }
diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl
index 821b9fe..7808fc2 100644
--- a/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl
+++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl
@@ -39,7 +39,7 @@
     /**
      * The byte size of the cache token.
      */
-    const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
+    const int BYTE_SIZE_OF_CACHE_TOKEN = PrepareModelConfig.BYTE_SIZE_OF_CACHE_TOKEN;
     /**
      * The maximum number of files for each type of cache in compilation caching.
      */
diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl
index 949804e..f752750 100644
--- a/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl
+++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl
@@ -204,6 +204,12 @@
      * appropriate ErrorStatus value. If the inputs to the function are valid and there is no error,
      * createReusableExecution must construct a reusable execution.
      *
+     * This method will be called when a client requests a reusable execution with consistent
+     * request and execution config. For single-time execution,
+     * {@link IPreparedModel::executeSynchronouslyWithConfig} or
+     * {@link IPreparedModel::executeFencedWithConfig} is preferred, because the overhead of
+     * setting up a reusable execution can be avoided.
+     *
      * @param request The input and output information on which the prepared model is to be
      *                executed.
      * @param config Specifies the execution configuration parameters.
@@ -223,6 +229,10 @@
      * ExecutionConfig} instead of a list of configuration parameters, and ExecutionConfig contains
      * more configuration parameters than are passed to executeSynchronously.
      *
+     * This method is preferred when a client requests a single-time synchronous execution.
+     * For reusable execution with consistent request and execution config,
+     * {@link IPreparedModel::createReusableExecution} must be called.
+     *
      * @param request The input and output information on which the prepared model is to be
      *                executed.
      * @param config Specifies the execution configuration parameters.
@@ -246,6 +256,10 @@
      * ExecutionConfig} instead of a list of configuration parameters, and ExecutionConfig contains
      * more configuration parameters than are passed to executeFenced.
      *
+     * This method is preferred when a client requests a single-time fenced execution.
+     * For reusable execution with consistent request and execution config,
+     * {@link IPreparedModel::createReusableExecution} must be called.
+     *
      * @param request The input and output information on which the prepared model is to be
      *                executed. The outputs in the request must have fully specified dimensions.
      * @param waitFor A vector of sync fence file descriptors. Execution must not start until all
diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl
index 96df968..55bd291 100644
--- a/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl
+++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl
@@ -28,6 +28,11 @@
 @VintfStability
 parcelable PrepareModelConfig {
     /**
+     * The byte size of the cache token.
+     */
+    const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
+
+    /**
      * Indicates the intended execution behavior of a prepared model.
      */
     ExecutionPreference preference;
@@ -66,7 +71,7 @@
      */
     ParcelFileDescriptor[] dataCache;
     /**
-     * A caching token of length IDevice::BYTE_SIZE_OF_CACHE_TOKEN identifying
+     * A caching token of length BYTE_SIZE_OF_CACHE_TOKEN identifying
      * the prepared model. The same token will be provided when
      * retrieving the prepared model from the cache files with
      * IDevice::prepareModelFromCache.  Tokens should be chosen to have a low
@@ -77,7 +82,7 @@
      * indicating that caching information is not provided, this
      * token must be ignored.
      */
-    byte[] cacheToken;
+    byte[BYTE_SIZE_OF_CACHE_TOKEN] cacheToken;
     /**
      * A vector of token / value pairs represent vendor specific
      * compilation hints or metadata. The provided TokenValuePairs must not
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h
index af58715..71a28ef 100644
--- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h
@@ -27,6 +27,7 @@
 #include <aidl/android/hardware/neuralnetworks/Extension.h>
 #include <aidl/android/hardware/neuralnetworks/ExtensionNameAndPrefix.h>
 #include <aidl/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.h>
+#include <aidl/android/hardware/neuralnetworks/IDevice.h>
 #include <aidl/android/hardware/neuralnetworks/Memory.h>
 #include <aidl/android/hardware/neuralnetworks/Model.h>
 #include <aidl/android/hardware/neuralnetworks/Operand.h>
@@ -219,6 +220,7 @@
 #endif  // NN_AIDL_V4_OR_ABOVE
 
 nn::GeneralResult<std::vector<int32_t>> toSigned(const std::vector<uint32_t>& vec);
+std::vector<uint8_t> toVec(const std::array<uint8_t, IDevice::BYTE_SIZE_OF_CACHE_TOKEN>& token);
 
 }  // namespace aidl::android::hardware::neuralnetworks::utils
 
diff --git a/neuralnetworks/aidl/utils/src/Conversions.cpp b/neuralnetworks/aidl/utils/src/Conversions.cpp
index 9b897c4..83fda10 100644
--- a/neuralnetworks/aidl/utils/src/Conversions.cpp
+++ b/neuralnetworks/aidl/utils/src/Conversions.cpp
@@ -614,7 +614,7 @@
     using Ts::operator()...;
 };
 template <class... Ts>
-overloaded(Ts...)->overloaded<Ts...>;
+overloaded(Ts...) -> overloaded<Ts...>;
 
 #ifdef __ANDROID__
 nn::GeneralResult<common::NativeHandle> aidlHandleFromNativeHandle(
@@ -1190,4 +1190,8 @@
     return std::vector<int32_t>(vec.begin(), vec.end());
 }
 
+std::vector<uint8_t> toVec(const std::array<uint8_t, IDevice::BYTE_SIZE_OF_CACHE_TOKEN>& token) {
+    return std::vector<uint8_t>(token.begin(), token.end());
+}
+
 }  // namespace aidl::android::hardware::neuralnetworks::utils
diff --git a/neuralnetworks/aidl/utils/src/Device.cpp b/neuralnetworks/aidl/utils/src/Device.cpp
index f3f4fdb..b64a40d 100644
--- a/neuralnetworks/aidl/utils/src/Device.cpp
+++ b/neuralnetworks/aidl/utils/src/Device.cpp
@@ -229,7 +229,6 @@
     const auto aidlDeadline = NN_TRY(convert(deadline));
     auto aidlModelCache = NN_TRY(convert(modelCache));
     auto aidlDataCache = NN_TRY(convert(dataCache));
-    const auto aidlToken = NN_TRY(convert(token));
 
     const auto cb = ndk::SharedRefBase::make<PreparedModelCallback>(kFeatureLevel);
     const auto scoped = kDeathHandler.protectCallback(cb.get());
@@ -240,12 +239,13 @@
         const auto ret = kDevice->prepareModelWithConfig(
                 aidlModel,
                 {aidlPreference, aidlPriority, aidlDeadline, std::move(aidlModelCache),
-                 std::move(aidlDataCache), aidlToken, std::move(aidlHints),
+                 std::move(aidlDataCache), token, std::move(aidlHints),
                  std::move(aidlExtensionPrefix)},
                 cb);
         HANDLE_ASTATUS(ret) << "prepareModel failed";
         return cb->get();
     }
+    const auto aidlToken = NN_TRY(convert(token));
     const auto ret = kDevice->prepareModel(aidlModel, aidlPreference, aidlPriority, aidlDeadline,
                                            aidlModelCache, aidlDataCache, aidlToken, cb);
     HANDLE_ASTATUS(ret) << "prepareModel failed";
diff --git a/neuralnetworks/aidl/utils/src/InvalidDevice.cpp b/neuralnetworks/aidl/utils/src/InvalidDevice.cpp
index 33270ff..44f8ea9 100644
--- a/neuralnetworks/aidl/utils/src/InvalidDevice.cpp
+++ b/neuralnetworks/aidl/utils/src/InvalidDevice.cpp
@@ -189,7 +189,8 @@
         }
     }
     return prepareModel(model, config.preference, config.priority, config.deadlineNs,
-                        config.modelCache, config.dataCache, config.cacheToken, callback);
+                        config.modelCache, config.dataCache, utils::toVec(config.cacheToken),
+                        callback);
 }
 
 ndk::ScopedAStatus InvalidDevice::prepareModelFromCache(
diff --git a/neuralnetworks/aidl/vts/functional/Utils.h b/neuralnetworks/aidl/vts/functional/Utils.h
index 4e0a4aa..ccb0778 100644
--- a/neuralnetworks/aidl/vts/functional/Utils.h
+++ b/neuralnetworks/aidl/vts/functional/Utils.h
@@ -21,6 +21,7 @@
 #include <gtest/gtest.h>
 
 #include <algorithm>
+#include <array>
 #include <iosfwd>
 #include <string>
 #include <utility>
@@ -47,6 +48,7 @@
 inline constexpr int64_t kOmittedTimeoutDuration = -1;
 inline constexpr int64_t kNoDuration = -1;
 inline const std::vector<uint8_t> kEmptyCacheToken(IDevice::BYTE_SIZE_OF_CACHE_TOKEN);
+inline const std::array<uint8_t, IDevice::BYTE_SIZE_OF_CACHE_TOKEN> kEmptyCacheTokenArray{};
 
 // Returns the amount of space needed to store a value of the specified type.
 //
diff --git a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp
index 931ba25..060434e 100644
--- a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp
@@ -85,7 +85,7 @@
     std::shared_ptr<PreparedModelCallback> preparedModelCallback =
             ndk::SharedRefBase::make<PreparedModelCallback>();
     const auto prepareLaunchStatus = device->prepareModelWithConfig(
-            model, {preference, priority, kNoDeadline, {}, {}, kEmptyCacheToken, {}, {}},
+            model, {preference, priority, kNoDeadline, {}, {}, kEmptyCacheTokenArray, {}, {}},
             preparedModelCallback);
     ASSERT_FALSE(prepareLaunchStatus.isOk());
     ASSERT_EQ(prepareLaunchStatus.getExceptionCode(), EX_SERVICE_SPECIFIC);
diff --git a/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
index 51b4805..bf87f15 100644
--- a/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
@@ -72,7 +72,7 @@
                                                 kNoDeadline,
                                                 {},
                                                 {},
-                                                kEmptyCacheToken,
+                                                kEmptyCacheTokenArray,
                                                 {},
                                                 {}},
                                                preparedModelCallback);
diff --git a/neuralnetworks/utils/adapter/aidl/src/Device.cpp b/neuralnetworks/utils/adapter/aidl/src/Device.cpp
index 84aaddb..1b90a1a 100644
--- a/neuralnetworks/utils/adapter/aidl/src/Device.cpp
+++ b/neuralnetworks/utils/adapter/aidl/src/Device.cpp
@@ -312,8 +312,8 @@
         const std::shared_ptr<IPreparedModelCallback>& callback) {
     const auto result = adapter::prepareModel(
             kDevice, kExecutor, model, config.preference, config.priority, config.deadlineNs,
-            config.modelCache, config.dataCache, config.cacheToken, config.compilationHints,
-            config.extensionNameToPrefix, callback);
+            config.modelCache, config.dataCache, utils::toVec(config.cacheToken),
+            config.compilationHints, config.extensionNameToPrefix, callback);
     if (!result.has_value()) {
         const auto& [message, code] = result.error();
         const auto aidlCode = utils::convert(code).value_or(ErrorStatus::GENERAL_FAILURE);
diff --git a/sensors/common/default/2.X/Sensor.cpp b/sensors/common/default/2.X/Sensor.cpp
index 23c9803..fd701fd 100644
--- a/sensors/common/default/2.X/Sensor.cpp
+++ b/sensors/common/default/2.X/Sensor.cpp
@@ -59,10 +59,10 @@
 }
 
 void Sensor::batch(int64_t samplingPeriodNs) {
-    if (samplingPeriodNs < mSensorInfo.minDelay * 1000ll) {
-        samplingPeriodNs = mSensorInfo.minDelay * 1000ll;
-    } else if (samplingPeriodNs > mSensorInfo.maxDelay * 1000ll) {
-        samplingPeriodNs = mSensorInfo.maxDelay * 1000ll;
+    if (samplingPeriodNs < mSensorInfo.minDelay * 1000LL) {
+        samplingPeriodNs = mSensorInfo.minDelay * 1000LL;
+    } else if (samplingPeriodNs > mSensorInfo.maxDelay * 1000LL) {
+        samplingPeriodNs = mSensorInfo.maxDelay * 1000LL;
     }
 
     if (mSamplingPeriodNs != samplingPeriodNs) {
diff --git a/vibrator/aidl/OWNERS b/vibrator/aidl/OWNERS
index ae10db6..3982c7b 100644
--- a/vibrator/aidl/OWNERS
+++ b/vibrator/aidl/OWNERS
@@ -1,4 +1,4 @@
 # Bug component: 345036
 include platform/frameworks/base:/services/core/java/com/android/server/vibrator/OWNERS
 chasewu@google.com
-leungv@google.com
+taikuo@google.com