From 58eeec592550d9008f381eef4706f183ab0a1bc2 Mon Sep 17 00:00:00 2001 From: Netajee Shubash Chand Miriyala Date: Thu, 14 Apr 2022 03:46:03 -0400 Subject: [PATCH] Fix: BroadcastradioHalTest.DabTune case failure Root Cause: Even when proper DAB signals are available, the test-case "BroadcastradioHalTest.DabTune" always fails. This is because the Pro -gramSelector created as part of the test-case is not valid according to the AOSP documentation; it passes only DAB_FREQUENCY as the Primar -yId, but according to the AOSP documentation, DAB_FREQUENCY is not p -art of proper acceptable PrimaryIds in a ProgramSelector Fix: The test-case is modified to retrieve the station list before pe -rforming any tune in the test-case; there are three possible outcome -s: - If there are no stations in the station list, the test-case shall b -e skipped - If there are stations in the station list, but there are no dab sta -ions being transmitted/received, the test-case shall be skipped - If there are stations in the station list, and if there are DAB ser -vices, extract one service from the list, and create a ProgramSele -ctor, and send a tune-request Test: run "VtsHalBroadcastradioV2_0TargetTest from VTS; run the test- case - "BroadcastradioHalTest.DabTune" Bug: 208477956 Change-Id: I874d36f9eeb460fabadd06fe1e138a35b13a5816 (cherry picked from commit e1863a9ce47a2285829ca562ce70592212126b53) --- broadcastradio/2.0/vts/OWNERS | 4 +- .../VtsHalBroadcastradioV2_0TargetTest.cpp | 43 ++++++++++++++++++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/broadcastradio/2.0/vts/OWNERS b/broadcastradio/2.0/vts/OWNERS index 1ff740712c..eb030525f3 100644 --- a/broadcastradio/2.0/vts/OWNERS +++ b/broadcastradio/2.0/vts/OWNERS @@ -1,6 +1,6 @@ # Automotive team -egranata@google.com -twasilczyk@google.com +xuweilin@google.com +oscarazu@google.com # VTS team dshi@google.com diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp index 615fde0343..63e3b554dd 100644 --- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp +++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp @@ -514,9 +514,48 @@ TEST_P(BroadcastRadioHalTest, DabTune) { ASSERT_TRUE(openSession()); + auto programList = getProgramList(); + + if (!programList) { + printSkipped("Empty Station-List, tune cannot be performed"); + return; + } + ProgramSelector sel = {}; - uint64_t freq = config[config.size() / 2].frequency; - sel.primaryId = make_identifier(IdentifierType::DAB_FREQUENCY,freq); + uint64_t freq = 0; + bool dabStnPresent = false; + + for (auto&& programInfo : *programList) { + if (utils::hasId(programInfo.selector, IdentifierType::DAB_FREQUENCY)) { + for (auto&& config_entry : config) { + if (config_entry.frequency == utils::getId(programInfo.selector, + IdentifierType::DAB_FREQUENCY, 0)) { + freq = config_entry.frequency; + break; + } + } + // Do not trigger a tune request if the programList entry does not contain + // a valid DAB frequency + if (freq == 0) { + continue; + } + uint64_t dabSidExt = utils::getId(programInfo.selector, IdentifierType::DAB_SID_EXT, 0); + uint64_t dabEns = utils::getId(programInfo.selector, IdentifierType::DAB_ENSEMBLE, 0); + sel.primaryId = make_identifier(IdentifierType::DAB_SID_EXT, dabSidExt); + hidl_vec secondaryIds = { + make_identifier(IdentifierType::DAB_ENSEMBLE, dabEns), + make_identifier(IdentifierType::DAB_FREQUENCY, freq) + }; + sel.secondaryIds = secondaryIds; + dabStnPresent = true; + break; + } + } + + if (!dabStnPresent) { + printSkipped("No DAB stations in the list, tune cannot be performed"); + return; + } std::this_thread::sleep_for(gTuneWorkaround);