Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 433858b4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix: BroadcastradioHalTest.DabTune case failure" into android11-tests-dev am: 77b8b252

parents 4e634924 77b8b252
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
# Automotive team
egranata@google.com
twasilczyk@google.com
xuweilin@google.com
oscarazu@google.com

# VTS team
dshi@google.com
+41 −2
Original line number Diff line number Diff line
@@ -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<ProgramIdentifier> 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);