Merge "ExternalCameraHAL: dup fd when creating AIDL NativeHandle" into main
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
index 9451087..63d04c2 100644
--- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
+++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
@@ -43,6 +43,8 @@
 
 #define HCI_MINIMUM_HCI_VERSION 5  // Bluetooth Core Specification 3.0 + HS
 #define HCI_MINIMUM_LMP_VERSION 5  // Bluetooth Core Specification 3.0 + HS
+#define HCI_BLUETOOTH4_2_HCI_VERSION 8 // Bluetooth 4.2
+#define HCI_BLUETOOTH4_2_LMP_VERSION 8 // Bluetooth 4.2
 #define NUM_HCI_COMMANDS_BANDWIDTH 1000
 #define NUM_SCO_PACKETS_BANDWIDTH 1000
 #define NUM_ACL_PACKETS_BANDWIDTH 1000
@@ -52,6 +54,7 @@
 #define WAIT_FOR_ACL_DATA_TIMEOUT std::chrono::milliseconds(1000)
 #define INTERFACE_CLOSE_DELAY_MS std::chrono::milliseconds(600)
 
+// { OCF, OGF << 2, Length of command parameters}
 #define COMMAND_HCI_SHOULD_BE_UNKNOWN \
   { 0xff, 0x3B, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }
 #define COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION \
@@ -64,6 +67,10 @@
   { 0x03, 0x0c, 0x00 }
 #define COMMAND_HCI_WRITE_LOCAL_NAME \
   { 0x13, 0x0c, 0xf8 }
+#define COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES \
+  { 0x03, 0x04 << 2, 0x00 } // OGF=0x04, OCF=0x0003 / 7.4 INFORMATIONAL PARAMETERS
+#define COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES \
+  { 0x03, 0x08 << 2, 0x00 } // OGF=0x08, OCF=0x0003 / 7.8 LE CONTROLLER COMMANDS
 #define HCI_STATUS_SUCCESS 0x00
 #define HCI_STATUS_UNKNOWN_HCI_COMMAND 0x01
 
@@ -85,6 +92,30 @@
 #define EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE 6
 #define EVENT_LOCAL_HCI_VERSION_BYTE EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE
 #define EVENT_LOCAL_LMP_VERSION_BYTE EVENT_LOCAL_HCI_VERSION_BYTE + 3
+/**
+ * See Bluetooth Spec 5.4, Vol 2, Part C
+ * Link Manager Protocol, 3.3 Feature Mask Definition
+ *
+ * No  | Supported Feature           | Byte | Bit | Page
+ * ...
+ * 38  | LE Supported (Controller)   | 4    | 6   | 0
+ * ...
+ */
+#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE \
+  (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x04)
+#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK (0x01 << 6)
+/**
+ * See Bluetooth Spec 5.4, Vol 6, Part B
+ * 4.6 Feature Support
+ *
+ * Bit | Link Layer Feature
+ * ...
+ * 5   | LE Data Packet Length Extension
+ * ...
+ */
+#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE \
+  (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x00)
+#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK (0x01 << 5)
 
 #define EVENT_CONNECTION_COMPLETE_PARAM_LENGTH 11
 #define EVENT_CONNECTION_COMPLETE_TYPE 11
@@ -209,7 +240,7 @@
                          std::vector<uint16_t>& acl_handles);
   void handle_no_ops();
   void wait_for_event(bool timeout_is_error);
-  void wait_for_command_complete_event(hidl_vec<uint8_t> cmd);
+  hidl_vec<uint8_t> wait_for_command_complete_event(hidl_vec<uint8_t> cmd);
   int wait_for_completed_packets_event(uint16_t handle);
 
   class BluetoothHciDeathRecipient : public hidl_death_recipient {
@@ -338,17 +369,19 @@
 }
 
 // Wait until a COMMAND_COMPLETE is received.
-void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
+hidl_vec<uint8_t> BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
   wait_for_event();
   hidl_vec<uint8_t> event = event_queue.front();
   event_queue.pop();
 
