From 334bf18f8d45703828bae262a7c8af5fee999e6a Mon Sep 17 00:00:00 2001 From: Jakub Tyszkowski Date: Mon, 8 Jan 2024 13:43:27 +0000 Subject: [PATCH 1/4] Skip unsupported functinality tests Instead of silently passing the tests when some functionality is not supported, mark these tests as skipped. This way, when we are sure that some functionality should be verified in a particular test run, we are not being falsely reported that all have passed successfully while in reality, there's an actuall issue in the particular functionality detection mechanism. Bug: 319090769 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: I8589ef14abfb5af641bc98949de1e1acc21efe1a --- .../vts/VtsHalBluetoothAudioTargetTest.cpp | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp index 88f2f97e28..bdcfbd7b70 100644 --- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp +++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp @@ -1664,7 +1664,7 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, StartAndEndA2dpSbcEncodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -1694,7 +1694,7 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, StartAndEndA2dpAacEncodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -1724,7 +1724,7 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, StartAndEndA2dpLdacEncodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -1754,7 +1754,7 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, StartAndEndA2dpOpusEncodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -1784,7 +1784,7 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, StartAndEndA2dpAptxEncodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } for (auto codec_type : {CodecType::APTX, CodecType::APTX_HD}) { @@ -1820,7 +1820,7 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, StartAndEndA2dpEncodingHardwareSessionInvalidCodecConfig) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } ASSERT_NE(audio_provider_, nullptr); @@ -2420,7 +2420,7 @@ TEST_P( BluetoothAudioProviderLeAudioOutputHardwareAidl, StartAndEndLeAudioOutputSessionWithPossibleUnicastConfigFromProviderInfo) { if (!IsOffloadOutputProviderInfoSupported()) { - return; + GTEST_SKIP(); } auto lc3_codec_configs = GetUnicastLc3SupportedListFromProviderInfo(); @@ -2514,7 +2514,7 @@ TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, GetQoSConfiguration) { TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, StartAndEndLeAudioOutputSessionWithPossibleUnicastConfig) { if (!IsOffloadOutputSupported()) { - return; + GTEST_SKIP(); } auto lc3_codec_configs = @@ -2547,7 +2547,7 @@ TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, DISABLED_StartAndEndLeAudioOutputSessionWithInvalidAudioConfiguration) { if (!IsOffloadOutputSupported()) { - return; + GTEST_SKIP(); } auto lc3_codec_configs = @@ -2585,7 +2585,7 @@ static std::vector vendorMetadata = {0x0B, // Length TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, StartAndEndLeAudioOutputSessionWithAptxAdaptiveLeUnicastConfig) { if (!IsOffloadOutputSupported()) { - return; + GTEST_SKIP(); } for (auto codec_type : {CodecType::APTX_ADAPTIVE_LE, CodecType::APTX_ADAPTIVE_LEX}) { @@ -2622,7 +2622,7 @@ TEST_P( BluetoothAudioProviderLeAudioOutputHardwareAidl, BluetoothAudioProviderLeAudioOutputHardwareAidl_StartAndEndLeAudioOutputSessionWithInvalidAptxAdaptiveLeAudioConfiguration) { if (!IsOffloadOutputSupported()) { - return; + GTEST_SKIP(); } for (auto codec_type : @@ -2708,7 +2708,7 @@ TEST_P( BluetoothAudioProviderLeAudioInputHardwareAidl, StartAndEndLeAudioInputSessionWithPossibleUnicastConfigFromProviderInfo) { if (!IsOffloadOutputProviderInfoSupported()) { - return; + GTEST_SKIP(); } auto lc3_codec_configs = GetUnicastLc3SupportedListFromProviderInfo(); @@ -2738,7 +2738,7 @@ TEST_P( TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl, StartAndEndLeAudioInputSessionWithPossibleUnicastConfig) { if (!IsOffloadInputSupported()) { - return; + GTEST_SKIP(); } auto lc3_codec_configs = @@ -2771,7 +2771,7 @@ TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl, TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl, DISABLED_StartAndEndLeAudioInputSessionWithInvalidAudioConfiguration) { if (!IsOffloadInputSupported()) { - return; + GTEST_SKIP(); } auto lc3_codec_configs = @@ -3225,7 +3225,7 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, StartAndEndA2dpSbcDecodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -3255,7 +3255,7 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, StartAndEndA2dpAacDecodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -3285,7 +3285,7 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, StartAndEndA2dpLdacDecodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -3315,7 +3315,7 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, StartAndEndA2dpOpusDecodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } CodecConfiguration codec_config = { @@ -3345,7 +3345,7 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, StartAndEndA2dpAptxDecodingHardwareSession) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } for (auto codec_type : {CodecType::APTX, CodecType::APTX_HD}) { @@ -3381,7 +3381,7 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, StartAndEndA2dpDecodingHardwareSessionInvalidCodecConfig) { if (!IsOffloadSupported()) { - return; + GTEST_SKIP(); } ASSERT_NE(audio_provider_, nullptr); From 0259aafb7141ead245c2dc988e9912f8beb663af Mon Sep 17 00:00:00 2001 From: Jakub Tyszkowski Date: Fri, 5 Jan 2024 12:36:38 +0000 Subject: [PATCH 2/4] Fix filling the configuration map Bug: 319090769 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: I1806d8a20abb9a9756512ae8d433c6c6ff784159 --- bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp index 216e1692ff..d37825a2a1 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp @@ -428,7 +428,7 @@ std::vector BluetoothAudioCodecs::GetLeAudioOffloadCodecInfo( if (kDefaultOffloadLeAudioCodecInfoMap.empty()) { auto le_audio_offload_setting = BluetoothLeAudioCodecsProvider::ParseFromLeAudioOffloadSettingFile(); - auto kDefaultOffloadLeAudioCodecInfoMap = + kDefaultOffloadLeAudioCodecInfoMap = BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo( le_audio_offload_setting); } From 06781c028a6d411ebc721c9bba67a5be71100555 Mon Sep 17 00:00:00 2001 From: Jakub Tyszkowski Date: Mon, 8 Jan 2024 13:16:42 +0000 Subject: [PATCH 3/4] Fix the bogus configs default-constructed as a2dp configs When the xml file contains the "invalid" entry in the scenario record, which do not refer to any valid config in the 'configurationList` section, the invalid, default constructed codec configuration (a2dp codec) was created. Bug: 319090769 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: I19b7d1af81e5f2be3fb7261fba8781b3dc47fa12 --- .../vts/VtsHalBluetoothAudioTargetTest.cpp | 3 +-- .../BluetoothLeAudioCodecsProvider.cpp | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp index bdcfbd7b70..5fd96caee7 100644 --- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp +++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp @@ -736,8 +736,7 @@ TEST_P(BluetoothAudioProviderFactoryAidl, getProviderInfo_leAudioSessionTypes) { ASSERT_NE(codec_info.id.getTag(), CodecId::a2dp); // The codec info must contain the information // for le audio transport. - // ASSERT_EQ(codec_info.transport.getTag(), - // CodecInfo::Transport::le_audio); + ASSERT_EQ(codec_info.transport.getTag(), CodecInfo::Transport::leAudio); } } } diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp index b6df67e133..99dea84a6c 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp @@ -77,8 +77,6 @@ BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo( for (auto& p : configuration_map_) { // Initialize new CodecInfo for the config auto config_name = p.first; - if (config_codec_info_map_.count(config_name) == 0) - config_codec_info_map_[config_name] = CodecInfo(); // Getting informations from codecConfig and strategyConfig const auto codec_config_name = p.second.getCodecConfiguration(); @@ -92,6 +90,9 @@ BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo( if (strategy_configuration_map_iter == strategy_configuration_map_.end()) continue; + if (config_codec_info_map_.count(config_name) == 0) + config_codec_info_map_[config_name] = CodecInfo(); + const auto& codec_config = codec_configuration_map_iter->second; const auto codec = codec_config.getCodec(); const auto& strategy_config = strategy_configuration_map_iter->second; @@ -137,12 +138,19 @@ BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo( } } - // Goes through every scenario, deduplicate configuration + // Goes through every scenario, deduplicate configuration, skip the invalid + // config references (e.g. the "invalid" entries in the xml file). std::set encoding_config, decoding_config, broadcast_config; for (auto& s : supported_scenarios_) { - if (s.hasEncode()) encoding_config.insert(s.getEncode()); - if (s.hasDecode()) decoding_config.insert(s.getDecode()); - if (s.hasBroadcast()) broadcast_config.insert(s.getBroadcast()); + if (s.hasEncode() && config_codec_info_map_.count(s.getEncode())) { + encoding_config.insert(s.getEncode()); + } + if (s.hasDecode() && config_codec_info_map_.count(s.getDecode())) { + decoding_config.insert(s.getDecode()); + } + if (s.hasBroadcast() && config_codec_info_map_.count(s.getBroadcast())) { + broadcast_config.insert(s.getBroadcast()); + } } // Split by session types and add results From deecabbd9cc5c13322ddaf167d41dbafc0435876 Mon Sep 17 00:00:00 2001 From: Jakub Tyszkowski Date: Mon, 8 Jan 2024 13:55:01 +0000 Subject: [PATCH 4/4] Fix LeAudioCodecProvider failing offload setting file parsing ParseFromLeAudioOffloadSettingFile() fails when `GetLeAudioCodecCapabilities()` was already called in the past and `leAudioCodecCapabilities` vector is already populated. That makes some of the VTS tests fail on `IsOffloadOutputProviderInfoSupported()` and just return and PASS without actually checking enything. The doubtful checks check variables set at parsed content verification, and should not prevent us from parsing the file again. Bug: 319090769 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: Iab6235b5d265bb254ae6075b8c32d0eae0fc1829 --- .../utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp index 99dea84a6c..473777c945 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp @@ -43,9 +43,6 @@ static bool isInvalidFileContent = false; std::optional BluetoothLeAudioCodecsProvider::ParseFromLeAudioOffloadSettingFile() { - if (!leAudioCodecCapabilities.empty() || isInvalidFileContent) { - return std::nullopt; - } auto le_audio_offload_setting = setting::readLeAudioOffloadSetting(kLeAudioCodecCapabilitiesFile); if (!le_audio_offload_setting.has_value()) {