Merge "Fix C++23 build." into main
diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp
index 114c4c0..210c26b 100644
--- a/audio/aidl/default/alsa/StreamAlsa.cpp
+++ b/audio/aidl/default/alsa/StreamAlsa.cpp
@@ -280,13 +280,22 @@
     const size_t bufferSize = mBufferSizeFrames * mFrameSizeBytes;
     std::vector<char> buffer(bufferSize);
     while (mIoThreadIsRunning) {
-        ssize_t framesRead = mSources[idx]->read(&buffer[0], mBufferSizeFrames);
-        if (framesRead > 0) {
+        ssize_t framesReadOrError = mSources[idx]->read(&buffer[0], mBufferSizeFrames);
+        if (framesReadOrError > 0) {
             int ret = proxy_write_with_retries(mAlsaDeviceProxies[idx].get(), &buffer[0],
-                                               framesRead * mFrameSizeBytes, mReadWriteRetries);
+                                               framesReadOrError * mFrameSizeBytes,
+                                               mReadWriteRetries);
             // Errors when the stream is being stopped are expected.
             LOG_IF(WARNING, ret != 0 && mIoThreadIsRunning)
                     << __func__ << "[" << idx << "]: Error writing into ALSA: " << ret;
+        } else if (framesReadOrError == 0) {
+            // MonoPipeReader does not have a blocking read, while use of std::condition_variable
+            // requires use of a mutex. For now, just do a 1ms sleep. Consider using a different
+            // pipe / ring buffer mechanism.
+            if (mIoThreadIsRunning) usleep(1000);
+        } else {
+            LOG(WARNING) << __func__ << "[" << idx
+                         << "]: Error while reading from the pipe: " << framesReadOrError;
         }
     }
 }
diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
index cef0ea6..f8ead16 100644
--- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
+++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
@@ -283,6 +283,15 @@
         }
         return ::android::OK;
     }
+    // get and hold the sink because 'MonoPipeReader' does not hold a strong pointer to it.
+    sp<MonoPipe> sink = mCurrentRoute->getSink();
+    if (sink == nullptr) {
+        if (++mReadErrorCount < kMaxErrorLogs) {
+            LOG(ERROR) << __func__
+                       << ": the sink has been released! (not all errors will be logged)";
+        }
+        return ::android::OK;
+    }
     mReadErrorCount = 0;
 
     LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 5c75e48..e334ee9 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -88,6 +88,7 @@
 static constexpr int kNPointFFT = 16384;
 static constexpr int kSamplingFrequency = 44100;
 static constexpr int kDefaultChannelLayout = AudioChannelLayout::LAYOUT_STEREO;
+static constexpr float kLn10Div20 = -0.11512925f;  // -ln(10)/20
 
 class EffectHelper {
   public:
@@ -595,6 +596,8 @@
         }
     }
 
+    constexpr float dBToAmplitude(float dB) { return std::exp(dB * kLn10Div20); }
+
     static int getHalVersion(const std::shared_ptr<IEffect>& effect) {
         int version = 0;
         return (effect && effect->getInterfaceVersion(&version).isOk()) ? version : 0;
diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h
index 3a6c137..9ebdc6e 100644
--- a/audio/aidl/vts/TestUtils.h
+++ b/audio/aidl/vts/TestUtils.h
@@ -124,3 +124,30 @@
     EXPECT_PRED_FORMAT2(                                                                           \
             ::android::hardware::audio::common::testing::detail::assertResultOrUnknownTransaction, \
             expected, ret)
+
+namespace android::hardware::audio::common::testing::detail {
+
+template <typename>
+struct mf_traits {};
+template <class T, class U>
+struct mf_traits<U T::*> {
+    using member_type = U;
+};
+
+}  // namespace android::hardware::audio::common::testing::detail
+
+namespace aidl::android::media::audio::common {
+
+template <typename P>
+std::enable_if_t<std::is_function_v<typename ::android::hardware::audio::common::testing::detail::
+                                            mf_traits<decltype(&P::toString)>::member_type>,
+                 std::ostream&>
+operator<<(std::ostream& os, const P& p) {
+    return os << p.toString();
+}
+template <typename E>
+std::enable_if_t<std::is_enum_v<E>, std::ostream&> operator<<(std::ostream& os, const E& e) {
+    return os << toString(e);
+}
+
+}  // namespace aidl::android::media::audio::common
diff --git a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
index eaec88b..7b15e5e 100644
--- a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
@@ -341,7 +341,7 @@
         auto values = criterionV2.values;
         auto valueIt = find_if(values.begin(), values.end(),
                                [&](const auto& typedValue) { return typedValue == value; });
-        EXPECT_NE(valueIt, values.end());
+        EXPECT_NE(valueIt, values.end()) << "Not found: \"" << value << "\"";
     }
 
     /**
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index 70790c4..0d4c74e 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -788,9 +788,10 @@
     void SetUp() override {
         SetUpDynamicsProcessingEffect();
         SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
-        ASSERT_NO_FATAL_FAILURE(generateSineWave(1000 /*Input Frequency*/, mInput, 1.0,
-                                                 kSamplingFrequency, mChannelLayout));
+        ASSERT_NO_FATAL_FAILURE(
+                generateSineWave(kInputFrequency, mInput, 1.0, kSamplingFrequency, mChannelLayout));
         mInputDb = calculateDb(mInput);
+        ASSERT_NEAR(mInputDb, kSineFullScaleDb, kToleranceDb);
     }
 
     void TearDown() override { TearDownDynamicsProcessingEffect(); }
@@ -823,6 +824,9 @@
     static constexpr float kDefaultRatio = 4;
     static constexpr float kDefaultThreshold = -10;
     static constexpr float kDefaultPostGain = 0;
+    static constexpr float kInputFrequency = 1000;
+    // Full scale sine wave with 1000 Hz frequency is -3 dB
+    static constexpr float kSineFullScaleDb = -3;
     std::vector<DynamicsProcessing::LimiterConfig> mLimiterConfigList;
     std::vector<float> mInput;
     float mInputDb;
@@ -887,9 +891,13 @@
     std::vector<float> output(mInput.size());
     for (float postGainDb : postGainDbValues) {
         cleanUpLimiterConfig();
+        ASSERT_NO_FATAL_FAILURE(generateSineWave(kInputFrequency, mInput, dBToAmplitude(postGainDb),
+                                                 kSamplingFrequency, mChannelLayout));
+        mInputDb = calculateDb(mInput);
+        EXPECT_NEAR(mInputDb, kSineFullScaleDb - postGainDb, kToleranceDb);
         for (int i = 0; i < mChannelCount; i++) {
             fillLimiterConfig(mLimiterConfigList, i, true, kDefaultLinkerGroup, kDefaultAttackTime,
-                              kDefaultReleaseTime, kDefaultRatio, -1, postGainDb);
+                              kDefaultReleaseTime, 1, kDefaultThreshold, postGainDb);
         }
         ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
         if (!isAllParamsValid()) {
@@ -1255,6 +1263,7 @@
         ASSERT_NO_FATAL_FAILURE(generateSineWave(mTestFrequencies, mInput, 1.0, kSamplingFrequency,
                                                  mChannelLayout));
         mInputDb = calculateDb(mInput);
+        ASSERT_NEAR(mInputDb, kFullScaleDb, kToleranceDb);
     }
 
     void TearDown() override { TearDownDynamicsProcessingEffect(); }