-  ASSERT_GT(event.size(),
+  EXPECT_GT(event.size(),
             static_cast<size_t>(EVENT_COMMAND_COMPLETE_STATUS_BYTE));
-  ASSERT_EQ(EVENT_COMMAND_COMPLETE, event[EVENT_CODE_BYTE]);
-  ASSERT_EQ(cmd[0], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE]);
-  ASSERT_EQ(cmd[1], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE + 1]);
-  ASSERT_EQ(HCI_STATUS_SUCCESS, event[EVENT_COMMAND_COMPLETE_STATUS_BYTE]);
+  EXPECT_EQ(EVENT_COMMAND_COMPLETE, event[EVENT_CODE_BYTE]);
+  EXPECT_EQ(cmd[0], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE]);
+  EXPECT_EQ(cmd[1], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE + 1]);
+  EXPECT_EQ(HCI_STATUS_SUCCESS, event[EVENT_COMMAND_COMPLETE_STATUS_BYTE]);
+
+  return event;
 }
 
 // Send the command to read the controller's buffer sizes.
@@ -623,6 +656,36 @@
   ASSERT_LE(HCI_MINIMUM_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]);
 }
 
+/**
+ * Requirements
+ *
+ * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension.
+ * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE).
+ */
+TEST_P(BluetoothHidlTest, Bluetooth4_2) {
+  // Bluetooth 4.2+
+  hidl_vec<uint8_t> cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION;
+  bluetooth->sendHciCommand(cmd);
+  auto event = wait_for_command_complete_event(cmd);
+
+  EXPECT_LE(HCI_BLUETOOTH4_2_HCI_VERSION, event[EVENT_LOCAL_HCI_VERSION_BYTE]);
+  EXPECT_LE(HCI_BLUETOOTH4_2_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]);
+
+  // BLE
+  cmd = COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES;
+  bluetooth->sendHciCommand(cmd);
+  event = wait_for_command_complete_event(cmd);
+  EXPECT_TRUE(event[EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE] &
+    EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK);
+
+  // BLE Data Length Extension
+  cmd = COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES;
+  bluetooth->sendHciCommand(cmd);
+  event = wait_for_command_complete_event(cmd);
+  EXPECT_TRUE(event[EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE] &
+    EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK);
+}
+
 // Send an unknown HCI command and wait for the error message.
 TEST_P(BluetoothHidlTest, HciUnknownCommand) {
   hidl_vec<uint8_t> cmd = COMMAND_HCI_SHOULD_BE_UNKNOWN;
diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
index 28ac603..5a455bf 100644
--- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
+++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
@@ -43,6 +43,8 @@
 
 #define HCI_MINIMUM_HCI_VERSION 5  // Bluetooth Core Specification 3.0 + HS
 #define HCI_MINIMUM_LMP_VERSION 5  // Bluetooth Core Specification 3.0 + HS
+#define HCI_BLUETOOTH4_2_HCI_VERSION 8 // Bluetooth 4.2
+#define HCI_BLUETOOTH4_2_LMP_VERSION 8 // Bluetooth 4.2
 #define NUM_HCI_COMMANDS_BANDWIDTH 1000
 #define NUM_SCO_PACKETS_BANDWIDTH 1000
 #define NUM_ACL_PACKETS_BANDWIDTH 1000
@@ -52,6 +54,7 @@
 #define WAIT_FOR_ACL_DATA_TIMEOUT std::chrono::milliseconds(1000)
 #define INTERFACE_CLOSE_DELAY_MS std::chrono::milliseconds(200)
 
+// { OCF, OGF << 2, Length of bytes of command parameters }
 #define COMMAND_HCI_SHOULD_BE_UNKNOWN \
   { 0xff, 0x3B, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }
 #define COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION \
@@ -64,6 +67,10 @@
   { 0x03, 0x0c, 0x00 }
 #define COMMAND_HCI_WRITE_LOCAL_NAME \
   { 0x13, 0x0c, 0xf8 }
+#define COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES \
+  { 0x03, 0x04 << 2, 0x00 } // OGF=0x04, OCF=0x0003 / 7.4 INFORMATIONAL PARAMETERS
+#define COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES \
+  { 0x03, 0x08 << 2, 0x00 } // OGF=0x08, OCF=0x0003 / 7.8 LE CONTROLLER COMMANDS
 #define HCI_STATUS_SUCCESS 0x00
 #define HCI_STATUS_UNKNOWN_HCI_COMMAND 0x01
 
@@ -85,6 +92,30 @@
 #define EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE 6
 #define EVENT_LOCAL_HCI_VERSION_BYTE EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE
 #define EVENT_LOCAL_LMP_VERSION_BYTE EVENT_LOCAL_HCI_VERSION_BYTE + 3
+/**
+ * See Bluetooth Spec 5.4, Vol 2, Part C
+ * Link Manager Protocol, 3.3 Feature Mask Definition
+ *
+ * No  | Supported Feature           | Byte | Bit | Page
+ * ...
+ * 38  | LE Supported (Controller)   | 4    | 6   | 0
+ * ...
+ */
+#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE \
+  (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x04)
+#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK (0x01 << 6)
+/**
+ * See Bluetooth Spec 5.4, Vol 6, Part B
+ * 4.6 Feature Support
+ *
+ * Bit | Link Layer Feature
+ * ...
+ * 5   | LE Data Packet Length Extension
+ * ...
+ */
+#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE \
+  (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x00)
+#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK (0x01 << 5)
 
 #define EVENT_CONNECTION_COMPLETE_PARAM_LENGTH 11
 #define EVENT_CONNECTION_COMPLETE_TYPE 11
@@ -211,7 +242,7 @@
                          std::vector<uint16_t>* acl_handles);
   void handle_no_ops();
   void wait_for_event(bool timeout_is_error);
