Bluetooth HCI: Add VTS requirement for HCI 4.2
Bug: 285456310
Test: atest VtsHalBluetoothTargetTest
Change-Id: I056b924543ac349beb9b0eddaf039b0aa9187821
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(