diff --git a/audio/aidl/default/bluetooth/StreamBluetooth.cpp b/audio/aidl/default/bluetooth/StreamBluetooth.cpp
index f22b7a9..efab470 100644
--- a/audio/aidl/default/bluetooth/StreamBluetooth.cpp
+++ b/audio/aidl/default/bluetooth/StreamBluetooth.cpp
@@ -93,17 +93,18 @@
 ::android::status_t StreamBluetooth::transfer(void* buffer, size_t frameCount,
                                               size_t* actualFrameCount, int32_t* latencyMs) {
     std::lock_guard guard(mLock);
+    *actualFrameCount = 0;
+    *latencyMs = StreamDescriptor::LATENCY_UNKNOWN;
     if (mBtDeviceProxy == nullptr || mBtDeviceProxy->getState() == BluetoothStreamState::DISABLED) {
-        *actualFrameCount = 0;
-        *latencyMs = StreamDescriptor::LATENCY_UNKNOWN;
+        // The BT session is turned down, silently ignore write.
         return ::android::OK;
     }
-    *actualFrameCount = 0;
-    *latencyMs = 0;
     if (!mBtDeviceProxy->start()) {
-        LOG(ERROR) << __func__ << ": state= " << mBtDeviceProxy->getState() << " failed to start";
-        return -EIO;
+        LOG(WARNING) << __func__ << ": state= " << mBtDeviceProxy->getState()
+                     << " failed to start, will retry";
+        return ::android::OK;
     }
+    *latencyMs = 0;
     const size_t bytesToTransfer = frameCount * mFrameSizeBytes;
     const size_t bytesTransferred = mIsInput ? mBtDeviceProxy->readData(buffer, bytesToTransfer)
                                              : mBtDeviceProxy->writeData(buffer, bytesToTransfer);
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index 3ed9ed2..12b1797 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -453,12 +453,11 @@
     ENGINE_TEST_INSTANCE_NAME,
     ENGINE_TEST_RESOLUTION_PREFERENCE,
     ENGINE_TEST_PREFERRED_DURATION,
-    ENGINE_TEST_STAGE_ENABLEMENT,
-    ENGINE_TEST_LIMITER_IN_USE
+    ENGINE_TEST_STAGE_ENABLEMENT
 };
 using EngineArchitectureTestParams = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>,
                                                 DynamicsProcessing::ResolutionPreference, float,
-                                                DynamicsProcessing::StageEnablement, bool>;
+                                                DynamicsProcessing::StageEnablement>;
 
 void fillEngineArchConfig(DynamicsProcessing::EngineArchitecture& cfg,
                           const EngineArchitectureTestParams& params) {
@@ -466,7 +465,7 @@
     cfg.preferredProcessingDurationMs = std::get<ENGINE_TEST_PREFERRED_DURATION>(params);
     cfg.preEqStage = cfg.postEqStage = cfg.mbcStage =
             std::get<ENGINE_TEST_STAGE_ENABLEMENT>(params);
-    cfg.limiterInUse = std::get<ENGINE_TEST_LIMITER_IN_USE>(params);
+    cfg.limiterInUse = true;
 }
 
 class DynamicsProcessingTestEngineArchitecture
@@ -501,8 +500,8 @@
                         static_cast<DynamicsProcessing::ResolutionPreference>(-1)),  // variant
                 testing::Values(-10.f, 0.f, 10.f),  // processing duration
                 testing::ValuesIn(
-                        DynamicsProcessingTestHelper::kStageEnablementTestSet),  // preEQ/postEQ/mbc
-                testing::Bool()),                                                // limiter enable
+                        DynamicsProcessingTestHelper::kStageEnablementTestSet)  // preEQ/postEQ/mbc
+                ),
         [](const auto& info) {
             auto descriptor = std::get<ENGINE_TEST_INSTANCE_NAME>(info.param).second;
             DynamicsProcessing::EngineArchitecture cfg;
@@ -568,7 +567,6 @@
     LIMITER_CHANNEL,
     LIMITER_ENABLE,
     LIMITER_LINK_GROUP,
-    LIMITER_ENGINE_IN_USE,
     LIMITER_ADDITIONAL,
 };
 enum LimiterConfigTestAdditionalParam {
@@ -587,9 +585,8 @@
          {1, -60, 2.5, -2, 3.14},
          {1, 60, 2.5, -2, 3.14}}};
 