@@ -1267,12 +1276,7 @@
         addEngineConfig(mEngineConfigPreset);
         addMbcChannelConfig(mChannelConfig);
         addMbcBandConfigs(mCfgs);
-
-        if (isAllParamsValid()) {
-            ASSERT_NO_FATAL_FAILURE(SetAndGetDynamicsProcessingParameters());
-            ASSERT_NO_FATAL_FAILURE(
-                    processAndWriteToOutput(mInput, output, mEffect, &mOpenEffectReturn));
-        }
+        ASSERT_NO_FATAL_FAILURE(setParamsAndProcess(mInput, output));
     }
 
     void fillMbcBandConfig(std::vector<DynamicsProcessing::MbcBandConfig>& cfgs, int channelIndex,
@@ -1387,9 +1391,9 @@
     std::vector<float> postGainDbValues = {-55, -30, 0, 30, 55};
     std::vector<float> output(mInput.size());
     for (float postGainDb : postGainDbValues) {
-        float amplitude = 1.0 / (pow(10, postGainDb / 20));
-        ASSERT_NO_FATAL_FAILURE(generateSineWave(mTestFrequencies, mInput, amplitude,
-                                                 kSamplingFrequency, mChannelLayout));
+        ASSERT_NO_FATAL_FAILURE(generateSineWave(mTestFrequencies, mInput,
+                                                 dBToAmplitude(postGainDb), kSamplingFrequency,
+                                                 mChannelLayout));
         mInputDb = calculateDb(mInput);
         EXPECT_NEAR(mInputDb, kFullScaleDb - postGainDb, kToleranceDb);
         cleanUpMbcConfig();
diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp
index cea085c..095bb86 100644
--- a/audio/effect/all-versions/default/Android.bp
+++ b/audio/effect/all-versions/default/Android.bp
@@ -52,6 +52,12 @@
         "libmedia_headers",
         "libmediautils_headers",
     ],
+
+    cflags: [
+        "-Wall",
+        "-Wthread-safety",
+        "-Werror",
+    ],
 }
 
 cc_library_shared {
diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp
index 4a9e144..9896653 100644
--- a/audio/effect/all-versions/default/Effect.cpp
+++ b/audio/effect/all-versions/default/Effect.cpp
@@ -321,8 +321,8 @@
         status_t status = mProcessThread->join();
         ALOGE_IF(status, "processing thread exit error: %s", strerror(-status));
     }
-    if (mEfGroup) {
-        status_t status = EventFlag::deleteEventFlag(&mEfGroup);
+    if (EventFlag* evFlag = mEfGroup.load(std::memory_order_acquire)) {
+        status_t status = EventFlag::deleteEventFlag(&evFlag);
         ALOGE_IF(status, "processing MQ event flag deletion error: %s", strerror(-status));
     }
     mInBuffer.clear();
@@ -437,6 +437,7 @@
 Result Effect::analyzeStatus(const char* funcName, const char* subFuncName,
                              const char* contextDescription, status_t status) {
     if (status != OK) {
+        std::lock_guard<std::mutex> lock(mLock);
         ALOGW("Effect %p %s %s %s: %s", mHandle, funcName, subFuncName, contextDescription,
               strerror(-status));
     }
@@ -470,11 +471,14 @@
 
 Return<void> Effect::getConfigImpl(int commandCode, const char* commandName,
                                    GetConfigCallback _hidl_cb) {
-    RETURN_RESULT_IF_EFFECT_CLOSED(EffectConfig());
     uint32_t halResultSize = sizeof(effect_config_t);
     effect_config_t halConfig{};
-    status_t status =
-        (*mHandle)->command(mHandle, commandCode, 0, NULL, &halResultSize, &halConfig);
+    status_t status = OK;
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_RESULT_IF_EFFECT_CLOSED(EffectConfig());
+        status = (*mHandle)->command(mHandle, commandCode, 0, NULL, &halResultSize, &halConfig);
+    }
     EffectConfig config;
     if (status == OK) {
         status = EffectUtils::effectConfigFromHal(halConfig, mIsInput, &config);
@@ -542,7 +546,10 @@
 }
 
 Return<void> Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) {
-    RETURN_RESULT_IF_EFFECT_CLOSED(StatusMQ::Descriptor());
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_RESULT_IF_EFFECT_CLOSED(StatusMQ::Descriptor());
+    }
     status_t status;
     // Create message queue.
     if (mStatusMQ) {
@@ -556,16 +563,21 @@
         _hidl_cb(Result::INVALID_ARGUMENTS, StatusMQ::Descriptor());
         return Void();
     }
-    status = EventFlag::createEventFlag(tempStatusMQ->getEventFlagWord(), &mEfGroup);
-    if (status != OK || !mEfGroup) {
+    EventFlag* evFlag = nullptr;
+    status = EventFlag::createEventFlag(tempStatusMQ->getEventFlagWord(), &evFlag);
+    if (status != OK || !evFlag) {
         ALOGE("failed creating event flag for status MQ: %s", strerror(-status));
         _hidl_cb(Result::INVALID_ARGUMENTS, StatusMQ::Descriptor());
         return Void();
     }
+    mEfGroup.store(evFlag, std::memory_order_release);
 
-    // Create and launch the thread.
-    mProcessThread = new ProcessThread(&mStopProcessThread, mHandle, &mHalInBufferPtr,
-                                       &mHalOutBufferPtr, tempStatusMQ.get(), mEfGroup, this);
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        // Create and launch the thread.
+        mProcessThread = new ProcessThread(&mStopProcessThread, mHandle, &mHalInBufferPtr,
+                                           &mHalOutBufferPtr, tempStatusMQ.get(), evFlag, this);
+    }
     status = mProcessThread->run("effect", PRIORITY_URGENT_AUDIO);
     if (status != OK) {
         ALOGW("failed to start effect processing thread: %s", strerror(-status));
@@ -575,11 +587,15 @@
 
     // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power.
     // We do it here instead of the ProcessThread::threadLoop to ensure that mHandle is valid.
-    if (effect_descriptor_t halDescriptor{};
-        (*mHandle)->get_descriptor(mHandle, &halDescriptor) == NO_ERROR &&
-        memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) {
-        const status_t status = scheduler::updateSpatializerPriority(mProcessThread->getTid());
-        ALOGW_IF(status != OK, "Failed to update Spatializer priority");
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_RESULT_IF_EFFECT_CLOSED(StatusMQ::Descriptor());
+        if (effect_descriptor_t halDescriptor{};
+            (*mHandle)->get_descriptor(mHandle, &halDescriptor) == NO_ERROR &&
+            memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) {
+            const status_t status = scheduler::updateSpatializerPriority(mProcessThread->getTid());
+            ALOGW_IF(status != OK, "Failed to update Spatializer priority");
+        }
     }
 
     mStatusMQ = std::move(tempStatusMQ);
@@ -589,7 +605,10 @@
 
 Return<Result> Effect::setProcessBuffers(const AudioBuffer& inBuffer,
                                          const AudioBuffer& outBuffer) {
-    RETURN_IF_EFFECT_CLOSED();
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_IF_EFFECT_CLOSED();
+    }
     AudioBufferManager& manager = AudioBufferManager::getInstance();
     sp<AudioBufferWrapper> tempInBuffer, tempOutBuffer;
     if (!manager.wrap(inBuffer, &tempInBuffer)) {
@@ -614,8 +633,12 @@
 }
 
 Result Effect::sendCommand(int commandCode, const char* commandName, uint32_t size, void* data) {
-    RETURN_IF_EFFECT_CLOSED();
-    status_t status = (*mHandle)->command(mHandle, commandCode, size, data, 0, NULL);
+    status_t status = OK;
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_IF_EFFECT_CLOSED();
+        status = (*mHandle)->command(mHandle, commandCode, size, data, 0, NULL);
+    }
     return analyzeCommandStatus(commandName, sContextCallToCommand, status);
 }
 
@@ -626,9 +649,13 @@
 
 Result Effect::sendCommandReturningData(int commandCode, const char* commandName, uint32_t size,
                                         void* data, uint32_t* replySize, void* replyData) {
-    RETURN_IF_EFFECT_CLOSED();
     uint32_t expectedReplySize = *replySize;
-    status_t status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData);
+    status_t status = OK;
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_IF_EFFECT_CLOSED();
+        status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData);
+    }
     if (status == OK && *replySize != expectedReplySize) {
         status = -ENODATA;
     }
