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/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/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) {
