Merge changes Iadea6b4d,I5ba4d5eb into main

* changes:
  Generate Java/Cpp files for VehicleProperty annotations.
  Add annotations checks for VehicleProperty.aidl.
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index 09b6621..1e6f186 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -506,6 +506,27 @@
     limiterConfigList.push_back(cfg);
 }
 
+DynamicsProcessing::MbcBandConfig createMbcBandConfig(int channel, int band, float cutoffFreqHz,
+                                                      float attackTimeMs, float releaseTimeMs,
+                                                      float ratio, float thresholdDb,
+                                                      float kneeWidthDb, float noiseGate,
+                                                      float expanderRatio, float preGainDb,
+                                                      float postGainDb) {
+    return DynamicsProcessing::MbcBandConfig{.channel = channel,
+                                             .band = band,
+                                             .enable = true,
+                                             .cutoffFrequencyHz = cutoffFreqHz,
+                                             .attackTimeMs = attackTimeMs,
+                                             .releaseTimeMs = releaseTimeMs,
+                                             .ratio = ratio,
+                                             .thresholdDb = thresholdDb,
+                                             .kneeWidthDb = kneeWidthDb,
+                                             .noiseGateThresholdDb = noiseGate,
+                                             .expanderRatio = expanderRatio,
+                                             .preGainDb = preGainDb,
+                                             .postGainDb = postGainDb};
+}
+
 /**
  * Test DynamicsProcessing Engine Configuration
  */
@@ -818,7 +839,7 @@
             fillLimiterConfig(mLimiterConfigList, i, true, kDefaultLinkerGroup, kDefaultAttackTime,
                               kDefaultReleaseTime, kDefaultRatio, threshold, kDefaultPostGain);
         }
-        EXPECT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
+        ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
         if (!isAllParamsValid()) {
             continue;
         }
@@ -827,7 +848,7 @@
             EXPECT_NEAR(mInputDb, outputDb, kToleranceDb);
         } else {
             float calculatedThreshold = 0;
-            EXPECT_NO_FATAL_FAILURE(computeThreshold(kDefaultRatio, outputDb, calculatedThreshold));
+            ASSERT_NO_FATAL_FAILURE(computeThreshold(kDefaultRatio, outputDb, calculatedThreshold));
             ASSERT_GT(calculatedThreshold, previousThreshold);
             previousThreshold = calculatedThreshold;
         }
@@ -844,7 +865,7 @@
             fillLimiterConfig(mLimiterConfigList, i, true, kDefaultLinkerGroup, kDefaultAttackTime,
                               kDefaultReleaseTime, ratio, kDefaultThreshold, kDefaultPostGain);
         }
-        EXPECT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
+        ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
         if (!isAllParamsValid()) {
             continue;
         }
@@ -854,7 +875,7 @@
             EXPECT_NEAR(mInputDb, outputDb, kToleranceDb);
         } else {
             float calculatedRatio = 0;
-            EXPECT_NO_FATAL_FAILURE(computeRatio(kDefaultThreshold, outputDb, calculatedRatio));
+            ASSERT_NO_FATAL_FAILURE(computeRatio(kDefaultThreshold, outputDb, calculatedRatio));
             ASSERT_GT(calculatedRatio, previousRatio);
             previousRatio = calculatedRatio;
         }
@@ -870,7 +891,7 @@
             fillLimiterConfig(mLimiterConfigList, i, true, kDefaultLinkerGroup, kDefaultAttackTime,
                               kDefaultReleaseTime, kDefaultRatio, -1, postGainDb);
         }
-        EXPECT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
+        ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
         if (!isAllParamsValid()) {
             continue;
         }
@@ -891,7 +912,7 @@
                               5 /*attack time*/, 5 /*release time*/, 10 /*ratio*/,
                               -10 /*threshold*/, 5 /*postgain*/);
         }
-        EXPECT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
+        ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
         if (!isAllParamsValid()) {
             continue;
         }
@@ -1150,25 +1171,21 @@
 
 void fillMbcBandConfig(std::vector<DynamicsProcessing::MbcBandConfig>& cfgs,
                        const TestParamsMbcBandConfig& params) {
-    const std::vector<std::pair<int, float>> cutOffFreqs = std::get<MBC_BAND_CUTOFF_FREQ>(params);
-    const std::array<float, MBC_ADD_MAX_NUM> additional = std::get<MBC_BAND_ADDITIONAL>(params);
-    int bandCount = cutOffFreqs.size();
-    cfgs.resize(bandCount);
-    for (int i = 0; i < bandCount; i++) {
-        cfgs[i] = DynamicsProcessing::MbcBandConfig{
-                .channel = std::get<MBC_BAND_CHANNEL>(params),
-                .band = cutOffFreqs[i].first,
-                .enable = true /*Mbc Band Enable*/,
-                .cutoffFrequencyHz = cutOffFreqs[i].second,
-                .attackTimeMs = additional[MBC_ADD_ATTACK_TIME],
-                .releaseTimeMs = additional[MBC_ADD_RELEASE_TIME],
-                .ratio = additional[MBC_ADD_RATIO],
-                .thresholdDb = additional[MBC_ADD_THRESHOLD],
-                .kneeWidthDb = additional[MBC_ADD_KNEE_WIDTH],
-                .noiseGateThresholdDb = additional[MBC_ADD_NOISE_GATE_THRESHOLD],
-                .expanderRatio = additional[MBC_ADD_EXPENDER_RATIO],
-                .preGainDb = additional[MBC_ADD_PRE_GAIN],
-                .postGainDb = additional[MBC_ADD_POST_GAIN]};
+    const auto& cutOffFreqs = std::get<MBC_BAND_CUTOFF_FREQ>(params);
+    const auto& additional = std::get<MBC_BAND_ADDITIONAL>(params);
+
+    cfgs.resize(cutOffFreqs.size());
+
+    for (size_t i = 0; i < cutOffFreqs.size(); ++i) {
+        cfgs[i] = createMbcBandConfig(std::get<MBC_BAND_CHANNEL>(params),
+                                      cutOffFreqs[i].first,   // band channel
+                                      cutOffFreqs[i].second,  // band cutoff frequency
+                                      additional[MBC_ADD_ATTACK_TIME],
+                                      additional[MBC_ADD_RELEASE_TIME], additional[MBC_ADD_RATIO],
+                                      additional[MBC_ADD_THRESHOLD], additional[MBC_ADD_KNEE_WIDTH],
+                                      additional[MBC_ADD_NOISE_GATE_THRESHOLD],
+                                      additional[MBC_ADD_EXPENDER_RATIO],
+                                      additional[MBC_ADD_PRE_GAIN], additional[MBC_ADD_POST_GAIN]);
     }
 }
 
@@ -1222,6 +1239,160 @@
         });
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DynamicsProcessingTestMbcBandConfig);
 