@@ -651,8 +678,12 @@
                                                  uint32_t size, void* data, uint32_t* replySize,
                                                  void* replyData, uint32_t minReplySize,
                                                  CommandSuccessCallback onSuccess) {
-    RETURN_IF_EFFECT_CLOSED();
-    status_t status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData);
+    status_t status = OK;
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_IF_EFFECT_CLOSED();
+        status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData);
+    }
     Result retval;
     if (status == OK && minReplySize >= sizeof(uint32_t) && *replySize >= minReplySize) {
         uint32_t commandStatus = *reinterpret_cast<uint32_t*>(replyData);
@@ -860,10 +891,14 @@
 }
 
 Return<void> Effect::getDescriptor(getDescriptor_cb _hidl_cb) {
-    RETURN_RESULT_IF_EFFECT_CLOSED(EffectDescriptor());
     effect_descriptor_t halDescriptor;
     memset(&halDescriptor, 0, sizeof(effect_descriptor_t));
-    status_t status = (*mHandle)->get_descriptor(mHandle, &halDescriptor);
+    status_t status = OK;
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_RESULT_IF_EFFECT_CLOSED(EffectDescriptor());
+        status = (*mHandle)->get_descriptor(mHandle, &halDescriptor);
+    }
     EffectDescriptor descriptor;
     if (status == OK) {
         status = EffectUtils::effectDescriptorFromHal(halDescriptor, &descriptor);
@@ -874,10 +909,6 @@
 
 Return<void> Effect::command(uint32_t commandId, const hidl_vec<uint8_t>& data,
                              uint32_t resultMaxSize, command_cb _hidl_cb) {
-    if (mHandle == kInvalidEffectHandle) {
-        _hidl_cb(-ENODATA, hidl_vec<uint8_t>());
-        return Void();
-    }
     uint32_t halDataSize;
     std::unique_ptr<uint8_t[]> halData = hidlVecToHal(data, &halDataSize);
     uint32_t halResultSize = resultMaxSize;
@@ -897,8 +928,15 @@
             }
             [[fallthrough]];  // allow 'gtid' overload (checked halDataSize and resultMaxSize).
         default:
-            status = (*mHandle)->command(mHandle, commandId, halDataSize, dataPtr, &halResultSize,
-                                         resultPtr);
+            {
+                std::lock_guard<std::mutex> lock(mLock);
+                if (mHandle == kInvalidEffectHandle) {
+                    _hidl_cb(-ENODATA, hidl_vec<uint8_t>());
+                    return Void();
+                }
+                status = (*mHandle)->command(mHandle, commandId, halDataSize, dataPtr,
+                                            &halResultSize, resultPtr);
+            }
             break;
     }
     hidl_vec<uint8_t> result;
@@ -967,11 +1005,17 @@
         return {Result::INVALID_STATE, kInvalidEffectHandle};
     }
     mStopProcessThread.store(true, std::memory_order_release);
-    if (mEfGroup) {
-        mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::REQUEST_QUIT));
+    EventFlag* evFlag = mEfGroup.load(std::memory_order_acquire);
+    if (evFlag) {
+        evFlag->wake(static_cast<uint32_t>(
+            MessageQueueFlagBits::REQUEST_QUIT));
     }
-    effect_handle_t handle = mHandle;
-    mHandle = kInvalidEffectHandle;
+    effect_handle_t handle;
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        handle = mHandle;
+        mHandle = kInvalidEffectHandle;
+    }
 #if MAJOR_VERSION <= 5
     return {Result::OK, handle};
 #elif MAJOR_VERSION >= 6
@@ -984,7 +1028,10 @@
 }
 
 Return<Result> Effect::close() {
-    RETURN_IF_EFFECT_CLOSED();
+    {
+        std::lock_guard<std::mutex> lock(mLock);
+        RETURN_IF_EFFECT_CLOSED();
+    }
     auto [result, _] = closeImpl();
     return result;
 }
diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h
index 2bcecec..cc76784 100644
--- a/audio/effect/all-versions/default/Effect.h
+++ b/audio/effect/all-versions/default/Effect.h
@@ -25,6 +25,7 @@
 #include <memory>
 #include <tuple>
 #include <vector>
+#include <mutex>
 
 #include <fmq/EventFlag.h>
 #include <fmq/MessageQueue.h>
@@ -194,13 +195,14 @@
     static const char* sContextCallFunction;
 
     const bool mIsInput;
-    effect_handle_t mHandle;
+    std::mutex mLock;
+    effect_handle_t mHandle GUARDED_BY(mLock);
     sp<AudioBufferWrapper> mInBuffer;
     sp<AudioBufferWrapper> mOutBuffer;
     std::atomic<audio_buffer_t*> mHalInBufferPtr;
     std::atomic<audio_buffer_t*> mHalOutBufferPtr;
     std::unique_ptr<StatusMQ> mStatusMQ;
-    EventFlag* mEfGroup;
+    std::atomic<EventFlag*> mEfGroup;
     std::atomic<bool> mStopProcessThread;
     sp<Thread> mProcessThread;
 
