From f506e2dc47e9b72ddde5a89aadbe98eed7d3d7af Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Wed, 18 Sep 2024 21:51:39 +0000 Subject: [PATCH] VtsHalBluetoothTargetTest: Check API level compatibility The following requirements apply only when the support API level is lower than 34: - [VSR-5.3.14-001] - [VSR-5.3.14-002] - [VSR-5.3.14-004] Bug: 297818112 Test: atest VtsHalBluetoothTargetTest Change-Id: I278681dfd9c30647110c55634d6e324786c48d73 --- .../aidl/vts/VtsHalBluetoothTargetTest.cpp | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp index dcb5fac53c..fcf1649bf7 100644 --- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp +++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp @@ -988,7 +988,16 @@ TEST_P(BluetoothAidlTest, CallInitializeTwice) { ASSERT_EQ(status, std::future_status::ready); } +// @VsrTest = 5.3.14-001 +// @VsrTest = 5.3.14-002 +// @VsrTest = 5.3.14-004 TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { + int api_level = get_vsr_api_level(); + if (api_level < __ANDROID_API_U__) { + GTEST_SKIP() << "API level is lower than 34"; + return; + } + std::vector version_event; send_and_wait_for_cmd_complete(ReadLocalVersionInformationBuilder::Create(), version_event); @@ -998,10 +1007,12 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { ASSERT_TRUE(version_view.IsValid()); ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, version_view.GetStatus()); auto version = version_view.GetLocalVersionInformation(); + if (version.hci_version_ < ::bluetooth::hci::HciVersion::V_5_0) { - // This test does not apply to controllers below 5.0 + GTEST_SKIP() << "Bluetooth version is lower than 5.0"; return; - }; + } + // When HCI version is 5.0, LMP version must also be at least 5.0 ASSERT_GE(static_cast(version.lmp_version_), static_cast(version.hci_version_)); @@ -1014,6 +1025,16 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { std::make_shared>(le_features_event))))); ASSERT_TRUE(le_features_view.IsValid()); ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, le_features_view.GetStatus()); + + // CHIPSETs that set ro.board.api_level to 34 and report 5.0 or higher for + // the Bluetooth version through the IBluetoothHci HAL: + // + // [VSR-5.3.14-001] Must return TRUE for + // - LE 2M PHY + // - LE Coded PHY + // - LE Advertising Extension + // - LE Periodic Advertising + // - LE Link Layer Privacy auto le_features = le_features_view.GetLeFeatures(); ASSERT_TRUE(le_features & static_cast(LLFeaturesBits::LL_PRIVACY)); ASSERT_TRUE(le_features & static_cast(LLFeaturesBits::LE_2M_PHY)); @@ -1021,6 +1042,8 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { static_cast(LLFeaturesBits::LE_CODED_PHY)); ASSERT_TRUE(le_features & static_cast(LLFeaturesBits::LE_EXTENDED_ADVERTISING)); + ASSERT_TRUE(le_features & + static_cast(LLFeaturesBits::LE_PERIODIC_ADVERTISING)); std::vector num_adv_set_event; send_and_wait_for_cmd_complete( @@ -1034,6 +1057,10 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, num_adv_set_view.GetStatus()); auto num_adv_set = num_adv_set_view.GetNumberSupportedAdvertisingSets(); + // CHIPSETs that set ro.board.api_level to 34 and report 5.0 or higher for + // the Bluetooth version through the IBluetoothHci HAL: + // + // [VSR-5.3.14-002] MUST support at least 10 advertising sets. if (isTv() && get_vsr_api_level() == __ANDROID_API_U__) { ASSERT_GE(num_adv_set, kMinLeAdvSetForBt5ForTv); } else { @@ -1050,6 +1077,11 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, num_resolving_list_view.GetStatus()); auto num_resolving_list = num_resolving_list_view.GetResolvingListSize(); + + // CHIPSETs that set ro.board.api_level to 34 and report 5.0 or higher for + // the Bluetooth version through the IBluetoothHci HAL: + // + // [VSR-5.3.14-004] MUST support a resolving list size of at least 8 entries. ASSERT_GE(num_resolving_list, kMinLeResolvingListForBt5); }