-using LimiterConfigTestParams =
-        std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t, bool, int32_t, bool,
-                   LimiterConfigTestAdditional>;
+using LimiterConfigTestParams = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>,
+                                           int32_t, bool, int32_t, LimiterConfigTestAdditional>;
 
 void fillLimiterConfig(DynamicsProcessing::LimiterConfig& cfg,
                        const LimiterConfigTestParams& params) {
@@ -609,8 +606,7 @@
       public DynamicsProcessingTestHelper {
   public:
     DynamicsProcessingTestLimiterConfig()
-        : DynamicsProcessingTestHelper(std::get<LIMITER_INSTANCE_NAME>(GetParam())),
-          mLimiterInUseEngine(std::get<LIMITER_ENGINE_IN_USE>(GetParam())) {
+        : DynamicsProcessingTestHelper(std::get<LIMITER_INSTANCE_NAME>(GetParam())) {
         fillLimiterConfig(mCfg, GetParam());
     }
 
@@ -619,11 +615,9 @@
     void TearDown() override { TearDownDynamicsProcessingEffect(); }
 
     DynamicsProcessing::LimiterConfig mCfg;
-    bool mLimiterInUseEngine;
 };
 
 TEST_P(DynamicsProcessingTestLimiterConfig, SetAndGetLimiterConfig) {
-    mEngineConfigPreset.limiterInUse = mLimiterInUseEngine;
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     EXPECT_NO_FATAL_FAILURE(addLimiterConfig({mCfg}));
     SetAndGetDynamicsProcessingParameters();
@@ -633,21 +627,18 @@
         DynamicsProcessingTest, DynamicsProcessingTestLimiterConfig,
         ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
                                    IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
-                           testing::Values(-1, 0, 1, 2),  // channel count
-                           testing::Bool(),               // enable
-                           testing::Values(3),            // link group
-                           testing::Bool(),               // engine limiter enable
+                           testing::Values(-1, 0, 1, 2),                           // channel count
+                           testing::Bool(),                                        // enable
+                           testing::Values(3),                                     // link group
                            testing::ValuesIn(kLimiterConfigTestAdditionalParam)),  // Additional
         [](const auto& info) {
             auto descriptor = std::get<LIMITER_INSTANCE_NAME>(info.param).second;
             DynamicsProcessing::LimiterConfig cfg;
             fillLimiterConfig(cfg, info.param);
-            std::string engineLimiterInUse =
-                    std::to_string(std::get<LIMITER_ENGINE_IN_USE>(info.param));
             std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                                descriptor.common.name + "_UUID_" +
                                toString(descriptor.common.id.uuid) + "_limiterConfig_" +
-                               cfg.toString() + "_engineSetting_" + engineLimiterInUse;
+                               cfg.toString();
             std::replace_if(
                     name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
             return name;
@@ -659,11 +650,10 @@
  */
 enum ChannelConfigTestParamName {
     BAND_CHANNEL_TEST_INSTANCE_NAME,
-    BAND_CHANNEL_TEST_CHANNEL_CONFIG,
-    BAND_CHANNEL_TEST_ENGINE_IN_USE
+    BAND_CHANNEL_TEST_CHANNEL_CONFIG
 };
 using ChannelConfigTestParams = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>,
-                                           std::vector<DynamicsProcessing::ChannelConfig>, bool>;
+                                           std::vector<DynamicsProcessing::ChannelConfig>>;
 
 class DynamicsProcessingTestChannelConfig
     : public ::testing::TestWithParam<ChannelConfigTestParams>,
@@ -671,33 +661,28 @@
   public:
     DynamicsProcessingTestChannelConfig()
         : DynamicsProcessingTestHelper(std::get<BAND_CHANNEL_TEST_INSTANCE_NAME>(GetParam())),
-          mCfg(std::get<BAND_CHANNEL_TEST_CHANNEL_CONFIG>(GetParam())),
-          mInUseEngine(std::get<BAND_CHANNEL_TEST_ENGINE_IN_USE>(GetParam())) {}
+          mCfg(std::get<BAND_CHANNEL_TEST_CHANNEL_CONFIG>(GetParam())) {}
 
     void SetUp() override { SetUpDynamicsProcessingEffect(); }
 
     void TearDown() override { TearDownDynamicsProcessingEffect(); }
 
     std::vector<DynamicsProcessing::ChannelConfig> mCfg;
-    const bool mInUseEngine;
 };
 
 TEST_P(DynamicsProcessingTestChannelConfig, SetAndGetPreEqChannelConfig) {
-    mEngineConfigPreset.preEqStage.inUse = mInUseEngine;
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     EXPECT_NO_FATAL_FAILURE(addPreEqChannelConfig(mCfg));
     SetAndGetDynamicsProcessingParameters();
 }
 
 TEST_P(DynamicsProcessingTestChannelConfig, SetAndGetPostEqChannelConfig) {
-    mEngineConfigPreset.postEqStage.inUse = mInUseEngine;
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     EXPECT_NO_FATAL_FAILURE(addPostEqChannelConfig(mCfg));
     SetAndGetDynamicsProcessingParameters();
 }
 
 TEST_P(DynamicsProcessingTestChannelConfig, SetAndGetMbcChannelConfig) {
-    mEngineConfigPreset.mbcStage.inUse = mInUseEngine;
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     EXPECT_NO_FATAL_FAILURE(addMbcChannelConfig(mCfg));
     SetAndGetDynamicsProcessingParameters();
@@ -709,19 +694,15 @@
                 testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
                         IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
                 testing::ValuesIn(
-                        DynamicsProcessingTestHelper::kChannelConfigTestSet),  // channel config
-                testing::Bool()),                                              // Engine inUse
+                        DynamicsProcessingTestHelper::kChannelConfigTestSet)),  // channel config
         [](const auto& info) {
             auto descriptor = std::get<BAND_CHANNEL_TEST_INSTANCE_NAME>(info.param).second;
-            std::string engineInUse =
-                    std::to_string(std::get<BAND_CHANNEL_TEST_ENGINE_IN_USE>(info.param));
             std::string channelConfig = ::android::internal::ToString(
                     std::get<BAND_CHANNEL_TEST_CHANNEL_CONFIG>(info.param));
 
             std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                                descriptor.common.name + "_UUID_" +
-                               toString(descriptor.common.id.uuid) + "_" + channelConfig +
-                               "_engineInUse_" + engineInUse;
+                               toString(descriptor.common.id.uuid) + "_" + channelConfig;
             std::replace_if(
                     name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
             return name;
@@ -736,11 +717,10 @@
     EQ_BAND_CHANNEL,
     EQ_BAND_ENABLE,
     EQ_BAND_CUT_OFF_FREQ,
-    EQ_BAND_GAIN,
-    EQ_BAND_STAGE_IN_USE
+    EQ_BAND_GAIN
 };
 using EqBandConfigTestParams = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t,
-                                          bool, std::vector<std::pair<int, float>>, float, bool>;
+                                          bool, std::vector<std::pair<int, float>>, float>;
 
 void fillEqBandConfig(std::vector<DynamicsProcessing::EqBandConfig>& cfgs,
                       const EqBandConfigTestParams& params) {
@@ -760,8 +740,7 @@
                                            public DynamicsProcessingTestHelper {
   public:
     DynamicsProcessingTestEqBandConfig()
-        : DynamicsProcessingTestHelper(std::get<EQ_BAND_INSTANCE_NAME>(GetParam())),
-          mStageInUse(std::get<EQ_BAND_STAGE_IN_USE>(GetParam())) {
+        : DynamicsProcessingTestHelper(std::get<EQ_BAND_INSTANCE_NAME>(GetParam())) {
         fillEqBandConfig(mCfgs, GetParam());
     }
 
@@ -770,11 +749,9 @@
     void TearDown() override { TearDownDynamicsProcessingEffect(); }
 
     std::vector<DynamicsProcessing::EqBandConfig> mCfgs;
-    const bool mStageInUse;
 };
 
 TEST_P(DynamicsProcessingTestEqBandConfig, SetAndGetPreEqBandConfig) {
-    mEngineConfigPreset.preEqStage.inUse = mStageInUse;
     mEngineConfigPreset.preEqStage.bandCount = mCfgs.size();
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     std::vector<DynamicsProcessing::ChannelConfig> cfgs(mChannelCount);
@@ -788,7 +765,6 @@
 }
 
 TEST_P(DynamicsProcessingTestEqBandConfig, SetAndGetPostEqBandConfig) {
-    mEngineConfigPreset.postEqStage.inUse = mStageInUse;
     mEngineConfigPreset.postEqStage.bandCount = mCfgs.size();
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     std::vector<DynamicsProcessing::ChannelConfig> cfgs(mChannelCount);
@@ -849,21 +825,19 @@
         DynamicsProcessingTest, DynamicsProcessingTestEqBandConfig,
         ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
                                    IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
-                           testing::Values(-1, 0, 10),      // channel ID
-                           testing::Bool(),                 // band enable
-                           testing::ValuesIn(kBands),       // cut off frequencies
-                           testing::Values(-3.14f, 3.14f),  // gain
-                           testing::Values(true)),          // stage in use
+                           testing::Values(-1, 0, 10),     // channel ID
+                           testing::Bool(),                // band enable
+                           testing::ValuesIn(kBands),      // cut off frequencies
+                           testing::Values(-3.14f, 3.14f)  // gain
+                           ),
         [](const auto& info) {
             auto descriptor = std::get<EQ_BAND_INSTANCE_NAME>(info.param).second;
             std::vector<DynamicsProcessing::EqBandConfig> cfgs;
             fillEqBandConfig(cfgs, info.param);
             std::string bands = ::android::internal::ToString(cfgs);
-            std::string stageInUse = std::to_string(std::get<EQ_BAND_STAGE_IN_USE>(info.param));
             std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                                descriptor.common.name + "_UUID_" +
-                               toString(descriptor.common.id.uuid) + "_bands_" + bands +
-                               "_stageInUse_" + stageInUse;
+                               toString(descriptor.common.id.uuid) + "_bands_" + bands;
             std::replace_if(
                     name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
             return name;
@@ -879,7 +853,6 @@
     MBC_BAND_CHANNEL,
     MBC_BAND_ENABLE,
     MBC_BAND_CUTOFF_FREQ,
-    MBC_BAND_STAGE_IN_USE,
     MBC_BAND_ADDITIONAL
 };
 enum MbcBandConfigAdditional {
@@ -905,7 +878,7 @@
 
 using TestParamsMbcBandConfig =
         std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t, bool,
-                   std::vector<std::pair<int, float>>, bool, TestParamsMbcBandConfigAdditional>;
+                   std::vector<std::pair<int, float>>, TestParamsMbcBandConfigAdditional>;
 
 void fillMbcBandConfig(std::vector<DynamicsProcessing::MbcBandConfig>& cfgs,
                        const TestParamsMbcBandConfig& params) {
@@ -936,8 +909,7 @@
       public DynamicsProcessingTestHelper {
   public:
     DynamicsProcessingTestMbcBandConfig()
-        : DynamicsProcessingTestHelper(std::get<MBC_BAND_INSTANCE_NAME>(GetParam())),
-          mStageInUse(std::get<MBC_BAND_STAGE_IN_USE>(GetParam())) {
+        : DynamicsProcessingTestHelper(std::get<MBC_BAND_INSTANCE_NAME>(GetParam())) {
         fillMbcBandConfig(mCfgs, GetParam());
     }
 
@@ -946,11 +918,9 @@
     void TearDown() override { TearDownDynamicsProcessingEffect(); }
 
     std::vector<DynamicsProcessing::MbcBandConfig> mCfgs;
-    const bool mStageInUse;
 };
 
 TEST_P(DynamicsProcessingTestMbcBandConfig, SetAndGetMbcBandConfig) {
-    mEngineConfigPreset.mbcStage.inUse = mStageInUse;
     mEngineConfigPreset.mbcStage.bandCount = mCfgs.size();
     EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset));
     std::vector<DynamicsProcessing::ChannelConfig> cfgs(mChannelCount);
@@ -970,18 +940,15 @@
                            testing::Values(-1, 0, 10),  // channel count
                            testing::Bool(),             // enable
                            testing::ValuesIn(kBands),   // cut off frequencies
-                           testing::Bool(),             // stage in use
                            testing::ValuesIn(kMbcBandConfigAdditionalParam)),  // Additional
         [](const auto& info) {
             auto descriptor = std::get<MBC_BAND_INSTANCE_NAME>(info.param).second;
             std::vector<DynamicsProcessing::MbcBandConfig> cfgs;
             fillMbcBandConfig(cfgs, info.param);
             std::string mbcBands = ::android::internal::ToString(cfgs);
-            std::string stageInUse = std::to_string(std::get<MBC_BAND_STAGE_IN_USE>(info.param));
             std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                                descriptor.common.name + "_UUID_" +
-                               toString(descriptor.common.id.uuid) + "_bands_" + mbcBands +
-                               "_stageInUse_" + stageInUse;
+                               toString(descriptor.common.id.uuid) + "_bands_" + mbcBands;
             std::replace_if(
                     name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
             return name;