diff --git a/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp b/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp
index 08ab5d6..1eb34e2 100644
--- a/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp
+++ b/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp
@@ -157,6 +157,11 @@
 };
 
 class Face : public testing::TestWithParam<std::string> {
+    static void HalServiceDied(void* cookie) {
+        auto halDeathPromise = static_cast<std::promise<void>*>(cookie);
+        halDeathPromise->set_value();
+    }
+
   protected:
     void SetUp() override {
         // Prepare the callback.
@@ -176,8 +181,23 @@
             ASSERT_NE(binder, nullptr);
             mHal = IFace::fromBinder(ndk::SpAIBinder(binder));
 
+            // Create HAL service death notifier
+            auto halDeathPromise = std::make_shared<std::promise<void>>();
+            mHalDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(
+                    AIBinder_DeathRecipient_new(&HalServiceDied));
+            ASSERT_EQ(STATUS_OK, AIBinder_linkToDeath(binder, mHalDeathRecipient.get(),
+                                                      static_cast<void*>(halDeathPromise.get())));
+
             // Create a session.
             isOk = mHal->createSession(kSensorId, kUserId, mCb, &mSession).isOk();
+            if (!isOk) {
+                // Failed to create session on first attempt, it is likely that the HAL service
+                //   is dying or dead. Wait for its death notification signal before next try
+                auto future = halDeathPromise->get_future();
+                auto status = future.wait_for(std::chrono::milliseconds(500));
+                EXPECT_EQ(status, std::future_status::ready);
+            }
+
             ++retries;
         } while (!isOk && retries < 2);
 
@@ -196,6 +216,7 @@
     std::shared_ptr<IFace> mHal;
     std::shared_ptr<SessionCallback> mCb;
     std::shared_ptr<ISession> mSession;
+    ::ndk::ScopedAIBinder_DeathRecipient mHalDeathRecipient;
 };
 
 TEST_P(Face, GetSensorPropsWorksTest) {
diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp
index 8ca44d6..bf3f38e 100644
--- a/biometrics/fingerprint/aidl/default/main.cpp
+++ b/biometrics/fingerprint/aidl/default/main.cpp
@@ -39,8 +39,6 @@
         if (strcmp(argv[1], "default") == 0) {
             const std::string instance = std::string(Fingerprint::descriptor) + "/default";
             auto binder = hal->asBinder();
-            auto binder_ext = hal_vhal->asBinder();
-            CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get()));
             binder_status_t status =
                     AServiceManager_registerLazyService(binder.get(), instance.c_str());
             CHECK_EQ(status, STATUS_OK);
diff --git a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
index 1cd8c76..261ae20 100644
--- a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
+++ b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
@@ -138,6 +138,11 @@
 };
 
 class Fingerprint : public testing::TestWithParam<std::string> {
+    static void HalServiceDied(void* cookie) {
+        auto halDeathPromise = static_cast<std::promise<void>*>(cookie);
+        halDeathPromise->set_value();
+    }
+
   protected:
     void SetUp() override {
         // Prepare the callback.
@@ -157,8 +162,24 @@
             ASSERT_NE(binder, nullptr);
             mHal = IFingerprint::fromBinder(ndk::SpAIBinder(binder));
 
+            // Create HAL service death notifier
+            auto halDeathPromise = std::make_shared<std::promise<void>>();
+            mHalDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(
+                    AIBinder_DeathRecipient_new(&HalServiceDied));
+            ASSERT_EQ(STATUS_OK, AIBinder_linkToDeath(binder, mHalDeathRecipient.get(),
+                                                      static_cast<void*>(halDeathPromise.get())));
+
             // Create a session.
             isOk = mHal->createSession(kSensorId, kUserId, mCb, &mSession).isOk();
+
+            if (!isOk) {
+                // Failed to create session on first attempt, it is likely that the HAL service
+                //   is dying or dead. Wait for its death notification signal before next try
+                auto future = halDeathPromise->get_future();
+                auto status = future.wait_for(std::chrono::milliseconds(500));
+                EXPECT_EQ(status, std::future_status::ready);
+            }
+
             ++retries;
         } while (!isOk && retries < 2);
 
@@ -177,6 +198,7 @@
     std::shared_ptr<IFingerprint> mHal;
     std::shared_ptr<SessionCallback> mCb;
     std::shared_ptr<ISession> mSession;
+    ::ndk::ScopedAIBinder_DeathRecipient mHalDeathRecipient;
 };
 
 TEST_P(Fingerprint, GetSensorPropsWorksTest) {
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
index 3f1f5f6..3d7c376 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
@@ -123,40 +123,6 @@
   return (sessionType == session_type_);
 }
 
-std::string getSettingOutputString(
-    IBluetoothAudioProvider::LeAudioAseConfigurationSetting& setting) {
-  std::stringstream ss;
-  std::string name = "";
-  if (!setting.sinkAseConfiguration.has_value() &&
-      !setting.sourceAseConfiguration.has_value())
-    return "";
-  std::vector<
-      std::optional<LeAudioAseConfigurationSetting::AseDirectionConfiguration>>*
-      directionAseConfiguration;
-  if (setting.sinkAseConfiguration.has_value() &&
-      !setting.sinkAseConfiguration.value().empty())
-    directionAseConfiguration = &setting.sinkAseConfiguration.value();
-  else
-    directionAseConfiguration = &setting.sourceAseConfiguration.value();
-  for (auto& aseConfiguration : *directionAseConfiguration) {
-    if (aseConfiguration.has_value() &&
-        aseConfiguration.value().aseConfiguration.metadata.has_value()) {
-      for (auto& meta :
-           aseConfiguration.value().aseConfiguration.metadata.value()) {
-        if (meta.has_value() &&
-            meta.value().getTag() == MetadataLtv::vendorSpecific) {
-          auto k = meta.value().get<MetadataLtv::vendorSpecific>().opaqueValue;
-          name = std::string(k.begin(), k.end());
-          break;
-        }
-      }
-    }
-  }
-
-  ss << "setting name: " << name << ", setting: " << setting.toString();
-  return ss.str();
-}
-
 ndk::ScopedAStatus LeAudioOffloadAudioProvider::startSession(
     const std::shared_ptr<IBluetoothAudioPort>& host_if,
     const AudioConfiguration& audio_config,
@@ -742,9 +708,11 @@
   return filtered_setting;
 }
 
-std::optional<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+std::optional<std::pair<
+    std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
 LeAudioOffloadAudioProvider::matchWithRequirement(
-    std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>&
+    std::vector<std::pair<
+        std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>&
         matched_ase_configuration_settings,
     const IBluetoothAudioProvider::LeAudioConfigurationRequirement& requirement,
     bool isMatchContext, bool isExact, bool isMatchFlags) {
@@ -758,14 +726,15 @@
     if (!requirement.flags.has_value()) return std::nullopt;
     requirement_flags_bitmask = requirement.flags.value().bitmask;
   }