+class DynamicsProcessingMbcBandConfigDataTest
+    : public ::testing::TestWithParam<std::pair<std::shared_ptr<IFactory>, Descriptor>>,
+      public DynamicsProcessingTestHelper {
+  public:
+    DynamicsProcessingMbcBandConfigDataTest()
+        : DynamicsProcessingTestHelper(GetParam(), AudioChannelLayout::LAYOUT_MONO) {
+        mInput.resize(kFrameCount * mChannelCount);
+        mBinOffsets.resize(mTestFrequencies.size());
+    }
+
+    void SetUp() override {
+        SetUpDynamicsProcessingEffect();
+        SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
+        ASSERT_NO_FATAL_FAILURE(generateSineWave(mTestFrequencies, mInput, 1.0, kSamplingFrequency,
+                                                 mChannelLayout));
+    }
+
+    void TearDown() override { TearDownDynamicsProcessingEffect(); }
+
+    void setMbcParamsAndProcess(std::vector<float>& output) {
+        for (int i = 0; i < mChannelCount; i++) {
+            mChannelConfig.push_back(DynamicsProcessing::ChannelConfig(i, true));
+        }
+        mEngineConfigPreset.mbcStage.bandCount = mCfgs.size();
+        addEngineConfig(mEngineConfigPreset);
+        addMbcChannelConfig(mChannelConfig);
+        addMbcBandConfigs(mCfgs);
+
+        if (isAllParamsValid()) {
+            ASSERT_NO_FATAL_FAILURE(SetAndGetDynamicsProcessingParameters());
+            ASSERT_NO_FATAL_FAILURE(
+                    processAndWriteToOutput(mInput, output, mEffect, &mOpenEffectReturn));
+        }
+    }
+
+    void fillMbcBandConfig(std::vector<DynamicsProcessing::MbcBandConfig>& cfgs, int channelIndex,
+                           float threshold, float ratio, float noiseGate, float expanderRatio,
+                           int bandIndex, int cutoffFreqHz) {
+        cfgs.push_back(createMbcBandConfig(
+                channelIndex, bandIndex, static_cast<float>(cutoffFreqHz), kDefaultAttackTime,
+                kDefaultReleaseTime, ratio, threshold, kDefaultKneeWidth, noiseGate, expanderRatio,
+                kDefaultPreGainDb, kDefaultPostGainDb));
+    }
+
+    void getMagnitudeValue(const std::vector<float>& output, std::vector<float>& bufferMag) {
+        std::vector<float> subOutput(output.begin() + kStartIndex, output.end());
+        EXPECT_NO_FATAL_FAILURE(
+                calculateMagnitudeMono(bufferMag, subOutput, mBinOffsets, kNPointFFT));
+    }
+
+    void validateOutput(const std::vector<float>& output, float threshold, float ratio,
+                        size_t bandIndex) {
+        float inputDb = calculateDb(mInput);
+        std::vector<float> outputMag(mBinOffsets.size());
+        EXPECT_NO_FATAL_FAILURE(getMagnitudeValue(output, outputMag));
+        if (threshold >= inputDb || ratio == 1) {
+            std::vector<float> inputMag(mBinOffsets.size());
+            EXPECT_NO_FATAL_FAILURE(getMagnitudeValue(mInput, inputMag));
+            for (size_t i = 0; i < inputMag.size(); i++) {
+                EXPECT_NEAR(calculateDb({inputMag[i] / mNormalizingFactor}),
+                            calculateDb({outputMag[i] / mNormalizingFactor}), kToleranceDb);
+            }
+        } else {
+            // Current band's magnitude is less than the other band's magnitude
+            EXPECT_LT(outputMag[bandIndex], outputMag[bandIndex ^ 1]);
+        }
+    }
+
+    void analyseMultiBandOutput(float threshold, float ratio) {
+        std::vector<float> output(mInput.size());
+        roundToFreqCenteredToFftBin(mTestFrequencies, mBinOffsets, kBinWidth);
+        std::vector<int> cutoffFreqHz = {200 /*0th band cutoff*/, 2000 /*1st band cutoff*/};
+        // Set MBC values for two bands
+        for (size_t i = 0; i < cutoffFreqHz.size(); i++) {
+            for (int channelIndex = 0; channelIndex < mChannelCount; channelIndex++) {
+                fillMbcBandConfig(mCfgs, channelIndex, threshold, ratio, kDefaultNoiseGateDb,
+                                  kDefaultExpanderRatio, i, cutoffFreqHz[i]);
+                fillMbcBandConfig(mCfgs, channelIndex, kDefaultThresholdDb, kDefaultRatio,
+                                  kDefaultNoiseGateDb, kDefaultExpanderRatio, i ^ 1,
+                                  cutoffFreqHz[i ^ 1]);
+            }
+            ASSERT_NO_FATAL_FAILURE(setMbcParamsAndProcess(output));
+
+            if (isAllParamsValid()) {
+                ASSERT_NO_FATAL_FAILURE(validateOutput(output, threshold, ratio, i));
+            }
+            cleanUpMbcConfig();
+        }
+    }
+
+    void cleanUpMbcConfig() {
+        CleanUp();
+        mCfgs.clear();
+        mChannelConfig.clear();
+    }
+
+    static constexpr int kNPointFFT = 1024;
+    static constexpr float kToleranceDb = 0.5;
+    static constexpr float kDefaultPostGainDb = 0;
+    static constexpr float kDefaultPreGainDb = 0;
+    static constexpr float kDefaultAttackTime = 0;
+    static constexpr float kDefaultReleaseTime = 0;
+    static constexpr float kDefaultKneeWidth = 0;
+    static constexpr float kDefaultThresholdDb = 0;
+    static constexpr float kDefaultNoiseGateDb = -10;
+    static constexpr float kDefaultExpanderRatio = 1;
+    static constexpr float kDefaultRatio = 1;
+    static constexpr float kBinWidth = (float)kSamplingFrequency / kNPointFFT;
+    std::vector<int> mTestFrequencies = {100, 1000};
+    // Calculating normalizing factor by dividing the number of FFT points by half and the number of
+    // test frequencies. The normalization accounts for the FFT splitting the signal into positive
+    // and negative frequencies. Additionally, during multi-tone input generation, sample values are
+    // normalized to the range [-1, 1] by dividing them by the number of test frequencies.
+    float mNormalizingFactor = (kNPointFFT / (2 * mTestFrequencies.size()));
+    std::vector<DynamicsProcessing::MbcBandConfig> mCfgs;
+    std::vector<DynamicsProcessing::ChannelConfig> mChannelConfig;
+    std::vector<int> mBinOffsets;
+    std::vector<float> mInput;
+};
+
+TEST_P(DynamicsProcessingMbcBandConfigDataTest, IncreasingThreshold) {
+    float ratio = 20;
+    std::vector<float> thresholdValues = {-200, -100, 0, 100, 200};
+
+    for (float threshold : thresholdValues) {
+        cleanUpMbcConfig();
+        ASSERT_NO_FATAL_FAILURE(analyseMultiBandOutput(threshold, ratio));
+    }
+}
+
+TEST_P(DynamicsProcessingMbcBandConfigDataTest, IncreasingRatio) {
+    float threshold = -20;
+    std::vector<float> ratioValues = {1, 10, 20, 30, 40, 50};
+
+    for (float ratio : ratioValues) {
+        cleanUpMbcConfig();
+        ASSERT_NO_FATAL_FAILURE(analyseMultiBandOutput(threshold, ratio));
+    }
+}
+
+INSTANTIATE_TEST_SUITE_P(DynamicsProcessingTest, DynamicsProcessingMbcBandConfigDataTest,
+                         testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
+                                 IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
+                         [](const auto& info) {
+                             auto descriptor = info.param;
+                             std::string name = getPrefix(descriptor.second);
+                             std::replace_if(
+                                     name.begin(), name.end(),
+                                     [](const char c) { return !std::isalnum(c); }, '_');
+                             return name;
+                         });
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DynamicsProcessingMbcBandConfigDataTest);
+
 int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
     ::testing::UnitTest::GetInstance()->listeners().Append(new TestExecutionTracer());
