From 7aa628d4de1c45f7c8bba7bf5d8797f5da235ede Mon Sep 17 00:00:00 2001 From: Jan Kowal Date: Mon, 31 May 2021 16:48:19 +0200 Subject: [PATCH] broadcastradio@2.0 VTS uses DAB frequency invalid in some regions DAB frequency 178352kHz hardcoded in the test is used in EU region (channel 5C) but it is not valid in others (e.g. Korea and China). Therefore DabTune test was modified to use one of supported frequencies reported via getDabRegionConfig method. Test: run VtsHalBroadcastradioV2_0TargetTest on hardware units configured for Europe, China and Korea DAB tuner regions. Bug: b/190136847 Change-Id: Icd71e42a9242528465ac1358465d8b6d6d4896bf --- .../VtsHalBroadcastradioV2_0TargetTest.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp index 362ab41c4f..615fde0343 100644 --- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp +++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp @@ -496,10 +496,26 @@ TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) { * - program changes exactly to what was requested. */ TEST_P(BroadcastRadioHalTest, DabTune) { + Result halResult; + hidl_vec config; + auto cb = [&](Result result, hidl_vec configCb) { + halResult = result; + config = configCb; + }; + auto hidlResult = mModule->getDabRegionConfig(cb); + ASSERT_TRUE(hidlResult.isOk()); + + if (halResult == Result::NOT_SUPPORTED) { + printSkipped("DAB not supported"); + return; + } + ASSERT_EQ(Result::OK, halResult); + ASSERT_NE(config.size(), 0U); + ASSERT_TRUE(openSession()); ProgramSelector sel = {}; - uint64_t freq = 178352; + uint64_t freq = config[config.size() / 2].frequency; sel.primaryId = make_identifier(IdentifierType::DAB_FREQUENCY,freq); std::this_thread::sleep_for(gTuneWorkaround);