-  for (auto& setting : matched_ase_configuration_settings) {
+  for (auto& [setting_name, setting] : matched_ase_configuration_settings) {
     // Try to match context.
     if (isMatchContext) {
       if ((setting.audioContext.bitmask & requirement.audioContext.bitmask) !=
           requirement.audioContext.bitmask)
         continue;
-      LOG(DEBUG) << __func__ << ": Setting with matched context: "
-                 << getSettingOutputString(setting);
+      LOG(DEBUG) << __func__
+                 << ": Setting with matched context: name: " << setting_name
+                 << ", setting: " << setting.toString();
     }
 
     // Try to match configuration flags
@@ -774,19 +743,20 @@
       if ((setting.flags.value().bitmask & requirement_flags_bitmask) !=
           requirement_flags_bitmask)
         continue;
-      LOG(DEBUG) << __func__ << ": Setting with matched flags: "
-                 << getSettingOutputString(setting);
+      LOG(DEBUG) << __func__
+                 << ": Setting with matched flags: name: " << setting_name
+                 << ", setting: " << setting.toString();
     }
 
     auto filtered_ase_configuration_setting =
         getRequirementMatchedAseConfigurationSettings(setting, requirement,
                                                       isExact);
     if (filtered_ase_configuration_setting.has_value()) {
-      LOG(INFO) << __func__ << ": Result found: "
-                << getSettingOutputString(
-                       filtered_ase_configuration_setting.value());
+      LOG(INFO) << __func__ << ": Result found: name: " << setting_name
+                << ", setting: "
+                << filtered_ase_configuration_setting.value().toString();
       // Found a matched setting, ignore other settings
-      return filtered_ase_configuration_setting;
+      return {{setting_name, filtered_ase_configuration_setting.value()}};
     }
   }
   // If cannot satisfy this requirement, return nullopt
@@ -812,7 +782,8 @@
     std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>*
         _aidl_return) {
   // Get all configuration settings
-  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+  std::vector<std::pair<
+      std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
       ase_configuration_settings =
           BluetoothAudioCodecs::GetLeAudioAseConfigurationSettings();
 
@@ -822,15 +793,17 @@
   }
 
   // Matched ASE configuration with ignored audio context
-  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+  std::vector<std::pair<
+      std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
       sink_matched_ase_configuration_settings;
-  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+  std::vector<std::pair<
+      std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
       matched_ase_configuration_settings;
 
   // A setting must match both source and sink.
   // First filter all setting matched with sink capability
   if (in_remoteSinkAudioCapabilities.has_value()) {
-    for (auto& setting : ase_configuration_settings) {
+    for (auto& [setting_name, setting] : ase_configuration_settings) {
       for (auto& capability : in_remoteSinkAudioCapabilities.value()) {
         if (!capability.has_value()) continue;
         auto filtered_ase_configuration_setting =
@@ -838,7 +811,7 @@
                 setting, capability.value(), kLeAudioDirectionSink);
         if (filtered_ase_configuration_setting.has_value()) {
           sink_matched_ase_configuration_settings.push_back(
-              filtered_ase_configuration_setting.value());
+              {setting_name, filtered_ase_configuration_setting.value()});
         }
       }
     }
@@ -848,7 +821,8 @@
 
   // Combine filter every source capability
   if (in_remoteSourceAudioCapabilities.has_value()) {
-    for (auto& setting : sink_matched_ase_configuration_settings)
+    for (auto& [setting_name, setting] :
+         sink_matched_ase_configuration_settings)
       for (auto& capability : in_remoteSourceAudioCapabilities.value()) {
         if (!capability.has_value()) continue;
         auto filtered_ase_configuration_setting =
@@ -856,7 +830,7 @@
                 setting, capability.value(), kLeAudioDirectionSource);
         if (filtered_ase_configuration_setting.has_value()) {
           matched_ase_configuration_settings.push_back(
-              filtered_ase_configuration_setting.value());
+              {setting_name, filtered_ase_configuration_setting.value()});
         }
       }
   } else {
@@ -864,7 +838,11 @@
         sink_matched_ase_configuration_settings;
   }
 
-  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting> result;
+  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+      result_no_name;
+  std::vector<std::pair<
+      std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
+      result;
   for (auto& requirement : in_requirements) {
     // For each requirement, try to match with a setting.
     // If we cannot match, return an empty result.
@@ -896,18 +874,19 @@
     if (!found) {
       LOG(ERROR) << __func__
                  << ": Cannot find any match for this requirement, exitting...";
-      result.clear();
-      *_aidl_return = result;
+      *_aidl_return = result_no_name;
       return ndk::ScopedAStatus::ok();
     }
   }
 
   LOG(INFO) << __func__
             << ": Found matches for all requirements, chosen settings:";
-  for (auto& setting : result) {
-    LOG(INFO) << __func__ << ": " << getSettingOutputString(setting);
+  for (auto& [setting_name, setting] : result) {
+    LOG(INFO) << __func__ << ": name: " << setting_name
+              << ", setting: " << setting.toString();
+    result_no_name.push_back(setting);
   }
-  *_aidl_return = result;
+  *_aidl_return = result_no_name;
   return ndk::ScopedAStatus::ok();
 };
 
@@ -937,7 +916,8 @@
     uint8_t direction,
     const IBluetoothAudioProvider::LeAudioAseQosConfigurationRequirement&
         qosRequirement,