diff --git a/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp b/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp
index 2e59dbf..ade6f2d 100644
--- a/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp
@@ -39,37 +39,37 @@
         counterRef.get()++;
     });
 
-    timer.registerRecurrentEvent(milliseconds(1), 0xdead);
-    std::this_thread::sleep_for(milliseconds(100));
-    // This test is unstable, so set the tolerance to 50.
-    ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 50);
+    timer.registerRecurrentEvent(milliseconds(100), 0xdead);
+    std::this_thread::sleep_for(milliseconds(1000));
+    // This test is unstable, so set the tolerance to 5.
+    ASSERT_EQ_WITH_TOLERANCE(10, counter.load(), 5);
 }
 
 TEST(RecurrentTimerTest, multipleIntervals) {
-    std::atomic<int64_t> counter1ms { 0L };
-    std::atomic<int64_t> counter5ms { 0L };
-    auto counter1msRef = std::ref(counter1ms);
-    auto counter5msRef = std::ref(counter5ms);
+    std::atomic<int64_t> counter100ms { 0L };
+    std::atomic<int64_t> counter50ms { 0L };
+    auto counter100msRef = std::ref(counter100ms);
+    auto counter50msRef = std::ref(counter50ms);
     RecurrentTimer timer(
-            [&counter1msRef, &counter5msRef](const std::vector<int32_t>& cookies) {
+            [&counter100msRef, &counter50msRef](const std::vector<int32_t>& cookies) {
         for (int32_t cookie : cookies) {
             if (cookie == 0xdead) {
-                counter1msRef.get()++;
+                counter100msRef.get()++;
             } else if (cookie == 0xbeef) {
-                counter5msRef.get()++;
+                counter50msRef.get()++;
             } else {
                 FAIL();
             }
         }
     });
 
-    timer.registerRecurrentEvent(milliseconds(1), 0xdead);
-    timer.registerRecurrentEvent(milliseconds(5), 0xbeef);
+    timer.registerRecurrentEvent(milliseconds(100), 0xdead);
+    timer.registerRecurrentEvent(milliseconds(50), 0xbeef);
 
-    std::this_thread::sleep_for(milliseconds(100));
-    // This test is unstable, so set the tolerance to 50.
-    ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 50);
-    ASSERT_EQ_WITH_TOLERANCE(20, counter5ms.load(), 10);
+    std::this_thread::sleep_for(milliseconds(1000));
+    // This test is unstable, so set the tolerance to 5.
+    ASSERT_EQ_WITH_TOLERANCE(10, counter100ms.load(), 5);
+    ASSERT_EQ_WITH_TOLERANCE(20, counter50ms.load(), 10);
 }
 
 }  // anonymous namespace
diff --git a/bluetooth/socket/aidl/Android.bp b/bluetooth/socket/aidl/Android.bp
index 8b412b2..9341564 100644
--- a/bluetooth/socket/aidl/Android.bp
+++ b/bluetooth/socket/aidl/Android.bp
@@ -31,6 +31,9 @@
     ],
     stability: "vintf",
     backend: {
+        rust: {
+            enabled: true,
+        },
         java: {
             enabled: false,
         },
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Luts.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Luts.aidl
index 393354e..6ff1db2 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Luts.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Luts.aidl
@@ -58,6 +58,8 @@
      *
      * Multiple Luts can be packed into one same `pfd`, and `offsets` is used to pinpoint
      * the starting point of each Lut.
+     *
+     * `offsets` should be valid unless an invalid `pfd` is provided.
      */
     @nullable int[] offsets;
 
diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
index a44cd5e..fc735f7 100644
--- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
+++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
@@ -363,8 +363,14 @@
  * Tests the values returned by getHingeInfo() from interface IHealth.
  */
 TEST_P(HealthAidl, getHingeInfo) {
+    int32_t version{};
+    auto status = health->getInterfaceVersion(&version);
+    ASSERT_TRUE(status.isOk()) << status;
+    if (version < 4) {
+        GTEST_SKIP() << "Support for hinge health hal is added in v4";
+    }
     std::vector<HingeInfo> value;
-    auto status = health->getHingeInfo(&value);
+    status = health->getHingeInfo(&value);
     ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
     if (!status.isOk()) return;
     for (auto& hinge : value) {
diff --git a/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp b/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp
index 4a57f44..fc5979a 100644
--- a/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp
+++ b/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp
@@ -229,13 +229,13 @@
                                                          .Authorization(TAG_INCLUDE_UNIQUE_ID))));
 
     hidl_vec<hidl_vec<uint8_t>> cert_chain;
