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

Commit 06fa69e2 authored by Amy Zhang's avatar Amy Zhang
Browse files

Extend 1.0 dynamic config reader to read 1.1 Tuner HAL types

Test: atest VtsHalTvTunerV1_1TargetTest
Test: atest VtsHalTvTunerV1_0TargetTest
Bug: 182519645
CTS-Coverage-Bug: 184077478
Change-Id: I0438fff48a6a763b88ed20e34d8ace66a6211302
parent 32b6f9ea
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ static AssertionResult success() {
namespace {

bool initConfiguration() {
    if (!TunerTestingConfigReader::checkConfigFileExists()) {
    TunerTestingConfigReader1_0::setConfigFilePath(configFilePath);
    if (!TunerTestingConfigReader1_0::checkConfigFileExists()) {
        return false;
    }
    initFrontendConfig();
+18 −16
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <hidl/Status.h>
#include <hidlmemory/FrameworkUtils.h>

#include "../../../config/TunerTestingConfigReader.h"
#include "../../../config/TunerTestingConfigReaderV1_0.h"

using android::hardware::tv::tuner::V1_0::DemuxFilterMainType;
using android::hardware::tv::tuner::V1_0::DemuxTsFilterType;
@@ -39,6 +39,8 @@ using namespace android::media::tuner::testing::configuration::V1_0;
const uint32_t FMQ_SIZE_4M = 0x400000;
const uint32_t FMQ_SIZE_16M = 0x1000000;

const string configFilePath = "/vendor/etc/tuner_vts_config_1_0.xml";

#define FILTER_MAIN_TYPE_BIT_COUNT 5

// Hardware configs
@@ -85,7 +87,7 @@ inline void initFrontendConfig() {
    frontendMap[defaultFeId].isSoftwareFe = true;

    // Read customized config
    TunerTestingConfigReader::readFrontendConfig1_0(frontendMap);
    TunerTestingConfigReader1_0::readFrontendConfig1_0(frontendMap);
};

inline void initFilterConfig() {
@@ -107,44 +109,44 @@ inline void initFilterConfig() {
    filterMap[defaultAudioFilterId].settings.ts().filterSettings.av({.isPassthrough = false});

    // Read customized config
    TunerTestingConfigReader::readFilterConfig1_0(filterMap);
    TunerTestingConfigReader1_0::readFilterConfig1_0(filterMap);
};

/** Config all the dvrs that would be used in the tests */
inline void initDvrConfig() {
    // Read customized config
    TunerTestingConfigReader::readDvrConfig1_0(dvrMap);
    TunerTestingConfigReader1_0::readDvrConfig1_0(dvrMap);
};

/** Config all the lnbs that would be used in the tests */
inline void initLnbConfig() {
    // Read customized config
    TunerTestingConfigReader::readLnbConfig1_0(lnbMap);
    TunerTestingConfigReader::readDiseqcMessages(diseqcMsgMap);
    TunerTestingConfigReader1_0::readLnbConfig1_0(lnbMap);
    TunerTestingConfigReader1_0::readDiseqcMessages(diseqcMsgMap);
};

/** Config all the time filters that would be used in the tests */
inline void initTimeFilterConfig() {
    // Read customized config
    TunerTestingConfigReader::readTimeFilterConfig1_0(timeFilterMap);
    TunerTestingConfigReader1_0::readTimeFilterConfig1_0(timeFilterMap);
};

/** Config all the descramblers that would be used in the tests */
inline void initDescramblerConfig() {
    // Read customized config
    TunerTestingConfigReader::readDescramblerConfig1_0(descramblerMap);
    TunerTestingConfigReader1_0::readDescramblerConfig1_0(descramblerMap);
};

/** Read the vendor configurations of which hardware to use for each test cases/data flows */
inline void connectHardwaresToTestCases() {
    TunerTestingConfigReader::connectLiveBroadcast(live);
    TunerTestingConfigReader::connectScan(scan);
    TunerTestingConfigReader::connectDvrPlayback(playback);
    TunerTestingConfigReader::connectDvrRecord(record);
    TunerTestingConfigReader::connectDescrambling(descrambling);
    TunerTestingConfigReader::connectLnbLive(lnbLive);
    TunerTestingConfigReader::connectLnbRecord(lnbRecord);
    TunerTestingConfigReader::connectTimeFilter(timeFilter);
    TunerTestingConfigReader1_0::connectLiveBroadcast(live);
    TunerTestingConfigReader1_0::connectScan(scan);
    TunerTestingConfigReader1_0::connectDvrPlayback(playback);
    TunerTestingConfigReader1_0::connectDvrRecord(record);
    TunerTestingConfigReader1_0::connectDescrambling(descrambling);
    TunerTestingConfigReader1_0::connectLnbLive(lnbLive);
    TunerTestingConfigReader1_0::connectLnbRecord(lnbRecord);
    TunerTestingConfigReader1_0::connectTimeFilter(timeFilter);
};

inline bool validateConnections() {
+12 −0
Original line number Diff line number Diff line
@@ -33,6 +33,15 @@ cc_test {
        "FrontendTests.cpp",
        "VtsHalTvTunerV1_1TargetTest.cpp",
    ],
    generated_headers: [
        "tuner_testing_dynamic_configuration_V1_0_enums",
        "tuner_testing_dynamic_configuration_V1_0_parser",
    ],
    generated_sources: [
        "tuner_testing_dynamic_configuration_V1_0_enums",
        "tuner_testing_dynamic_configuration_V1_0_parser",
    ],
    header_libs: ["libxsdc-utils"],
    static_libs: [
        "android.hardware.cas@1.0",
        "android.hardware.cas@1.1",
@@ -48,9 +57,12 @@ cc_test {
    ],
    shared_libs: [
        "libbinder",
        "libxml2",
    ],
    data: [
        ":tuner_frontend_input_ts",
        ":tuner_frontend_input_es",
        ":tuner_testing_dynamic_configuration_V1_0",
    ],
    test_suites: [
        "general-tests",
+26 −31
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ void FrontendCallback::tuneTestOnLock(sp<IFrontend>& frontend, FrontendSettings
    mLockMsgReceived = false;
}

void FrontendCallback::scanTest(sp<IFrontend>& frontend, FrontendConfig config,
void FrontendCallback::scanTest(sp<IFrontend>& frontend, FrontendConfig1_1 config,
                                FrontendScanType type) {
    sp<android::hardware::tv::tuner::V1_1::IFrontend> frontend_1_1;
    frontend_1_1 = android::hardware::tv::tuner::V1_1::IFrontend::castFrom(frontend);
@@ -130,7 +130,7 @@ void FrontendCallback::scanTest(sp<IFrontend>& frontend, FrontendConfig config,
        return;
    }

    uint32_t targetFrequency = getTargetFrequency(config.settings);
    uint32_t targetFrequency = getTargetFrequency(config.config1_0.settings);
    if (type == FrontendScanType::SCAN_BLIND) {
        // reset the frequency in the scan configuration to test blind scan. The settings param of
        // passed in means the real input config on the transponder connected to the DUT.
@@ -139,7 +139,7 @@ void FrontendCallback::scanTest(sp<IFrontend>& frontend, FrontendConfig config,
        resetBlindScanStartingFrequency(config, targetFrequency - 100);
    }

    Result result = frontend_1_1->scan_1_1(config.settings, type, config.settingsExt1_1);
    Result result = frontend_1_1->scan_1_1(config.config1_0.settings, type, config.settingsExt1_1);
    EXPECT_TRUE(result == Result::SUCCESS);

    bool scanMsgLockedReceived = false;
@@ -159,7 +159,8 @@ wait:
    if (mScanMessageType != FrontendScanMessageType::END) {
        if (mScanMessageType == FrontendScanMessageType::LOCKED) {
            scanMsgLockedReceived = true;
            Result result = frontend_1_1->scan_1_1(config.settings, type, config.settingsExt1_1);
            Result result =
                    frontend_1_1->scan_1_1(config.config1_0.settings, type, config.settingsExt1_1);
            EXPECT_TRUE(result == Result::SUCCESS);
        }

@@ -207,35 +208,35 @@ uint32_t FrontendCallback::getTargetFrequency(FrontendSettings settings) {
    }
}

void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig& config,
void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig1_1& config,
                                                       uint32_t resetingFreq) {
    switch (config.settings.getDiscriminator()) {
    switch (config.config1_0.settings.getDiscriminator()) {
        case FrontendSettings::hidl_discriminator::analog:
            config.settings.analog().frequency = resetingFreq;
            config.config1_0.settings.analog().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::atsc:
            config.settings.atsc().frequency = resetingFreq;
            config.config1_0.settings.atsc().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::atsc3:
            config.settings.atsc3().frequency = resetingFreq;
            config.config1_0.settings.atsc3().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::dvbc:
            config.settings.dvbc().frequency = resetingFreq;
            config.config1_0.settings.dvbc().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::dvbs:
            config.settings.dvbs().frequency = resetingFreq;
            config.config1_0.settings.dvbs().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::dvbt:
            config.settings.dvbt().frequency = resetingFreq;
            config.config1_0.settings.dvbt().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::isdbs:
            config.settings.isdbs().frequency = resetingFreq;
            config.config1_0.settings.isdbs().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::isdbs3:
            config.settings.isdbs3().frequency = resetingFreq;
            config.config1_0.settings.isdbs3().frequency = resetingFreq;
            break;
        case FrontendSettings::hidl_discriminator::isdbt:
            config.settings.isdbt().frequency = resetingFreq;
            config.config1_0.settings.isdbt().frequency = resetingFreq;
            break;
    }
}
@@ -274,11 +275,11 @@ AssertionResult FrontendTests::setFrontendCallback() {
    return AssertionResult(callbackStatus.isOk());
}

AssertionResult FrontendTests::scanFrontend(FrontendConfig config, FrontendScanType type) {
AssertionResult FrontendTests::scanFrontend(FrontendConfig1_1 config, FrontendScanType type) {
    EXPECT_TRUE(mFrontendCallback)
            << "test with openFrontendById/setFrontendCallback/getFrontendInfo first.";

    EXPECT_TRUE(mFrontendInfo.type == config.type)
    EXPECT_TRUE(mFrontendInfo.type == config.config1_0.type)
            << "FrontendConfig does not match the frontend info of the given id.";

    mFrontendCallback->scanTest(mFrontend, config, type);
@@ -426,14 +427,14 @@ void FrontendTests::verifyFrontendStatusExt1_1(vector<FrontendStatusTypeExt1_1>
    ASSERT_TRUE(status == Result::SUCCESS);
}

AssertionResult FrontendTests::tuneFrontend(FrontendConfig config, bool testWithDemux) {
AssertionResult FrontendTests::tuneFrontend(FrontendConfig1_1 config, bool testWithDemux) {
    EXPECT_TRUE(mFrontendCallback)
            << "test with openFrontendById/setFrontendCallback/getFrontendInfo first.";

    EXPECT_TRUE(mFrontendInfo.type == config.type)
    EXPECT_TRUE(mFrontendInfo.type == config.config1_0.type)
            << "FrontendConfig does not match the frontend info of the given id.";

    mIsSoftwareFe = config.isSoftwareFe;
    mIsSoftwareFe = config.config1_0.isSoftwareFe;
    bool result = true;
    if (mIsSoftwareFe && testWithDemux) {
        result &= mDvrTests.openDvrInDemux(mDvrConfig.type, mDvrConfig.bufferSize) == success();
@@ -446,7 +447,7 @@ AssertionResult FrontendTests::tuneFrontend(FrontendConfig config, bool testWith
            return failure();
        }
    }
    mFrontendCallback->tuneTestOnLock(mFrontend, config.settings, config.settingsExt1_1);
    mFrontendCallback->tuneTestOnLock(mFrontend, config.config1_0.settings, config.settingsExt1_1);
    return AssertionResult(true);
}

@@ -484,12 +485,9 @@ void FrontendTests::getFrontendIdByType(FrontendType feType, uint32_t& feId) {
    feId = INVALID_ID;
}

void FrontendTests::tuneTest(FrontendConfig frontendConf) {
    if (!frontendConf.enable) {
        return;
    }
void FrontendTests::tuneTest(FrontendConfig1_1 frontendConf) {
    uint32_t feId;
    getFrontendIdByType(frontendConf.type, feId);
    getFrontendIdByType(frontendConf.config1_0.type, feId);
    ASSERT_TRUE(feId != INVALID_ID);
    ASSERT_TRUE(openFrontendById(feId));
    ASSERT_TRUE(setFrontendCallback());
@@ -503,12 +501,9 @@ void FrontendTests::tuneTest(FrontendConfig frontendConf) {
    ASSERT_TRUE(closeFrontend());
}

void FrontendTests::scanTest(FrontendConfig frontendConf, FrontendScanType scanType) {
    if (!frontendConf.enable) {
        return;
    }
void FrontendTests::scanTest(FrontendConfig1_1 frontendConf, FrontendScanType scanType) {
    uint32_t feId;
    getFrontendIdByType(frontendConf.type, feId);
    getFrontendIdByType(frontendConf.config1_0.type, feId);
    ASSERT_TRUE(feId != INVALID_ID);
    ASSERT_TRUE(openFrontendById(feId));
    ASSERT_TRUE(setFrontendCallback());
+6 −6
Original line number Diff line number Diff line
@@ -79,11 +79,11 @@ class FrontendCallback : public IFrontendCallback {

    void tuneTestOnLock(sp<IFrontend>& frontend, FrontendSettings settings,
                        FrontendSettingsExt1_1 settingsExt1_1);
    void scanTest(sp<IFrontend>& frontend, FrontendConfig config, FrontendScanType type);
    void scanTest(sp<IFrontend>& frontend, FrontendConfig1_1 config, FrontendScanType type);

    // Helper methods
    uint32_t getTargetFrequency(FrontendSettings settings);
    void resetBlindScanStartingFrequency(FrontendConfig& config, uint32_t resetingFreq);
    void resetBlindScanStartingFrequency(FrontendConfig1_1& config, uint32_t resetingFreq);

  private:
    void readFrontendScanMessageExt1_1Modulation(FrontendModulation modulation);
@@ -114,9 +114,9 @@ class FrontendTests {
    AssertionResult getFrontendInfo(uint32_t frontendId);
    AssertionResult openFrontendById(uint32_t frontendId);
    AssertionResult setFrontendCallback();
    AssertionResult scanFrontend(FrontendConfig config, FrontendScanType type);
    AssertionResult scanFrontend(FrontendConfig1_1 config, FrontendScanType type);
    AssertionResult stopScanFrontend();
    AssertionResult tuneFrontend(FrontendConfig config, bool testWithDemux);
    AssertionResult tuneFrontend(FrontendConfig1_1 config, bool testWithDemux);
    void verifyFrontendStatusExt1_1(vector<FrontendStatusTypeExt1_1> statusTypes,
                                    vector<FrontendStatusExt1_1> expectStatuses);
    AssertionResult stopTuneFrontend(bool testWithDemux);
@@ -127,8 +127,8 @@ class FrontendTests {
    AssertionResult unlinkCiCam(uint32_t ciCamId);

    void getFrontendIdByType(FrontendType feType, uint32_t& feId);
    void tuneTest(FrontendConfig frontendConf);
    void scanTest(FrontendConfig frontend, FrontendScanType type);
    void tuneTest(FrontendConfig1_1 frontendConf);
    void scanTest(FrontendConfig1_1 frontend, FrontendScanType type);
    void getFrontendDtmbCapsTest();

    void setDvrTests(DvrTests dvrTests) { mDvrTests = dvrTests; }
Loading