-    std::vector<LeAudioAseConfigurationSetting>& ase_configuration_settings,
+    std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>&
+        ase_configuration_settings,
     bool isExact, bool isMatchFlags) {
   auto requirement_flags_bitmask = 0;
   if (isMatchFlags) {
@@ -955,13 +935,14 @@
     direction_qos_requirement = qosRequirement.sourceAseQosRequirement.value();
   }
 
-  for (auto& setting : ase_configuration_settings) {
+  for (auto& [setting_name, setting] : ase_configuration_settings) {
     // Context matching
     if ((setting.audioContext.bitmask & qosRequirement.audioContext.bitmask) !=
         qosRequirement.audioContext.bitmask)
       continue;
-    LOG(DEBUG) << __func__ << ": Setting with matched context: "
-               << getSettingOutputString(setting);
+    LOG(DEBUG) << __func__
+               << ": Setting with matched context: name: " << setting_name
+               << ", setting: " << setting.toString();
 
     // Match configuration flags
     if (isMatchFlags) {
@@ -969,8 +950,9 @@
       if ((setting.flags.value().bitmask & requirement_flags_bitmask) !=
           requirement_flags_bitmask)
         continue;
-      LOG(DEBUG) << __func__ << ": Setting with matched flags: "
-                 << getSettingOutputString(setting);
+      LOG(DEBUG) << __func__
+                 << ": Setting with matched flags: name: " << setting_name
+                 << ", setting: " << setting.toString();
     }
 
     // Get a list of all matched AseDirectionConfiguration
@@ -1041,7 +1023,8 @@
   IBluetoothAudioProvider::LeAudioAseQosConfigurationPair result;
 
   // Get all configuration settings
-  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+  std::vector<std::pair<
+      std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
       ase_configuration_settings =
           BluetoothAudioCodecs::GetLeAudioAseConfigurationSettings();
 
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
index 8c4f543..6d402a4 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
@@ -163,15 +163,19 @@
       uint8_t direction,
       const IBluetoothAudioProvider::LeAudioAseQosConfigurationRequirement&
           qosRequirement,
-      std::vector<LeAudioAseConfigurationSetting>& ase_configuration_settings,
+      std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>&
+          ase_configuration_settings,
       bool isExact, bool isMatchedFlag);
   bool isSubgroupConfigurationMatchedContext(
       AudioContext requirement_context,
       IBluetoothAudioProvider::BroadcastQuality quality,
       LeAudioBroadcastSubgroupConfiguration configuration);
-  std::optional<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
+  std::optional<std::pair<
+      std::string, IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>
   matchWithRequirement(
-      std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>&
+      std::vector<
+          std::pair<std::string,
+                    IBluetoothAudioProvider::LeAudioAseConfigurationSetting>>&
           matched_ase_configuration_settings,
       const IBluetoothAudioProvider::LeAudioConfigurationRequirement&
           requirements,
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
index db2528e..89472e6 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
@@ -452,7 +452,7 @@
   return kDefaultOffloadHfpCodecInfo;
 }
 
-std::vector<LeAudioAseConfigurationSetting>
+std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>
 BluetoothAudioCodecs::GetLeAudioAseConfigurationSettings() {
   return AudioSetConfigurationProviderJson::
       GetLeAudioAseConfigurationSettings();
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h
index 0a1f708..c77de61 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h
@@ -54,7 +54,7 @@
   static std::vector<CodecInfo> GetLeAudioOffloadCodecInfo(
       const SessionType& session_type);
 
-  static std::vector<LeAudioAseConfigurationSetting>
+  static std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>
   GetLeAudioAseConfigurationSettings();
 
   static std::vector<CodecInfo> GetHfpOffloadCodecInfo();
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.cpp b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.cpp
index 3e18de2..feb4cda 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.cpp
@@ -65,7 +65,8 @@
                     ConfigurationFlags>>
     configurations_;
 
-std::vector<LeAudioAseConfigurationSetting> ase_configuration_settings_;
+std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>
+    ase_configuration_settings_;
 
 constexpr uint8_t kIsoDataPathHci = 0x00;
 constexpr uint8_t kIsoDataPathPlatformDefault = 0x01;
@@ -273,7 +274,7 @@
 
 /* Implementation */
 
-std::vector<LeAudioAseConfigurationSetting>
+std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>
 AudioSetConfigurationProviderJson::GetLeAudioAseConfigurationSettings() {
   AudioSetConfigurationProviderJson::LoadAudioSetConfigurationProviderJson();
   return ase_configuration_settings_;
@@ -392,9 +393,10 @@
 }
 
 void AudioSetConfigurationProviderJson::populateAseConfiguration(
-    const std::string& name, LeAudioAseConfiguration& ase,
+    LeAudioAseConfiguration& ase,
     const le_audio::AudioSetSubConfiguration* flat_subconfig,
-    const le_audio::QosConfiguration* qos_cfg) {
+    const le_audio::QosConfiguration* qos_cfg,
+    ConfigurationFlags& configurationFlags) {
   // Target latency
   switch (qos_cfg->target_latency()) {
     case le_audio::AudioSetConfigurationTargetLatency::
@@ -410,6 +412,7 @@
     case le_audio::AudioSetConfigurationTargetLatency::
         AudioSetConfigurationTargetLatency_LOW:
       ase.targetLatency = LeAudioAseConfiguration::TargetLatency::LOWER;
+      configurationFlags.bitmask |= ConfigurationFlags::LOW_LATENCY;
       break;
     default:
       ase.targetLatency = LeAudioAseConfiguration::TargetLatency::UNDEFINED;
@@ -429,12 +432,6 @@
   }
   // Codec configuration data
   populateConfigurationData(ase, flat_subconfig->codec_configuration());
-  // Populate the config name for easier debug
-  auto meta = std::vector<std::optional<MetadataLtv>>();
-  MetadataLtv::VendorSpecific cfg_name;
-  cfg_name.opaqueValue = std::vector<uint8_t>(name.begin(), name.end());
-  meta.push_back(cfg_name);
-  ase.metadata = meta;
 }
 
 void AudioSetConfigurationProviderJson::populateAseQosConfiguration(
@@ -505,9 +502,9 @@
 // Parse into AseDirectionConfiguration
 AseDirectionConfiguration
 AudioSetConfigurationProviderJson::SetConfigurationFromFlatSubconfig(
-    const std::string& name,
     const le_audio::AudioSetSubConfiguration* flat_subconfig,
-    const le_audio::QosConfiguration* qos_cfg, CodecLocation location) {
+    const le_audio::QosConfiguration* qos_cfg, CodecLocation location,
+    ConfigurationFlags& configurationFlags) {
   AseDirectionConfiguration direction_conf;
 
   LeAudioAseConfiguration ase;
@@ -515,7 +512,7 @@
   LeAudioDataPathConfiguration path;
 
   // Translate into LeAudioAseConfiguration
-  populateAseConfiguration(name, ase, flat_subconfig, qos_cfg);
+  populateAseConfiguration(ase, flat_subconfig, qos_cfg, configurationFlags);
 
   // Translate into LeAudioAseQosConfiguration
   populateAseQosConfiguration(qos, qos_cfg, ase,
@@ -549,15 +546,14 @@
 // Parse into AseDirectionConfiguration and the ConfigurationFlags
 // and put them in the given list.
 void AudioSetConfigurationProviderJson::processSubconfig(
-    const std::string& name,
     const le_audio::AudioSetSubConfiguration* subconfig,
     const le_audio::QosConfiguration* qos_cfg,
     std::vector<std::optional<AseDirectionConfiguration>>&
         directionAseConfiguration,
-    CodecLocation location) {
+    CodecLocation location, ConfigurationFlags& configurationFlags) {
   auto ase_cnt = subconfig->ase_cnt();
-  auto config =
-      SetConfigurationFromFlatSubconfig(name, subconfig, qos_cfg, location);
+  auto config = SetConfigurationFromFlatSubconfig(subconfig, qos_cfg, location,
+                                                  configurationFlags);
   directionAseConfiguration.push_back(config);
   // Put the same setting again.
   if (ase_cnt == 2) directionAseConfiguration.push_back(config);
@@ -642,11 +638,11 @@
     /* Load subconfigurations */
     for (auto subconfig : *codec_cfg->subconfigurations()) {
       if (subconfig->direction() == kLeAudioDirectionSink) {
-        processSubconfig(flat_cfg->name()->str(), subconfig, qos_sink_cfg,
-                         sinkAseConfiguration, location);
+        processSubconfig(subconfig, qos_sink_cfg, sinkAseConfiguration,
+                         location, configurationFlags);
       } else {
-        processSubconfig(flat_cfg->name()->str(), subconfig, qos_source_cfg,
-                         sourceAseConfiguration, location);
+        processSubconfig(subconfig, qos_source_cfg, sourceAseConfiguration,
+                         location, configurationFlags);
       }
     }
 
@@ -856,7 +852,7 @@
       setting.flags = flags;
       // Add to list of setting
       LOG(DEBUG) << "Pushing configuration to list: " << config_name;
-      ase_configuration_settings_.push_back(setting);
+      ase_configuration_settings_.push_back({config_name, setting});
     }
   }
 
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.h b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.h
index fac6152..f115d61 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioAseConfigurationSettingProvider.h
@@ -50,7 +50,7 @@
 
 class AudioSetConfigurationProviderJson {
  public:
-  static std::vector<LeAudioAseConfigurationSetting>
+  static std::vector<std::pair<std::string, LeAudioAseConfigurationSetting>>
   GetLeAudioAseConfigurationSettings();
 
  private:
@@ -73,9 +73,10 @@
           flat_codec_specific_params);
 
   static void populateAseConfiguration(
-      const std::string& name, LeAudioAseConfiguration& ase,
+      LeAudioAseConfiguration& ase,
       const le_audio::AudioSetSubConfiguration* flat_subconfig,
-      const le_audio::QosConfiguration* qos_cfg);
+      const le_audio::QosConfiguration* qos_cfg,
+      ConfigurationFlags& configurationFlags);
 
   static void populateAseQosConfiguration(
       LeAudioAseQosConfiguration& qos,
@@ -83,17 +84,16 @@
       uint8_t ase_channel_cnt);
 
   static AseDirectionConfiguration SetConfigurationFromFlatSubconfig(
-      const std::string& name,
       const le_audio::AudioSetSubConfiguration* flat_subconfig,
-      const le_audio::QosConfiguration* qos_cfg, CodecLocation location);
+      const le_audio::QosConfiguration* qos_cfg, CodecLocation location,
+      ConfigurationFlags& configurationFlags);
 
   static void processSubconfig(
-      const std::string& name,
       const le_audio::AudioSetSubConfiguration* subconfig,
       const le_audio::QosConfiguration* qos_cfg,
       std::vector<std::optional<AseDirectionConfiguration>>&
           directionAseConfiguration,
-      CodecLocation location);
+      CodecLocation location, ConfigurationFlags& configurationFlags);
 
   static void PopulateAseConfigurationFromFlat(
       const le_audio::AudioSetConfiguration* flat_cfg,
diff --git a/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp b/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp
index e2a8693..4aba874 100644
--- a/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp
+++ b/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp
@@ -58,7 +58,8 @@
 
 ndk::ScopedAStatus BluetoothChannelSounding::getSupportedCsSecurityLevels(
     std::vector<CsSecurityLevel>* _aidl_return) {
-  std::vector<CsSecurityLevel> supported_security_levels = {};
+  std::vector<CsSecurityLevel> supported_security_levels = {
+      CsSecurityLevel::NOT_SUPPORTED};
   *_aidl_return = supported_security_levels;
   return ::ndk::ScopedAStatus::ok();
 }
diff --git a/nfc/OWNERS b/nfc/OWNERS
index f46dccd..47f209f 100644
--- a/nfc/OWNERS
+++ b/nfc/OWNERS
@@ -1,2 +1,2 @@
 # Bug component: 48448
-include platform/packages/apps/Nfc:/OWNERS
\ No newline at end of file
+include platform/packages/modules/Nfc:/OWNERS
\ No newline at end of file
diff --git a/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp b/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp
index 6db7e14..9c44c3a 100644
--- a/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp
+++ b/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp
@@ -349,44 +349,18 @@
 }
 
 /*
- * SetPassiveObserverTech_individualTechnologies:
- * Verifies per-technology observe mode is supported as a capability. Then sets observe mode
- * for each individual technology and verifies the command succeeds.
- *
- * @VsrTest = GMS-VSR-3.2.8-002
+ * SetPassiveObserverTech_getCaps:
+ * Verifies GET_CAPS returns get correct value for observe mode capabilities.
  */
-TEST_P(NfcBehaviorChanges, SetPassiveObserverTech_individualTechnologies) {
+TEST_P(NfcBehaviorChanges, SetPassiveObserverTech_getCaps) {
     if (get_vsr_api_level() < 202504) {
         GTEST_SKIP() << "Skipping test for board API level < 202504";
     }
 
     tNFC_STATUS status = nfaGetCaps();
+
     ASSERT_EQ(status, NFC_STATUS_OK);
     ASSERT_EQ(getCapsPassiveObserverModeValue(), 0x2);
-
-    status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A);
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    status = nfaQueryObserveModeState();
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A);
-
-    status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B);
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    status = nfaQueryObserveModeState();
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B);
-
-    status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V);
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    status = nfaQueryObserveModeState();
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V);
-
-    status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F);
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    status = nfaQueryObserveModeState();
-    ASSERT_EQ(status, NFA_STATUS_OK);
-    ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F);
 }
 
 /*
diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
index fc703e9..1908d05 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
@@ -479,8 +479,8 @@
      *        structure.
      *
      * @param unwrappingParams must contain any parameters needed to perform the unwrapping
-     *        operation.  For example, if the wrapping key is an AES key the block and padding modes
-     *        must be specified in this argument.
+     *        operation.  For example, the padding mode for the RSA wrapping key must be specified
+     *        in this argument.
      *
      * @param passwordSid specifies the password secure ID (SID) of the user that owns the key being
      *        installed.  If the authorization list in wrappedKeyData contains a
diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp
index 0197141..0d03651 100644
--- a/security/keymint/aidl/default/Android.bp
+++ b/security/keymint/aidl/default/Android.bp
@@ -192,7 +192,6 @@
     ],
     prebuilts: [
         "keymint_aidl_nonsecure_init_rc",
-        "keymint_aidl_nonsecure_vintf",
         "android.hardware.hardware_keystore.xml", // permissions
     ],
 }
@@ -210,14 +209,3 @@
     out: ["android.hardware.security.keymint-service.nonsecure.apex.rc"],
     cmd: "sed -E 's%/vendor/bin/%/apex/com.android.hardware.keymint/bin/%' $(in) > $(out)",
 }
-
-prebuilt_etc {
-    name: "keymint_aidl_nonsecure_vintf",
-    sub_dir: "vintf",
-    vendor: true,
-    srcs: [
-        "android.hardware.security.keymint-service.xml",
-        "android.hardware.security.sharedsecret-service.xml",
-        "android.hardware.security.secureclock-service.xml",
-    ],
-}
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 65e93c6..0696ada 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -405,7 +405,7 @@
  * is non-normal.
  */
 TEST(NonParameterizedTests, unlockedBootloaderStatesImpliesNonNormalKeyMintInAVmDiceChain) {
-    if (::android::base::GetBoolProperty("trusty.security_vm.keymint.enabled", false)) {
+    if (!::android::base::GetBoolProperty("trusty.security_vm.keymint.enabled", false)) {
         GTEST_SKIP() << "The KeyMint (" << DEFAULT_INSTANCE_NAME
                      << ") instance is not inside a VM.";
     }
diff --git a/security/secretkeeper/aidl/vts/Android.bp b/security/secretkeeper/aidl/vts/Android.bp
index c84afae..4353ca5 100644
--- a/security/secretkeeper/aidl/vts/Android.bp
+++ b/security/secretkeeper/aidl/vts/Android.bp
@@ -27,6 +27,7 @@
         "libciborium",
         "libcoset",
         "libdiced_open_dice",
+        "libexplicitkeydice",
         "libhex",
         "liblog_rust",
         "libsecretkeeper_client",
@@ -54,6 +55,7 @@
         "libciborium",
         "libcoset",
         "libdice_policy_builder",
+        "libexplicitkeydice",
         "liblog_rust",
         "libsecretkeeper_client",
         "libsecretkeeper_comm_nostd",
@@ -77,6 +79,7 @@
         "libclap",
         "libcoset",
         "libdice_policy_builder",
+        "libexplicitkeydice",
         "libhex",
         "liblog_rust",
         "libsecretkeeper_client",
diff --git a/security/secretkeeper/aidl/vts/dice_sample.rs b/security/secretkeeper/aidl/vts/dice_sample.rs
index d6379e5..f504445 100644
--- a/security/secretkeeper/aidl/vts/dice_sample.rs
+++ b/security/secretkeeper/aidl/vts/dice_sample.rs
@@ -34,8 +34,8 @@
     retry_bcc_main_flow, retry_dice_main_flow, Config, DiceArtifacts, DiceConfigValues, DiceError,
     DiceMode, InputValues, OwnedDiceArtifacts, HASH_SIZE, HIDDEN_SIZE,
 };
+use explicitkeydice::OwnedDiceArtifactsWithExplicitKey;
 use log::error;
-use secretkeeper_client::dice::OwnedDiceArtifactsWithExplicitKey;
 
 /// Sample UDS used to perform the root DICE flow by `make_sample_bcc_and_cdis`.
 const UDS: &[u8; CDI_SIZE] = &[
diff --git a/security/secretkeeper/aidl/vts/secretkeeper_cli.rs b/security/secretkeeper/aidl/vts/secretkeeper_cli.rs
index 9fbfb45..6a743a8 100644
--- a/security/secretkeeper/aidl/vts/secretkeeper_cli.rs
+++ b/security/secretkeeper/aidl/vts/secretkeeper_cli.rs
@@ -29,7 +29,8 @@
     WILDCARD_FULL_ARRAY,
 };
 
-use secretkeeper_client::{dice::OwnedDiceArtifactsWithExplicitKey, SkSession};
+use explicitkeydice::OwnedDiceArtifactsWithExplicitKey;
+use secretkeeper_client::SkSession;
 use secretkeeper_comm::data_types::{
     error::SecretkeeperError,
     packet::{ResponsePacket, ResponseType},
diff --git a/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs b/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs
index b944865..453ff8f 100644
--- a/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs
+++ b/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs
@@ -22,8 +22,8 @@
 use authgraph_core::key;
 use coset::{CborOrdering, CborSerializable, CoseEncrypt0, CoseKey};
 use dice_policy_builder::{TargetEntry, ConstraintSpec, ConstraintType, MissingAction, WILDCARD_FULL_ARRAY, policy_for_dice_chain};
+use explicitkeydice::OwnedDiceArtifactsWithExplicitKey;
 use rdroidtest::{ignore_if, rdroidtest};
-use secretkeeper_client::dice::OwnedDiceArtifactsWithExplicitKey;
 use secretkeeper_client::{SkSession, Error as SkClientError};
 use secretkeeper_core::cipher;
 use secretkeeper_comm::data_types::error::SecretkeeperError;
diff --git a/security/see/authmgr/aidl/README.md b/security/see/authmgr/aidl/README.md
new file mode 100644
index 0000000..97b2b1d
--- /dev/null
+++ b/security/see/authmgr/aidl/README.md
@@ -0,0 +1,21 @@
+# AuthMgr
+
+The AuthMgr protocol authenticates and authorizes clients before they can
+access trusted HALs, AIDL-defined services in trusted execution environments.
+Version 1 was designed to allow applications running in a protected virtual
+machine (pVM) to access services running in a TEE in ARM TrustZone. An
+implementation of `IAuthMgrAuthorization` is referred to as an AuthMgr Backend.
+An implementation of a client of the AuthMgr Backend is referred to as an
+AuthMgr Frontend.
+
+
+## Additional Requirements by Android Version
+
+The comments on `IAuthMgrAuthorization` describe the requirements for implementing
+an AuthMgr Backend (implementor of the interface) itself. There are some additional
+requirements that are specific to Android release versions.
+
+### Android 16
+If implementing `IAuthMgrAuthorization` in Android 16 only one AuthMgr Backend is
+supported and dynamic service discovery is not supported. The AuthMgr Backend
+service must be exposed on secure partition ID 0x8001 over VSOCK port 1.
\ No newline at end of file
diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
index 7f33e2d..687b5ed 100644
--- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
+++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
@@ -38,6 +38,7 @@
 #include <android/binder_manager.h>
 #include <android/binder_process.h>
 #include <android/binder_status.h>
+#include <cutils/properties.h>
 #include <gtest/gtest.h>
 
 #include <unistd.h>
@@ -175,6 +176,34 @@
             ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
         }
     }