-  void wait_for_command_complete_event(hidl_vec<uint8_t> cmd);
+  hidl_vec<uint8_t> wait_for_command_complete_event(hidl_vec<uint8_t> cmd);
   int wait_for_completed_packets_event(uint16_t handle);
 
   class BluetoothHciDeathRecipient : public hidl_death_recipient {
@@ -350,7 +381,7 @@
 }
 
 // Wait until a COMMAND_COMPLETE is received.
-void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
+hidl_vec<uint8_t> BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
   wait_for_event();
   hidl_vec<uint8_t> event = event_queue.front();
   event_queue.pop();
@@ -361,6 +392,8 @@
   EXPECT_EQ(cmd[0], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE]);
   EXPECT_EQ(cmd[1], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE + 1]);
   EXPECT_EQ(HCI_STATUS_SUCCESS, event[EVENT_COMMAND_COMPLETE_STATUS_BYTE]);
+
+  return event;
 }
 
 // Send the command to read the controller's buffer sizes.
@@ -646,6 +679,36 @@
   EXPECT_LE(HCI_MINIMUM_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]);
 }
 
+/**
+ * Requirements
+ *
+ * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension.
+ * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE).
+ */
+TEST_P(BluetoothHidlTest, Bluetooth4_2) {
+  // Bluetooth 4.2+
+  hidl_vec<uint8_t> cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION;
+  bluetooth->sendHciCommand(cmd);
+  auto event = wait_for_command_complete_event(cmd);
+
+  EXPECT_LE(HCI_BLUETOOTH4_2_HCI_VERSION, event[EVENT_LOCAL_HCI_VERSION_BYTE]);
+  EXPECT_LE(HCI_BLUETOOTH4_2_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]);
+
+  // BLE
+  cmd = COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES;
+  bluetooth->sendHciCommand(cmd);
+  event = wait_for_command_complete_event(cmd);
+  EXPECT_TRUE(event[EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE] &
+    EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK);
+
+  // BLE Data Length Extension
+  cmd = COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES;
+  bluetooth->sendHciCommand(cmd);
+  event = wait_for_command_complete_event(cmd);
+  EXPECT_TRUE(event[EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE] &
+    EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK);
+}
+
 // Send an unknown HCI command and wait for the error message.
 TEST_P(BluetoothHidlTest, HciUnknownCommand) {
   hidl_vec<uint8_t> cmd = COMMAND_HCI_SHOULD_BE_UNKNOWN;
diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
index 395e4cc..30aa642 100644
--- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
+++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
@@ -118,6 +118,10 @@
          testing::deviceSupportsFeature("android.hardware.type.television");
 }
 