-    EXPECT_EQ(ErrorCode::UNIMPLEMENTED,
-              convert(AttestKey(
-                      AuthorizationSetBuilder()
+    ErrorCode result = convert(
+            AttestKey(AuthorizationSetBuilder()
                               .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION)
                               .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge"))
                               .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")),
-                      &cert_chain)));
+                      &cert_chain));
+    EXPECT_TRUE(result == ErrorCode::UNIMPLEMENTED || result == ErrorCode::INVALID_ARGUMENT);
     CheckedDeleteKey();
 
     ASSERT_EQ(ErrorCode::OK, convert(GenerateKey(AuthorizationSetBuilder()
@@ -244,13 +244,13 @@
                                                          .Digest(Digest::SHA_2_256)
                                                          .Authorization(TAG_INCLUDE_UNIQUE_ID))));
 
-    EXPECT_EQ(ErrorCode::UNIMPLEMENTED,
-              convert(AttestKey(
-                      AuthorizationSetBuilder()
+    result = convert(
+            AttestKey(AuthorizationSetBuilder()
                               .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION)
                               .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge"))
                               .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")),
-                      &cert_chain)));
+                      &cert_chain));
+    EXPECT_TRUE(result == ErrorCode::UNIMPLEMENTED || result == ErrorCode::INVALID_ARGUMENT);
     CheckedDeleteKey();
 }
 
diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp
index 14afc92..5236e90 100644
--- a/security/keymint/aidl/Android.bp
+++ b/security/keymint/aidl/Android.bp
@@ -103,3 +103,13 @@
         "android.hardware.security.keymint-V4-rust",
     ],
 }
+
+// java_defaults that includes the latest KeyMint AIDL library.
+// Modules that depend on KeyMint directly can include this java_defaults to avoid
+// managing dependency versions explicitly.
+java_defaults {
+    name: "keymint_use_latest_hal_aidl_java",
+    static_libs: [
+        "android.hardware.security.keymint-V4-java",
+    ],
+}
diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
index cafec70..fc703e9 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
@@ -87,12 +87,14 @@
  *        SHA-2 256.
  *      - Unpadded, RSAES-OAEP and RSAES-PKCS1-v1_5 padding modes for RSA encryption.
  *
- * o   ECDSA
+ * o   ECDSA and ECDH
  *
+ *      - IKeyMintDevices must support elliptic curve signing (Purpose::SIGN, Purpose::ATTEST_KEY)
+ *        and key agreement operations (Purpose::AGREE_KEY).
  *      - TRUSTED_ENVIRONMENT IKeyMintDevices must support NIST curves P-224, P-256, P-384 and
  *        P-521.  STRONGBOX IKeyMintDevices must support NIST curve P-256.
- *      - TRUSTED_ENVIRONMENT IKeyMintDevices must support SHA1, SHA-2 224, SHA-2 256, SHA-2
- *        384 and SHA-2 512 digest modes.  STRONGBOX IKeyMintDevices must support SHA-2 256.
+ *      - For signing, TRUSTED_ENVIRONMENT IKeyMintDevices must support SHA1, SHA-2 224, SHA-2 256,
+ *        SHA-2 384 and SHA-2 512 digest modes.  STRONGBOX IKeyMintDevices must support SHA-2 256.
  *      - TRUSTED_ENVRIONMENT IKeyMintDevices must support curve 25519 for Purpose::SIGN (Ed25519,
  *        as specified in RFC 8032), Purpose::ATTEST_KEY (Ed25519) or for KeyPurpose::AGREE_KEY
  *        (X25519, as specified in RFC 7748).  However, a key must have exactly one of these
@@ -302,12 +304,12 @@
      *   PaddingMode::RSA_OAEP, PaddingMode::RSA_PSS, PaddingMode::RSA_PKCS1_1_5_ENCRYPT and
      *   PaddingMode::RSA_PKCS1_1_5_SIGN for RSA keys.
      *
-     * == ECDSA Keys ==
+     * == ECDSA/ECDH Keys ==
      *
-     * Tag::EC_CURVE must be provided to generate an ECDSA key.  If it is not provided, generateKey
-     * must return ErrorCode::UNSUPPORTED_KEY_SIZE or ErrorCode::UNSUPPORTED_EC_CURVE. TEE
-     * IKeyMintDevice implementations must support all required curves.  StrongBox implementations
-     * must support P_256 and no other curves.
+     * Tag::EC_CURVE must be provided to generate an elliptic curve key.  If it is not provided,
+     * generateKey must return ErrorCode::UNSUPPORTED_KEY_SIZE or ErrorCode::UNSUPPORTED_EC_CURVE.
+     * TEE IKeyMintDevice implementations must support all required curves.  StrongBox
+     * implementations must support P_256 and no other curves.
      *
      * Tag::CERTIFICATE_NOT_BEFORE and Tag::CERTIFICATE_NOT_AFTER must be provided to specify the
      * valid date range for the returned X.509 certificate holding the public key. If omitted,
@@ -318,10 +320,10 @@
      * than one purpose should be rejected with ErrorCode::INCOMPATIBLE_PURPOSE.
      * StrongBox implementation do not support CURVE_25519.
      *
-     * Tag::DIGEST specifies digest algorithms that may be used with the new key.  TEE
-     * IKeyMintDevice implementations must support all Digest values (see Digest.aidl) for ECDSA
-     * keys; Ed25519 keys only support Digest::NONE. StrongBox IKeyMintDevice implementations must
-     * support SHA_2_256.
+     * Tag::DIGEST specifies digest algorithms that may be used with the new key when used for
+     * signing.  TEE IKeyMintDevice implementations must support all Digest values (see Digest.aidl)
+     * for ECDSA keys; Ed25519 keys only support Digest::NONE. StrongBox IKeyMintDevice
+     * implementations must support SHA_2_256.
      *
      * == AES Keys ==
      *
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 743928e..2f34b9d 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -2269,10 +2269,19 @@
     get_unique_id(app_id, min_date - 1, &unique_id8);
     EXPECT_NE(unique_id, unique_id8);
 
