Merge "uwb[aidl]: Added LAST_STS_INDEX_USED config into CCC open ranging params"
diff --git a/audio/aidl/common/Android.bp b/audio/aidl/common/Android.bp
index a3f7f0b..4c6a74e 100644
--- a/audio/aidl/common/Android.bp
+++ b/audio/aidl/common/Android.bp
@@ -41,6 +41,20 @@
     ],
 }
 
+cc_library {
+    name: "libaudioaidlranges",
+    host_supported: true,
+    vendor_available: true,
+    static_libs: [
+        "android.hardware.audio.effect-V1-ndk",
+    ],
+    export_include_dirs: ["include"],
+    header_libs: ["libaudioaidl_headers"],
+    srcs: [
+        "EffectRangeSpecific.cpp",
+    ],
+}
+
 cc_test {
     name: "libaudioaidlcommon_test",
     host_supported: true,
diff --git a/audio/aidl/common/EffectRangeSpecific.cpp b/audio/aidl/common/EffectRangeSpecific.cpp
new file mode 100644
index 0000000..bd78ea0
--- /dev/null
+++ b/audio/aidl/common/EffectRangeSpecific.cpp
@@ -0,0 +1,161 @@
+/*

+ * Copyright (C) 2023 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 <aidl/android/hardware/audio/effect/DynamicsProcessing.h>

+#include <aidl/android/hardware/audio/effect/Range.h>

+

+#include "EffectRangeSpecific.h"

+#include "effect-impl/EffectRange.h"

+

+namespace aidl::android::hardware::audio::effect {

+

+namespace DynamicsProcessingRanges {

+

+static bool isInputGainConfigInRange(const std::vector<DynamicsProcessing::InputGain>& cfgs,

+                                     const DynamicsProcessing::InputGain& min,

+                                     const DynamicsProcessing::InputGain& max) {

+    auto func = [](const DynamicsProcessing::InputGain& arg) {

+        return std::make_tuple(arg.channel, arg.gainDb);

+    };

+    return isTupleInRange(cfgs, min, max, func);

+}

+

+static bool isLimiterConfigInRange(const std::vector<DynamicsProcessing::LimiterConfig>& cfgs,

+                                   const DynamicsProcessing::LimiterConfig& min,

+                                   const DynamicsProcessing::LimiterConfig& max) {

+    auto func = [](const DynamicsProcessing::LimiterConfig& arg) {

+        return std::make_tuple(arg.channel, arg.enable, arg.linkGroup, arg.attackTimeMs,

+                               arg.releaseTimeMs, arg.ratio, arg.thresholdDb, arg.postGainDb);

+    };

+    return isTupleInRange(cfgs, min, max, func);

+}

+

+static bool isMbcBandConfigInRange(const std::vector<DynamicsProcessing::MbcBandConfig>& cfgs,

+                                   const DynamicsProcessing::MbcBandConfig& min,

+                                   const DynamicsProcessing::MbcBandConfig& max) {

+    auto func = [](const DynamicsProcessing::MbcBandConfig& arg) {

+        return std::make_tuple(arg.channel, arg.band, arg.enable, arg.cutoffFrequencyHz,

+                               arg.attackTimeMs, arg.releaseTimeMs, arg.ratio, arg.thresholdDb,

+                               arg.kneeWidthDb, arg.noiseGateThresholdDb, arg.expanderRatio,

+                               arg.preGainDb, arg.postGainDb);

+    };

+    return isTupleInRange(cfgs, min, max, func);

+}

+

+static bool isEqBandConfigInRange(const std::vector<DynamicsProcessing::EqBandConfig>& cfgs,

+                                  const DynamicsProcessing::EqBandConfig& min,

+                                  const DynamicsProcessing::EqBandConfig& max) {

+    auto func = [](const DynamicsProcessing::EqBandConfig& arg) {

+        return std::make_tuple(arg.channel, arg.band, arg.enable, arg.cutoffFrequencyHz,

+                               arg.gainDb);

+    };

+    return isTupleInRange(cfgs, min, max, func);

+}

+

+static bool isChannelConfigInRange(const std::vector<DynamicsProcessing::ChannelConfig>& cfgs,

+                                   const DynamicsProcessing::ChannelConfig& min,

+                                   const DynamicsProcessing::ChannelConfig& max) {

+    auto func = [](const DynamicsProcessing::ChannelConfig& arg) {

+        return std::make_tuple(arg.channel, arg.enable);

+    };

+    return isTupleInRange(cfgs, min, max, func);

+}

+

+static bool isEngineConfigInRange(const DynamicsProcessing::EngineArchitecture& cfg,

+                                  const DynamicsProcessing::EngineArchitecture& min,

+                                  const DynamicsProcessing::EngineArchitecture& max) {

+    auto func = [](const DynamicsProcessing::EngineArchitecture& arg) {

+        return std::make_tuple(arg.resolutionPreference, arg.preferredProcessingDurationMs,

+                               arg.preEqStage.inUse, arg.preEqStage.bandCount,

+                               arg.postEqStage.inUse, arg.postEqStage.bandCount, arg.mbcStage.inUse,

+                               arg.mbcStage.bandCount, arg.limiterInUse);

+    };

+    return isTupleInRange(func(cfg), func(min), func(max));

+}

+

+static int locateMinMaxForTag(DynamicsProcessing::Tag tag,

+                              const std::vector<Range::DynamicsProcessingRange>& ranges) {

+    for (int i = 0; i < (int)ranges.size(); i++) {

+        if (tag == ranges[i].min.getTag() && tag == ranges[i].max.getTag()) {

+            return i;

+        }

+    }

+    return -1;

+}

+

+bool isParamInRange(const DynamicsProcessing& dp,

+                    const std::vector<Range::DynamicsProcessingRange>& ranges) {

+    auto tag = dp.getTag();

+    int i = locateMinMaxForTag(tag, ranges);

+    if (i == -1) return true;

+

+    switch (tag) {

+        case DynamicsProcessing::engineArchitecture: {

+            return isEngineConfigInRange(

+                    dp.get<DynamicsProcessing::engineArchitecture>(),

+                    ranges[i].min.get<DynamicsProcessing::engineArchitecture>(),

+                    ranges[i].max.get<DynamicsProcessing::engineArchitecture>());

+        }

+        case DynamicsProcessing::preEq: {

+            return isChannelConfigInRange(dp.get<DynamicsProcessing::preEq>(),

+                                          ranges[i].min.get<DynamicsProcessing::preEq>()[0],

+                                          ranges[i].max.get<DynamicsProcessing::preEq>()[0]);

+        }

+        case DynamicsProcessing::postEq: {

+            return isChannelConfigInRange(dp.get<DynamicsProcessing::postEq>(),

+                                          ranges[i].min.get<DynamicsProcessing::postEq>()[0],

+                                          ranges[i].max.get<DynamicsProcessing::postEq>()[0]);

+        }

+        case DynamicsProcessing::mbc: {

+            return isChannelConfigInRange(dp.get<DynamicsProcessing::mbc>(),

+                                          ranges[i].min.get<DynamicsProcessing::mbc>()[0],

+                                          ranges[i].max.get<DynamicsProcessing::mbc>()[0]);

+        }

+        case DynamicsProcessing::preEqBand: {

+            return isEqBandConfigInRange(dp.get<DynamicsProcessing::preEqBand>(),

+                                         ranges[i].min.get<DynamicsProcessing::preEqBand>()[0],

+                                         ranges[i].max.get<DynamicsProcessing::preEqBand>()[0]);

+        }

+        case DynamicsProcessing::postEqBand: {

+            return isEqBandConfigInRange(dp.get<DynamicsProcessing::postEqBand>(),

+                                         ranges[i].min.get<DynamicsProcessing::postEqBand>()[0],

+                                         ranges[i].max.get<DynamicsProcessing::postEqBand>()[0]);

+        }

+        case DynamicsProcessing::mbcBand: {

+            return isMbcBandConfigInRange(dp.get<DynamicsProcessing::mbcBand>(),

+                                          ranges[i].min.get<DynamicsProcessing::mbcBand>()[0],

+                                          ranges[i].max.get<DynamicsProcessing::mbcBand>()[0]);

+        }

+        case DynamicsProcessing::limiter: {

+            return isLimiterConfigInRange(dp.get<DynamicsProcessing::limiter>(),

+                                          ranges[i].min.get<DynamicsProcessing::limiter>()[0],

+                                          ranges[i].max.get<DynamicsProcessing::limiter>()[0]);

+        }

+        case DynamicsProcessing::inputGain: {

+            return isInputGainConfigInRange(dp.get<DynamicsProcessing::inputGain>(),

+                                            ranges[i].min.get<DynamicsProcessing::inputGain>()[0],

+                                            ranges[i].max.get<DynamicsProcessing::inputGain>()[0]);

+        }

+        default: {

+            return true;

+        }

+    }

+    return true;

+}

+

+}  // namespace DynamicsProcessingRanges

+

+}  // namespace aidl::android::hardware::audio::effect
\ No newline at end of file
diff --git a/audio/aidl/common/include/EffectRangeSpecific.h b/audio/aidl/common/include/EffectRangeSpecific.h
new file mode 100644
index 0000000..c7262bb
--- /dev/null
+++ b/audio/aidl/common/include/EffectRangeSpecific.h
@@ -0,0 +1,28 @@
+/*

+ * Copyright (C) 2023 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.

+ */

+

+#pragma once

+

+namespace aidl::android::hardware::audio::effect {

+

+namespace DynamicsProcessingRanges {

+

+bool isParamInRange(const DynamicsProcessing& dp,

+                    const std::vector<Range::DynamicsProcessingRange>& ranges);

+

+}  // namespace DynamicsProcessingRanges

+

+}  // namespace aidl::android::hardware::audio::effect
\ No newline at end of file
diff --git a/audio/aidl/default/include/effect-impl/EffectRange.h b/audio/aidl/default/include/effect-impl/EffectRange.h
new file mode 100644
index 0000000..a3ea01f
--- /dev/null
+++ b/audio/aidl/default/include/effect-impl/EffectRange.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+#pragma once
+
+#include <algorithm>
+#include <tuple>
+#include <utility>
+#include <vector>
+
+namespace aidl::android::hardware::audio::effect {
+
+template <typename T>
+bool isInRange(const T& value, const T& low, const T& high) {
+    return (value >= low) && (value <= high);
+}
+
+template <typename T, std::size_t... Is>
+bool isTupleInRange(const T& test, const T& min, const T& max, std::index_sequence<Is...>) {
+    return (isInRange(std::get<Is>(test), std::get<Is>(min), std::get<Is>(max)) && ...);
+}
+
+template <typename T, std::size_t TupSize = std::tuple_size_v<T>>
+bool isTupleInRange(const T& test, const T& min, const T& max) {
+    return isTupleInRange(test, min, max, std::make_index_sequence<TupSize>{});
+}
+
+template <typename T, typename F>
+bool isTupleInRange(const std::vector<T>& cfgs, const T& min, const T& max, const F& func) {
+    auto minT = func(min), maxT = func(max);
+    return std::all_of(cfgs.cbegin(), cfgs.cend(),
+                       [&](const T& cfg) { return isTupleInRange(func(cfg), minT, maxT); });
+}
+
+}  // namespace aidl::android::hardware::audio::effect
diff --git a/automotive/occupant_awareness/aidl/default/Android.bp b/automotive/occupant_awareness/aidl/default/Android.bp
index 66af9de..1ae8689 100644
--- a/automotive/occupant_awareness/aidl/default/Android.bp
+++ b/automotive/occupant_awareness/aidl/default/Android.bp
@@ -26,6 +26,7 @@
 cc_binary {
     name: "android.hardware.automotive.occupant_awareness@1.0-service",
     init_rc: ["android.hardware.automotive.occupant_awareness@1.0-service.rc"],
+    vintf_fragments: ["android.hardware.automotive.occupant_awareness-service.xml"],
     relative_install_path: "hw",
     vendor: true,
     srcs: [
diff --git a/automotive/occupant_awareness/aidl/default/android.hardware.automotive.occupant_awareness-service.xml b/automotive/occupant_awareness/aidl/default/android.hardware.automotive.occupant_awareness-service.xml
new file mode 100644
index 0000000..b4f8fa5
--- /dev/null
+++ b/automotive/occupant_awareness/aidl/default/android.hardware.automotive.occupant_awareness-service.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+    <hal format="aidl">
+        <name>android.hardware.automotive.occupant_awareness</name>
+        <version>1</version>
+        <fqname>IOccupantAwareness/default</fqname>
+    </hal>
+</manifest>
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index 3907f57..64e51c7 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -447,6 +447,7 @@
                                               const int numMeasurementEvents,
                                               const int timeoutSeconds,
                                               std::vector<int>& deltasMs) {
+    callback->gnss_data_cbq_.reset();  // throw away the initial measurements if any
     int64_t lastElapsedRealtimeMillis = 0;
     for (int i = 0; i < numMeasurementEvents; i++) {
         GnssData lastGnssData;
diff --git a/identity/OWNERS b/identity/OWNERS
index 6969910..9353bbc 100644
--- a/identity/OWNERS
+++ b/identity/OWNERS
@@ -1,2 +1,4 @@
+# Bug component: 1084909
+
 swillden@google.com
 zeuthen@google.com
diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp
index d8a5a87..6f7ab54 100644
--- a/identity/aidl/vts/Android.bp
+++ b/identity/aidl/vts/Android.bp
@@ -61,15 +61,3 @@
     ],
     require_root: true,
 }
-
-java_test_host {
-    name: "IdentityCredentialImplementedTest",
-    libs: [
-        "tradefed",
-    ],
-    srcs: ["src/**/*.java"],
-    test_suites: [
-        "vts",
-    ],
-    test_config: "IdentityCredentialImplementedTest.xml",
-}
diff --git a/identity/aidl/vts/IdentityCredentialImplementedTest.xml b/identity/aidl/vts/IdentityCredentialImplementedTest.xml
deleted file mode 100644
index 4276ae6..0000000
--- a/identity/aidl/vts/IdentityCredentialImplementedTest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2022 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<configuration description="Runs IdentityCredentialImplementedTest">
-  <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
-
-  <test class="com.android.tradefed.testtype.HostTest" >
-    <option name="jar" value="IdentityCredentialImplementedTest.jar" />
-  </test>
-</configuration>
diff --git a/identity/aidl/vts/src/com/android/tests/security/identity/IdentityCredentialImplementedTest.java b/identity/aidl/vts/src/com/android/tests/security/identity/IdentityCredentialImplementedTest.java
deleted file mode 100644
index 4936f8c..0000000
--- a/identity/aidl/vts/src/com/android/tests/security/identity/IdentityCredentialImplementedTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.tests.security.identity;
-
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import android.platform.test.annotations.RequiresDevice;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-// This is a host-test which executes shell commands on the device. It would be
-// nicer to have this be a Device test (like CTS) but this is currently not
-// possible, see https://source.android.com/docs/core/tests/vts
-
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class IdentityCredentialImplementedTest extends BaseHostJUnit4Test {
-    // Returns the ro.vendor.api_level or 0 if not set.
-    //
-    // Throws NumberFormatException if ill-formatted.
-    //
-    // Throws DeviceNotAvailableException if device is not available.
-    //
-    private int getVendorApiLevel() throws NumberFormatException, DeviceNotAvailableException {
-        String vendorApiLevelString =
-                getDevice().executeShellCommand("getprop ro.vendor.api_level").trim();
-        if (vendorApiLevelString.isEmpty()) {
-            return 0;
-        }
-        return Integer.parseInt(vendorApiLevelString);
-    }
-
-    // As of Android 14 VSR (vendor API level 34), Identity Credential is required at feature
-    // version 202301 or later.
-    @RequiresDevice
-    @Test
-    public void testIdentityCredentialIsImplemented() throws Exception {
-        int vendorApiLevel = getVendorApiLevel();
-        assumeTrue(vendorApiLevel >= 34);
-
-        final String minimumFeatureVersionNeeded = "202301";
-
-        String result = getDevice().executeShellCommand(
-                "pm has-feature android.hardware.identity_credential "
-                + minimumFeatureVersionNeeded);
-        if (!result.trim().equals("true")) {
-            fail("Identity Credential feature version " + minimumFeatureVersionNeeded
-                    + " required but not found");
-        }
-    }
-}
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 7214234..23e2192 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -467,16 +467,16 @@
         case 3:
             if (isTeeDeviceInfo(*parsed) && parsed->size() != kNumTeeDeviceInfoEntries) {
                 error += fmt::format(
-                        "Err: Incorrect number of device info entries. Expected {} but got"
+                        "Err: Incorrect number of device info entries. Expected {} but got "
                         "{}\n",
                         kNumTeeDeviceInfoEntries, parsed->size());
             }
             // TEE IRPC instances require all entries to be present in DeviceInfo. Non-TEE instances
             // may omit `os_version`
-            if (!isTeeDeviceInfo(*parsed) && (parsed->size() != kNumTeeDeviceInfoEntries ||
+            if (!isTeeDeviceInfo(*parsed) && (parsed->size() != kNumTeeDeviceInfoEntries &&
                                               parsed->size() != kNumTeeDeviceInfoEntries - 1)) {
                 error += fmt::format(
-                        "Err: Incorrect number of device info entries. Expected {} or {} but got"
+                        "Err: Incorrect number of device info entries. Expected {} or {} but got "
                         "{}\n",
                         kNumTeeDeviceInfoEntries - 1, kNumTeeDeviceInfoEntries, parsed->size());
             }
diff --git a/security/rkp/CHANGELOG.md b/security/rkp/CHANGELOG.md
index 9409a6d..f425284 100644
--- a/security/rkp/CHANGELOG.md
+++ b/security/rkp/CHANGELOG.md
@@ -31,7 +31,7 @@
 * IRemotelyProvisionedComponent
   * The need for an EEK has been removed. There is no longer an encrypted portion of the CSR.
   * Keys for new CSR format must be generated with test mode set to false, effectively removing test
-    mode in the new CSR flow. Old behavior is kept unchanged for backwards compatibility.
+    mode in the new CSR flow.
   * The schema for the CSR itself has been significantly simplified, please see
     IRemotelyProvisionedComponent.aidl for more details. Notably,
     * the chain of signing, MACing, and encryption operations has been replaced with a single
diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
index 35b83dd..7960c7f 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
@@ -144,9 +144,9 @@
     byte[] generateEcdsaP256KeyPair(in boolean testMode, out MacedPublicKey macedPublicKey);
 
     /**
-     * This method can be removed in version 3 of the HAL. The header is kept around for
-     * backwards compatibility purposes. From v3, this method is allowed to raise a
-     * ServiceSpecificException with an error code of STATUS_REMOVED.
+     * This method has been deprecated since version 3 of the HAL. The header is kept around for
+     * backwards compatibility purposes. From v3, this method must raise a ServiceSpecificException
+     * with an error code of STATUS_REMOVED.
      *
      * For v1 and v2 implementations:
      * generateCertificateRequest creates a certificate request to be sent to the provisioning
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index bf40976..9f68bfa 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -408,16 +408,8 @@
         ASSERT_FALSE(HasFatalFailure());
 
         if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) {
-            bytevec keysToSignMac;
-            DeviceInfo deviceInfo;
-            ProtectedData protectedData;
-            auto status = provisionable_->generateCertificateRequest(
-                    false, {}, {}, {}, &deviceInfo, &protectedData, &keysToSignMac);
-            if (!status.isOk() && (status.getServiceSpecificError() ==
-                                   BnRemotelyProvisionedComponent::STATUS_REMOVED)) {
-                GTEST_SKIP() << "This test case applies to RKP v3+ only if "
-                             << "generateCertificateRequest() is implemented.";
-            }
+            GTEST_SKIP() << "This test case only applies to RKP v1 and v2. "
+                         << "RKP version discovered: " << rpcHardwareInfo.versionNumber;
         }
     }
 };
@@ -798,6 +790,20 @@
               BnRemotelyProvisionedComponent::STATUS_TEST_KEY_IN_PRODUCTION_REQUEST);
 }
 
+/**
+ * Call generateCertificateRequest(). Make sure it's removed.
+ */
+TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed) {
+    bytevec keysToSignMac;
+    DeviceInfo deviceInfo;
+    ProtectedData protectedData;
+    auto status = provisionable_->generateCertificateRequest(
+            true /* testMode */, {} /* keysToSign */, {} /* EEK chain */, challenge_, &deviceInfo,
+            &protectedData, &keysToSignMac);
+    ASSERT_FALSE(status.isOk()) << status.getMessage();
+    EXPECT_EQ(status.getServiceSpecificError(), BnRemotelyProvisionedComponent::STATUS_REMOVED);
+}
+
 void parse_root_of_trust(const vector<uint8_t>& attestation_cert,
                          vector<uint8_t>* verified_boot_key, VerifiedBoot* verified_boot_state,
                          bool* device_locked, vector<uint8_t>* verified_boot_hash) {