+
+    bool isEmulator() {
+        if (property_get_bool("ro.boot.qemu", false)) {
+            return true;
+        }
+        char device[PROP_VALUE_MAX];
+        char model[PROP_VALUE_MAX];
+        char name[PROP_VALUE_MAX];
+        char hardware[PROP_VALUE_MAX];
+
+        property_get("ro.product.device", device, "");
+        property_get("ro.product.model", model, "");
+        property_get("ro.product.name", name, "");
+        property_get("ro.hardware", hardware, "");
+
+        std::string deviceStr(device);
+        std::string modelStr(model);
+        std::string nameStr(name);
+        std::string hardwareStr(hardware);
+
+        return deviceStr.rfind("vsoc_", 0) == 0 || modelStr.rfind("Cuttlefish ", 0) == 0 ||
+               nameStr.rfind("cf_", 0) == 0 || nameStr.rfind("aosp_cf_", 0) == 0 ||
+               hardwareStr.find("goldfish") != std::string::npos ||
+               hardwareStr.find("ranchu") != std::string::npos ||
+               hardwareStr.find("cutf_cvm") != std::string::npos ||
+               hardwareStr.find("starfish") != std::string::npos;
+    }
+
     // Stores thermal version
     int32_t thermal_version;
 
@@ -355,6 +384,9 @@
     if (apiLevel < 202404) {
         GTEST_SKIP() << "Skipping test as the vendor level is below 202404: " << apiLevel;
     }
+    if (isEmulator()) {
+        GTEST_SKIP() << "Skipping test on emulator";
+    }
     for (const auto& feature : kNonHandheldFeatures) {
         if (::testing::deviceSupportsFeature(feature.c_str())) {
             GTEST_SKIP() << "Skipping test as the device has feature: " << feature;
diff --git a/wifi/apex/Android.bp b/wifi/apex/Android.bp
index f8c8e6f..5052ebb 100644
--- a/wifi/apex/Android.bp
+++ b/wifi/apex/Android.bp
@@ -15,13 +15,6 @@
     installable: false,
 }
 
-prebuilt_etc {
-    name: "com.android.hardware.wifi.xml",
-    src: ":default-android.hardware.wifi-service.xml",
-    installable: false,
-    sub_dir: "vintf",
-}
-
 apex {
     name: "com.android.hardware.wifi",
     manifest: "apex_manifest.json",
@@ -36,7 +29,6 @@
     ],
     prebuilts: [
         "com.android.hardware.wifi.rc",
-        "com.android.hardware.wifi.xml",
     ],
     overrides: [
         "android.hardware.wifi-service",