+static bool isHandheld() {
+  return testing::deviceSupportsFeature("android.hardware.type.handheld");
+}
+
 class ThroughputLogger {
  public:
   explicit ThroughputLogger(std::string task)
@@ -1050,6 +1054,47 @@
   ASSERT_GE(num_resolving_list, kMinLeResolvingListForBt5);
 }
 
+/**
+ * Requirements
+ *
+ * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension.
+ * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE).
+ */
+TEST_P(BluetoothAidlTest, Vsr_Bluetooth4_2Requirements) {
+  // test only applies to handheld devices
+  if (!isHandheld()) {
+    return;
+  }
+
+  std::vector<uint8_t> version_event;
+  send_and_wait_for_cmd_complete(ReadLocalVersionInformationBuilder::Create(),
+                                 version_event);
+  auto version_view = ReadLocalVersionInformationCompleteView::Create(
+      CommandCompleteView::Create(EventView::Create(PacketView<true>(
+          std::make_shared<std::vector<uint8_t>>(version_event)))));
+  ASSERT_TRUE(version_view.IsValid());
+  ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, version_view.GetStatus());
+  auto version = version_view.GetLocalVersionInformation();
+  // Starting with Android 15, Fails when HCI version is lower than 4.2.
+  ASSERT_GE(static_cast<int>(version.hci_version_),
+    static_cast<int>(::bluetooth::hci::HciVersion::V_4_2));
+  ASSERT_GE(static_cast<int>(version.lmp_version_),
+    static_cast<int>(::bluetooth::hci::LmpVersion::V_4_2));
+
+  std::vector<uint8_t> le_features_event;
+  send_and_wait_for_cmd_complete(LeReadLocalSupportedFeaturesBuilder::Create(),
+                                 le_features_event);
+  auto le_features_view = LeReadLocalSupportedFeaturesCompleteView::Create(
+      CommandCompleteView::Create(EventView::Create(PacketView<true>(
+          std::make_shared<std::vector<uint8_t>>(le_features_event)))));
+  ASSERT_TRUE(le_features_view.IsValid());
+  ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, le_features_view.GetStatus());
+  auto le_features = le_features_view.GetLeFeatures();
+  ASSERT_TRUE(le_features &
+              static_cast<uint64_t>(LLFeaturesBits::LE_EXTENDED_ADVERTISING));
+
+}
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BluetoothAidlTest);
 INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAidlTest,
                          testing::ValuesIn(android::getAidlHalInstanceNames(
diff --git a/security/keymint/support/include/remote_prov/remote_prov_utils.h b/security/keymint/support/include/remote_prov/remote_prov_utils.h
index b8c69eb..1d7db6a 100644
--- a/security/keymint/support/include/remote_prov/remote_prov_utils.h
+++ b/security/keymint/support/include/remote_prov/remote_prov_utils.h
@@ -183,4 +183,7 @@
         const cppbor::Array& keysToSign, const std::vector<uint8_t>& csr,
         IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge);
 
+/** Checks whether the CSR has a proper DICE chain. */
+ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& csr);
+
 }  // namespace aidl::android::hardware::security::keymint::remote_prov
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index a830041..b74fd59 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -1081,4 +1081,40 @@
     return verifyCsr(keysToSign, csr, provisionable, challenge, /*isFactory=*/false);
 }
 
+ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& csr) {
+    auto [parsedRequest, _, csrErrMsg] = cppbor::parse(csr);
+    if (!parsedRequest) {
+        return csrErrMsg;
+    }
+    if (!parsedRequest->asArray()) {
+        return "AuthenticatedRequest is not a CBOR array.";
+    }
+    if (parsedRequest->asArray()->size() != 4U) {
+        return "AuthenticatedRequest must contain version, UDS certificates, DICE chain, and "
+               "signed data. However, the parsed AuthenticatedRequest has " +
+               std::to_string(parsedRequest->asArray()->size()) + " entries.";
+    }
+
+    auto version = parsedRequest->asArray()->get(0)->asUint();
+    auto diceCertChain = parsedRequest->asArray()->get(2)->asArray();
+
+    if (!version || version->value() != 1U) {
+        return "AuthenticatedRequest version must be an unsigned integer and must be equal to 1.";
+    }
+    if (!diceCertChain) {
+        return "AuthenticatedRequest DiceCertChain must be an Array.";
+    }
+
+    // DICE chain is [ pubkey, + DiceChainEntry ].
+    auto diceChainKind = getDiceChainKind();
+    if (!diceChainKind) {
+        return diceChainKind.message();
+    }
+
+    auto encodedDiceChain = diceCertChain->encode();
+    auto chain = hwtrust::DiceChain::Verify(encodedDiceChain, *diceChainKind);
+    if (!chain.ok()) return chain.error().message();
+    return chain->IsProper();
+}
+
 }  // namespace aidl::android::hardware::security::keymint::remote_prov
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 68b966c..2a8fd96 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -55,8 +55,12 @@
 
 constexpr uint8_t MIN_CHALLENGE_SIZE = 0;
 constexpr uint8_t MAX_CHALLENGE_SIZE = 64;
+const string DEFAULT_INSTANCE_NAME =
+        "android.hardware.security.keymint.IRemotelyProvisionedComponent/default";
 const string RKP_VM_INSTANCE_NAME =
         "android.hardware.security.keymint.IRemotelyProvisionedComponent/avf";
+const string KEYMINT_STRONGBOX_INSTANCE_NAME =
+        "android.hardware.security.keymint.IKeyMintDevice/strongbox";
 
 #define INSTANTIATE_REM_PROV_AIDL_TEST(name)                                         \
     GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(name);                             \
@@ -230,6 +234,37 @@
     }
 }
 
+/**
+ * Verify that the default implementation supports DICE if there is a StrongBox KeyMint instance
+ * on the device.
+ */
+// @VsrTest = 3.10-015
+TEST(NonParameterizedTests, requireDiceOnDefaultInstanceIfStrongboxPresent) {
+    int vsr_api_level = get_vsr_api_level();
+    if (vsr_api_level < 35) {
+        GTEST_SKIP() << "Applies only to VSR API level 35 or newer, this device is: "
+                     << vsr_api_level;
+    }
+
+    if (!AServiceManager_isDeclared(KEYMINT_STRONGBOX_INSTANCE_NAME.c_str())) {
+        GTEST_SKIP() << "Strongbox is not present on this device.";
+    }
+
+    ::ndk::SpAIBinder binder(AServiceManager_waitForService(DEFAULT_INSTANCE_NAME.c_str()));
+    std::shared_ptr<IRemotelyProvisionedComponent> rpc =
+            IRemotelyProvisionedComponent::fromBinder(binder);
+    ASSERT_NE(rpc, nullptr);
+
+    bytevec challenge = randomBytes(64);
+    bytevec csr;
+    auto status = rpc->generateCertificateRequestV2({} /* keysToSign */, challenge, &csr);
+    EXPECT_TRUE(status.isOk()) << status.getDescription();
+
+    auto result = isCsrWithProperDiceChain(csr);
+    ASSERT_TRUE(result) << result.message();
+    ASSERT_TRUE(*result);
+}
+
 using GetHardwareInfoTests = VtsRemotelyProvisionedComponentTests;
 
 INSTANTIATE_REM_PROV_AIDL_TEST(GetHardwareInfoTests);