-    // Marking RESET_SINCE_ID_ROTATION should give a different unique ID.
-    vector<uint8_t> unique_id9;
-    get_unique_id(app_id, cert_date, &unique_id9, /* reset_id = */ true);
-    EXPECT_NE(unique_id, unique_id9);
+    // Some StrongBox implementations did not correctly handle RESET_SINCE_ID_ROTATION when
+    // combined with use of an ATTEST_KEY, but this was not previously tested. Tests under GSI
+    // were updated to implicitly use ATTEST_KEYS (because rkp-only status cannot be determined),
+    // uncovering the problem. Skip this test for older implementations in that situation
+    // (cf. b/385800086).
+    int vendor_api_level = get_vendor_api_level();
+    if (!(is_gsi_image() && SecLevel() == SecurityLevel::STRONGBOX &&
+          vendor_api_level < AVendorSupport_getVendorApiLevelOf(__ANDROID_API_V__))) {
+        // Marking RESET_SINCE_ID_ROTATION should give a different unique ID.
+        vector<uint8_t> unique_id9;
+        get_unique_id(app_id, cert_date, &unique_id9, /* reset_id = */ true);
+        EXPECT_NE(unique_id, unique_id9);
+    }
 }
 
 /*
@@ -2281,6 +2290,16 @@
  * Verifies that creation of an attested ECDSA key does not include APPLICATION_ID.
  */
 TEST_P(NewKeyGenerationTest, EcdsaAttestationTagNoApplicationId) {
+    int vendor_api_level = get_vendor_api_level();
+    if (is_gsi_image() && SecLevel() == SecurityLevel::STRONGBOX &&
+        vendor_api_level < AVendorSupport_getVendorApiLevelOf(__ANDROID_API_V__)) {
+        // Some StrongBox implementations did not correctly handle missing APPLICATION_ID when
+        // combined with use of an ATTEST_KEY, but this was not previously tested. Tests under
+        // GSI were updated to implicitly use ATTEST_KEYS (because rkp-only status cannot be
+        // determined), uncovering the problem. Skip this test for older implementations in that
+        // situation (cf. b/385800086).
+        GTEST_SKIP() << "Skip test on StrongBox device with vendor-api-level < __ANDROID_API_V__";
+    }
     auto challenge = "hello";
     auto attest_app_id = "foo";
     auto subject = "cert subj 2";
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index dcf8674..ecf69e8 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -863,15 +863,15 @@
                      allowAnyMode);
 }
 
-ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& encodedCsr,
-                                        const std::string& instanceName) {
+ErrMsgOr<hwtrust::DiceChain> getDiceChain(const std::vector<uint8_t>& encodedCsr, bool isFactory,
+                                          bool allowAnyMode, std::string_view instanceName) {
     auto diceChainKind = getDiceChainKind();
     if (!diceChainKind) {
         return diceChainKind.message();
     }
 
-    auto csr = hwtrust::Csr::validate(encodedCsr, *diceChainKind, false /*isFactory*/,
-                                      true /*allowAnyMode*/, deviceSuffix(instanceName));
+    auto csr = hwtrust::Csr::validate(encodedCsr, *diceChainKind, isFactory, allowAnyMode,
+                                      deviceSuffix(instanceName));
     if (!csr.ok()) {
         return csr.error().message();
     }
@@ -881,6 +881,16 @@
         return diceChain.error().message();
     }
 
+    return std::move(*diceChain);
+}
+
+ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& encodedCsr,
+                                        const std::string& instanceName) {
+    auto diceChain =
+            getDiceChain(encodedCsr, /*isFactory=*/false, /*allowAnyMode=*/true, instanceName);
+    if (!diceChain) {
+        return diceChain.message();
+    }
     return diceChain->IsProper();
 }
 
@@ -899,20 +909,10 @@
                                                  std::string_view instanceName1,
                                                  const std::vector<uint8_t>& encodedCsr2,
                                                  std::string_view instanceName2) {
-    auto diceChainKind = getDiceChainKind();
-    if (!diceChainKind) {
-        return diceChainKind.message();
-    }
-
-    auto csr1 = hwtrust::Csr::validate(encodedCsr1, *diceChainKind, false /*isFactory*/,
-                                       true /*allowAnyMode*/, deviceSuffix(instanceName1));
-    if (!csr1.ok()) {
-        return csr1.error().message();
-    }
-
-    auto diceChain1 = csr1->getDiceChain();
-    if (!diceChain1.ok()) {
-        return diceChain1.error().message();
+    auto diceChain1 =
+            getDiceChain(encodedCsr1, /*isFactory=*/false, /*allowAnyMode=*/true, instanceName1);
+    if (!diceChain1) {
+        return diceChain1.message();
     }
 
     auto proper1 = diceChain1->IsProper();
@@ -921,15 +921,10 @@
                hexlify(encodedCsr1);
     }
 
-    auto csr2 = hwtrust::Csr::validate(encodedCsr2, *diceChainKind, false /*isFactory*/,
-                                       true /*allowAnyMode*/, deviceSuffix(instanceName2));
-    if (!csr2.ok()) {
-        return csr2.error().message();
-    }
-
-    auto diceChain2 = csr2->getDiceChain();
-    if (!diceChain2.ok()) {
-        return diceChain2.error().message();
+    auto diceChain2 =
+            getDiceChain(encodedCsr2, /*isFactory=*/false, /*allowAnyMode=*/true, instanceName2);
+    if (!diceChain2) {
+        return diceChain2.message();
     }
 
     auto proper2 = diceChain2->IsProper();
@@ -947,20 +942,10 @@
 }
 
 ErrMsgOr<bool> verifyComponentNameInKeyMintDiceChain(const std::vector<uint8_t>& encodedCsr) {
-    auto diceChainKind = getDiceChainKind();
-    if (!diceChainKind) {
-        return diceChainKind.message();
-    }
-
-    auto csr = hwtrust::Csr::validate(encodedCsr, *diceChainKind, false /*isFactory*/,
-                                      true /*allowAnyMode*/, deviceSuffix(DEFAULT_INSTANCE_NAME));
-    if (!csr.ok()) {
-        return csr.error().message();
-    }
-
-    auto diceChain = csr->getDiceChain();
-    if (!diceChain.ok()) {
-        return diceChain.error().message();
+    auto diceChain = getDiceChain(encodedCsr, /*isFactory=*/false, /*allowAnyMode=*/true,
+                                  DEFAULT_INSTANCE_NAME);
+    if (!diceChain) {
+        return diceChain.message();
     }
 
     auto satisfied = diceChain->componentNameContains(kKeyMintComponentName);
@@ -973,20 +958,10 @@
 
 ErrMsgOr<bool> hasNonNormalModeInDiceChain(const std::vector<uint8_t>& encodedCsr,
                                            std::string_view instanceName) {
-    auto diceChainKind = getDiceChainKind();
-    if (!diceChainKind) {
-        return diceChainKind.message();
-    }
-
-    auto csr = hwtrust::Csr::validate(encodedCsr, *diceChainKind, false /*isFactory*/,
-                                      true /*allowAnyMode*/, deviceSuffix(instanceName));
-    if (!csr.ok()) {
-        return csr.error().message();
-    }
-
-    auto diceChain = csr->getDiceChain();
-    if (!diceChain.ok()) {
-        return diceChain.error().message();
+    auto diceChain =
+            getDiceChain(encodedCsr, /*isFactory=*/false, /*allowAnyMode=*/true, instanceName);
+    if (!diceChain) {
+        return diceChain.message();
     }
 
     auto hasNonNormalModeInDiceChain = diceChain->hasNonNormalMode();
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 66f7539..7ef445e 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -344,6 +344,53 @@
     ASSERT_TRUE(*result);
 }
 
+/**
+ * Check that ro.boot.vbmeta.device_state is not "locked" or ro.boot.verifiedbootstate
+ * is not "green" if and only if the mode on at least one certificate in the DICE chain
+ * is non-normal.
+ */
+TEST(NonParameterizedTests, unlockedBootloaderStatesImpliesNonnormalRkpVmDiceChain) {
+    if (!AServiceManager_isDeclared(RKPVM_INSTANCE_NAME.c_str())) {
+        GTEST_SKIP() << "The RKP VM (" << RKPVM_INSTANCE_NAME << ") is not present on this device.";
+    }
+
+    auto rpc = getHandle<IRemotelyProvisionedComponent>(RKPVM_INSTANCE_NAME);
+    ASSERT_NE(rpc, nullptr) << "The RKP VM (" << RKPVM_INSTANCE_NAME << ") RPC is unavailable.";
+
+    RpcHardwareInfo hardwareInfo;
+    auto status = rpc->getHardwareInfo(&hardwareInfo);
+    if (!status.isOk()) {
+        GTEST_SKIP() << "The RKP VM is not supported on this system.";
+    }
+
+    auto challenge = randomBytes(MAX_CHALLENGE_SIZE);
+    bytevec csr;
+    auto rkpVmStatus = rpc->generateCertificateRequestV2({} /* keysToSign */, challenge, &csr);
+    ASSERT_TRUE(rkpVmStatus.isOk()) << status.getDescription();
+
+    auto isProper = isCsrWithProperDiceChain(csr, RKPVM_INSTANCE_NAME);
+    ASSERT_TRUE(isProper) << isProper.message();
+    if (!*isProper) {
+        GTEST_SKIP() << "Skipping test: Only a proper DICE chain has a mode set.";
+    }
+
+    auto nonNormalMode = hasNonNormalModeInDiceChain(csr, RKPVM_INSTANCE_NAME);
+    ASSERT_TRUE(nonNormalMode) << nonNormalMode.message();
+
+    auto deviceState = ::android::base::GetProperty("ro.boot.vbmeta.device_state", "");
+    auto verifiedBootState = ::android::base::GetProperty("ro.boot.verifiedbootstate", "");
+
+    ASSERT_TRUE(!deviceState.empty());
+    ASSERT_TRUE(!verifiedBootState.empty());
+
+    ASSERT_EQ(deviceState != "locked" || verifiedBootState != "green", *nonNormalMode)
+            << "ro.boot.vbmeta.device_state = '" << deviceState
+            << "' and ro.boot.verifiedbootstate = '" << verifiedBootState << "', but the DICE "
+            << " chain has a " << (*nonNormalMode ? "non-normal" : "normal") << " DICE mode."
+            << " Locked devices must report normal, and unlocked devices must report "
+            << " non-normal.";
+}
+
 using GetHardwareInfoTests = VtsRemotelyProvisionedComponentTests;
 
 INSTANTIATE_REM_PROV_AIDL_TEST(GetHardwareInfoTests);
@@ -849,37 +896,6 @@
 };
 
 /**
- * Check that ro.boot.vbmeta.device_state is not "locked" or ro.boot.verifiedbootstate
- * is not "green" if and only if the mode on at least one certificate in the DICE chain
- * is non-normal.
- */
-TEST_P(CertificateRequestV2Test, DISABLED_unlockedBootloaderStatesImpliesNonnormalDiceChain) {
-    auto challenge = randomBytes(MAX_CHALLENGE_SIZE);
-    bytevec csr;
-    auto status =
-            provisionable_->generateCertificateRequestV2({} /* keysToSign */, challenge, &csr);
-    ASSERT_TRUE(status.isOk()) << status.getDescription();
-
-    auto isProper = isCsrWithProperDiceChain(csr, GetParam());
-    ASSERT_TRUE(isProper) << isProper.message();
-    if (!*isProper) {
-        GTEST_SKIP() << "Skipping test: Only a proper DICE chain has a mode set.";
-    }
-
-    auto nonNormalMode = hasNonNormalModeInDiceChain(csr, GetParam());
-    ASSERT_TRUE(nonNormalMode) << nonNormalMode.message();
-
-    auto deviceState = ::android::base::GetProperty("ro.boot.vbmeta.device_state", "");
-    auto verifiedBootState = ::android::base::GetProperty("ro.boot.verifiedbootstate", "");
-
-    ASSERT_EQ(deviceState != "locked" || verifiedBootState != "green", *nonNormalMode)
-            << "ro.boot.vbmeta.device_state = '" << deviceState
-            << "' and ro.boot.verifiedbootstate = '" << verifiedBootState << "', but it is "
-            << *nonNormalMode
-            << " that the DICE chain has a certificate with a non-normal mode set.";
-}
-
-/**
  * Generate an empty certificate request with all possible length of challenge, and decrypt and
  * verify the structure and content.
  */
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index 6de150e..6c7ae09 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -1863,7 +1863,9 @@
     legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired
                                                     ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE
                                                     : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
-    legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
+    legacy_request->sdea_params.range_report = aidl_request.rangingResultsRequired
+                                                       ? legacy_hal::NAN_ENABLE_RANGE_REPORT
+                                                       : legacy_hal::NAN_DISABLE_RANGE_REPORT;
     legacy_request->publish_type = convertAidlNanPublishTypeToLegacy(aidl_request.publishType);
     legacy_request->tx_type = convertAidlNanTxTypeToLegacy(aidl_request.txType);
     legacy_request->service_responder_policy = aidl_request.autoAcceptDataPathRequests
@@ -1992,6 +1994,17 @@
     legacy_request->ranging_cfg.distance_ingress_mm =
             aidl_request.baseConfigs.distanceIngressCm * 10;
     legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10;
+    legacy_request->ranging_cfg.rtt_burst_size = aidl_request.baseConfigs.rttBurstSize;
+    legacy_request->ranging_cfg.preamble =
+            convertAidlRttPreambleToLegacy(aidl_request.baseConfigs.preamble);
+    if (aidl_request.baseConfigs.channelInfo.has_value()) {
+        if (!convertAidlWifiChannelInfoToLegacy(aidl_request.baseConfigs.channelInfo.value(),
+                                                &legacy_request->ranging_cfg.channel_info)) {
+            LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: "
+                          "Unable to convert aidl channel info to legacy";
+            return false;
+        }
+    }
     legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired
                                                     ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE
                                                     : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
@@ -2300,10 +2313,9 @@
     aidl_response->supportsPairing = legacy_response.is_pairing_supported;
     aidl_response->supportsSetClusterId = legacy_response.is_set_cluster_id_supported;
     aidl_response->supportsSuspension = legacy_response.is_suspension_supported;
-    // TODO: Retrieve values from the legacy HAL
-    aidl_response->supportsPeriodicRanging = false;
-    aidl_response->maxSupportedBandwidth = RttBw::BW_UNSPECIFIED;
-    aidl_response->maxNumRxChainsSupported = 2;
+    aidl_response->supportsPeriodicRanging = legacy_response.is_periodic_ranging_supported;
+    aidl_response->maxSupportedBandwidth = convertLegacyRttBwToAidl(legacy_response.supported_bw);
+    aidl_response->maxNumRxChainsSupported = legacy_response.num_rx_chains_supported;
 
     return true;
 }
diff --git a/wifi/aidl/vts/functional/Android.bp b/wifi/aidl/vts/functional/Android.bp
index ca5263f..8e12089 100644
--- a/wifi/aidl/vts/functional/Android.bp
+++ b/wifi/aidl/vts/functional/Android.bp
@@ -48,6 +48,12 @@
 }
 
 cc_test {
+    name: "VtsHalWifiTargetTest",
+    defaults: ["wifi_vendor_hal_vts_test_defaults"],
+    srcs: ["wifi_aidl_test.cpp"],
+}
+
+cc_test {
     name: "VtsHalWifiChipTargetTest",
     defaults: ["wifi_vendor_hal_vts_test_defaults"],
     srcs: ["wifi_chip_aidl_test.cpp"],
diff --git a/wifi/aidl/vts/functional/wifi_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_aidl_test.cpp
new file mode 100644
index 0000000..64a30ea
--- /dev/null
+++ b/wifi/aidl/vts/functional/wifi_aidl_test.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2025 The Android Open Source Project
+ *
+ * Licensed under the Staache 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.
+ */
+
+#include <vector>
+
+#include <VtsCoreUtil.h>
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/wifi/BnWifiEventCallback.h>
+#include <android/binder_manager.h>
+#include <android/binder_status.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+
+#include "wifi_aidl_test_utils.h"
+
+using aidl::android::hardware::wifi::BnWifiEventCallback;
+using aidl::android::hardware::wifi::WifiStatusCode;
+
+class WifiAidlTest : public testing::TestWithParam<std::string> {
+  public:
+    void SetUp() override {
+        instance_name_ = GetParam().c_str();
+        stopWifiService(instance_name_);
+        wifi_ = getWifi(instance_name_);
+        ASSERT_NE(wifi_, nullptr);
+    }
+
+    void TearDown() override { stopWifiService(instance_name_); }
+
+  protected:
+    std::shared_ptr<IWifi> wifi_;
+    const char* instance_name_;
+};
+
+class WifiEventCallback : public BnWifiEventCallback {
+  public:
+    WifiEventCallback() = default;
+
+    ::ndk::ScopedAStatus onFailure(WifiStatusCode /* status */) override {
+        return ndk::ScopedAStatus::ok();
+    }
+    ::ndk::ScopedAStatus onStart() override { return ndk::ScopedAStatus::ok(); }
+    ::ndk::ScopedAStatus onStop() override { return ndk::ScopedAStatus::ok(); }
+    ::ndk::ScopedAStatus onSubsystemRestart(WifiStatusCode /* status */) override {
+        return ndk::ScopedAStatus::ok();
+    }
+};
+
+/*
+ * RegisterEventCallback
+ */
+TEST_P(WifiAidlTest, RegisterEventCallback) {
+    const std::shared_ptr<WifiEventCallback> callback =
+            ndk::SharedRefBase::make<WifiEventCallback>();
+    ASSERT_NE(callback, nullptr);
+    EXPECT_TRUE(wifi_->registerEventCallback(callback).isOk());
+}
+
+/*
+ * IsStarted
+ */
+TEST_P(WifiAidlTest, IsStarted) {
+    // HAL should not be started by default
+    bool isStarted;
+    EXPECT_TRUE(wifi_->isStarted(&isStarted).isOk());
+    EXPECT_FALSE(isStarted);
+
+    // Start wifi by setting up the chip, and verify isStarted
+    auto wifiChip = getWifiChip(instance_name_);
+    EXPECT_NE(wifiChip, nullptr);
+    EXPECT_TRUE(wifi_->isStarted(&isStarted).isOk());
+    EXPECT_TRUE(isStarted);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiAidlTest);
+INSTANTIATE_TEST_SUITE_P(WifiTest, WifiAidlTest,
+                         testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)),
+                         android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    android::ProcessState::self()->setThreadPoolMaxThreadCount(1);
+    android::ProcessState::self()->startThreadPool();
+    return RUN_ALL_TESTS();
+}
diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
index 1ef02af..56b8bb1 100644
--- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
@@ -526,6 +526,9 @@
     status = wifi_chip_->startLoggingToDebugRingBuffer(
             ring_name, WifiDebugRingBufferVerboseLevel::VERBOSE, 5, 1024);
     EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED));
+
+    status = wifi_chip_->stopLoggingToDebugRingBuffer();
+    EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED));
 }
 
 /*
diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp
index 924d74d..6a94437 100644
--- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp
@@ -520,14 +520,6 @@
 };
 
 /*
- * GetName
- */
-TEST_P(WifiNanIfaceAidlTest, GetName) {
-    std::string ifaceName;
-    EXPECT_TRUE(wifi_nan_iface_->getName(&ifaceName).isOk());
-}
-
-/*
  * FailOnIfaceInvalid
  * Ensure that API calls to an interface fail with code ERROR_WIFI_IFACE_INVALID
  * after wifi is disabled.
diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
index f997c43..4f25171 100644
--- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
@@ -531,14 +531,6 @@
 }
 
 /*
- * GetName
- */
-TEST_P(WifiStaIfaceAidlTest, GetName) {
-    std::string ifaceName;
-    EXPECT_TRUE(wifi_sta_iface_->getName(&ifaceName).isOk());
-}
-
-/*
  * SetDtimMultiplier
  */
 TEST_P(WifiStaIfaceAidlTest, SetDtimMultiplier) {
diff --git a/wifi/legacy_headers/include/hardware_legacy/wifi_nan.h b/wifi/legacy_headers/include/hardware_legacy/wifi_nan.h
index 37368af..cd4e86d 100644
--- a/wifi/legacy_headers/include/hardware_legacy/wifi_nan.h
+++ b/wifi/legacy_headers/include/hardware_legacy/wifi_nan.h
@@ -477,6 +477,9 @@
     bool is_pairing_supported;
     bool is_set_cluster_id_supported;
     bool is_suspension_supported;
+    bool is_periodic_ranging_supported;
+    wifi_rtt_bw supported_bw;
+    u8 num_rx_chains_supported;
 } NanCapabilities;
 
 /*
@@ -747,6 +750,12 @@
     u32 distance_ingress_mm;
     /* Egress distance in millmilliimeters (optional) */
     u32 distance_egress_mm;
+    /* Number of FTM frames per burst */
+    u32 rtt_burst_size;
+    /* RTT Measurement Preamble */
+    wifi_rtt_preamble preamble;
+    /* Channel information */
+    wifi_channel_info channel_info;
 } NanRangingCfg;
 
 /* NAN Ranging request's response */
diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp
index 9ff1008..6213536 100644
--- a/wifi/supplicant/aidl/vts/functional/Android.bp
+++ b/wifi/supplicant/aidl/vts/functional/Android.bp
@@ -84,3 +84,9 @@
     defaults: ["supplicant_vts_test_defaults"],
     srcs: ["supplicant_p2p_network_aidl_test.cpp"],
 }
+
+cc_test {
+    name: "VtsHalWifiSupplicantTargetTest",
+    defaults: ["supplicant_vts_test_defaults"],
+    srcs: ["supplicant_aidl_test.cpp"],
+}
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_aidl_test.cpp
new file mode 100644
index 0000000..ba2aa06
--- /dev/null
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_aidl_test.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2025 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.
+ */
+
+#include <VtsCoreUtil.h>
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/wifi/supplicant/BnSupplicant.h>
+#include <android/binder_manager.h>
+#include <android/binder_status.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+#include <cutils/properties.h>
+
+#include "supplicant_test_utils.h"
+#include "wifi_aidl_test_utils.h"
+
+using aidl::android::hardware::wifi::supplicant::DebugLevel;
+using aidl::android::hardware::wifi::supplicant::IfaceInfo;
+using aidl::android::hardware::wifi::supplicant::IfaceType;
+using android::ProcessState;
+
+class SupplicantAidlTest : public testing::TestWithParam<std::string> {
+  public:
+    void SetUp() override {
+        initializeService();
+        supplicant_ = getSupplicant(GetParam().c_str());
+        ASSERT_NE(supplicant_, nullptr);
+        ASSERT_TRUE(supplicant_->setDebugParams(DebugLevel::EXCESSIVE, true, true).isOk());
+    }
+
+    void TearDown() override {
+        stopSupplicantService();
+        startWifiFramework();
+    }
+
+  protected:
+    std::shared_ptr<ISupplicant> supplicant_;
+};
+
+/*
+ * GetDebugLevel
+ */
+TEST_P(SupplicantAidlTest, GetDebugLevel) {
+    DebugLevel retrievedLevel;
+    DebugLevel expectedLevel = DebugLevel::WARNING;
+    ASSERT_TRUE(supplicant_->setDebugParams(expectedLevel, true, true).isOk());
+    ASSERT_TRUE(supplicant_->getDebugLevel(&retrievedLevel).isOk());
+    ASSERT_EQ(retrievedLevel, expectedLevel);
+}
+
+/*
+ * ListAndRemoveInterface
+ */
+TEST_P(SupplicantAidlTest, ListAndRemoveInterface) {
+    // Ensure that the STA interface exists
+    std::shared_ptr<ISupplicantStaIface> sta_iface;
+    EXPECT_TRUE(supplicant_->getStaInterface(getStaIfaceName(), &sta_iface).isOk());
+    ASSERT_NE(sta_iface, nullptr);
+
+    // Interface list should contain at least 1 interface
+    std::vector<IfaceInfo> ifaces;
+    EXPECT_TRUE(supplicant_->listInterfaces(&ifaces).isOk());
+    ASSERT_FALSE(ifaces.empty());
+    int prevNumIfaces = ifaces.size();
+
+    // Remove an interface and verify that it is removed from the list
+    EXPECT_TRUE(supplicant_->removeInterface(ifaces[0]).isOk());
+    EXPECT_TRUE(supplicant_->listInterfaces(&ifaces).isOk());
+    ASSERT_NE(ifaces.size(), prevNumIfaces);
+}
+
+/*
+ * SetConcurrencyPriority
+ */
+TEST_P(SupplicantAidlTest, SetConcurrencyPriority) {
+    // Valid values
+    ASSERT_TRUE(supplicant_->setConcurrencyPriority(IfaceType::STA).isOk());
+    ASSERT_TRUE(supplicant_->setConcurrencyPriority(IfaceType::P2P).isOk());
+
+    // Invalid value
+    ASSERT_FALSE(supplicant_->setConcurrencyPriority(static_cast<IfaceType>(2)).isOk());
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantAidlTest);
+INSTANTIATE_TEST_SUITE_P(
+        Supplicant, SupplicantAidlTest,
+        testing::ValuesIn(android::getAidlHalInstanceNames(ISupplicant::descriptor)),
+        android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    ProcessState::self()->setThreadPoolMaxThreadCount(1);
+    ProcessState::self()->startThreadPool();
+    return RUN_ALL_TESTS();
+}
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_network_aidl_test.cpp
index 165a01a..3ebdc8e 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_network_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_network_aidl_test.cpp
@@ -63,7 +63,9 @@
     }
 
     void TearDown() override {
-        EXPECT_TRUE(p2p_iface_->removeNetwork(network_id_).isOk());
+        if (p2p_iface_ != nullptr) {
+            EXPECT_TRUE(p2p_iface_->removeNetwork(network_id_).isOk());
+        }
         stopSupplicantService();
         startWifiFramework();
     }