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

Commit 349ad539 authored by Frankie Lizcano's avatar Frankie Lizcano Committed by Android (Google) Code Review
Browse files

Merge "Improve Tuner VTS Configuration: Dynamically determine possible dataflows"

parents 5a65d794 5b29f509
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ bool initConfiguration() {
        ALOGW("[vts] failed to validate connections.");
        return false;
    }
    determineDataFlows();

    return true;
}

@@ -62,6 +64,14 @@ AssertionResult filterDataOutputTestBase(FilterTests& tests) {
    return success();
}

void clearIds() {
    recordDvrIds.clear();
    audioFilterIds.clear();
    videoFilterIds.clear();
    playbackDvrIds.clear();
    recordFilterIds.clear();
}

class TunerLnbAidlTest : public testing::TestWithParam<std::string> {
  public:
    virtual void SetUp() override {
@@ -77,6 +87,11 @@ class TunerLnbAidlTest : public testing::TestWithParam<std::string> {
        mLnbTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -105,6 +120,11 @@ class TunerDemuxAidlTest : public testing::TestWithParam<std::string> {
        mFilterTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -135,6 +155,11 @@ class TunerFilterAidlTest : public testing::TestWithParam<std::string> {
        mFilterTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -201,6 +226,11 @@ class TunerPlaybackAidlTest : public testing::TestWithParam<std::string> {
        mDvrTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -238,6 +268,12 @@ class TunerRecordAidlTest : public testing::TestWithParam<std::string> {
        mLnbTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
        mLnbId = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -278,6 +314,11 @@ class TunerFrontendAidlTest : public testing::TestWithParam<std::string> {
        mFrontendTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -308,6 +349,12 @@ class TunerBroadcastAidlTest : public testing::TestWithParam<std::string> {
        mDvrTests.setService(mService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
        mLnbId = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
@@ -354,6 +401,11 @@ class TunerDescramblerAidlTest : public testing::TestWithParam<std::string> {
        mDescramblerTests.setCasService(mCasService);
    }

    virtual void TearDown() override {
        clearIds();
        mService = nullptr;
    }

  protected:
    static void description(const std::string& description) {
        RecordProperty("description", description);
+92 −0
Original line number Diff line number Diff line
@@ -182,6 +182,87 @@ inline void initDiseqcMsgsConfig() {
    TunerTestingConfigAidlReader1_0::readDiseqcMessages(diseqcMsgMap);
};

inline void determineScan() {
    if (!frontendMap.empty()) {
        scan.hasFrontendConnection = true;
        ALOGD("Can support scan");
    }
}

inline void determineTimeFilter() {
    if (!timeFilterMap.empty()) {
        timeFilter.support = true;
        ALOGD("Can support time filter");
    }
}

inline void determineDvrPlayback() {
    if (!playbackDvrIds.empty() && !audioFilterIds.empty() && !videoFilterIds.empty()) {
        playback.support = true;
        ALOGD("Can support dvr playback");
    }
}

inline void determineLnbLive() {
    if (!audioFilterIds.empty() && !videoFilterIds.empty() && !frontendMap.empty() &&
        !lnbMap.empty()) {
        lnbLive.support = true;
        ALOGD("Can support lnb live");
    }
}

inline void determineLnbRecord() {
    if (!frontendMap.empty() && !recordFilterIds.empty() && !recordDvrIds.empty() &&
        !lnbMap.empty()) {
        lnbRecord.support = true;
        ALOGD("Can support lnb record");
    }
}

inline void determineLive() {
    if (videoFilterIds.empty() || audioFilterIds.empty() || frontendMap.empty()) {
        return;
    }
    if (hasSwFe && !hasHwFe && dvrMap.empty()) {
        ALOGD("Cannot configure Live. Only software frontends and no dvr connections");
        return;
    }
    ALOGD("Can support live");
    live.hasFrontendConnection = true;
}

inline void determineDescrambling() {
    if (descramblerMap.empty() || audioFilterIds.empty() || videoFilterIds.empty()) {
        return;
    }
    if (frontendMap.empty() && playbackDvrIds.empty()) {
        ALOGD("Cannot configure descrambling. No frontends or playback dvr's");
        return;
    }
    if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) {
        ALOGD("cannot configure descrambling. Only SW frontends and no playback dvr's");
        return;
    }
    ALOGD("Can support descrambling");
    descrambling.support = true;
}

inline void determineDvrRecord() {
    if (recordDvrIds.empty() || recordFilterIds.empty()) {
        return;
    }
    if (frontendMap.empty() && playbackDvrIds.empty()) {
        ALOGD("Cannot support dvr record. No frontends and  no playback dvr's");
        return;
    }
    if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) {
        ALOGD("Cannot support dvr record. Only SW frontends and no playback dvr's");
        return;
    }
    ALOGD("Can support dvr record.");
    record.support = true;
}

/** Read the vendor configurations of which hardware to use for each test cases/data flows */
inline void connectHardwaresToTestCases() {
    TunerTestingConfigAidlReader1_0::connectLiveBroadcast(live);
@@ -194,6 +275,17 @@ inline void connectHardwaresToTestCases() {
    TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback);
};

inline void determineDataFlows() {
    determineScan();
    determineTimeFilter();
    determineDvrPlayback();
    determineLnbLive();
    determineLnbRecord();
    determineLive();
    determineDescrambling();
    determineDvrRecord();
}

inline bool validateConnections() {
    if (record.support && !record.hasFrontendConnection &&
        record.dvrSourceId.compare(emptyHardwareId) == 0) {
+41 −0
Original line number Diff line number Diff line
@@ -62,10 +62,28 @@ using namespace std;
using namespace aidl::android::hardware::tv::tuner;
using namespace android::media::tuner::testing::configuration::V1_0;

static bool hasHwFe = false;
static bool hasSwFe = false;
static bool configFileRead = false;
static bool configuredLive = false;
static bool configuredScan = false;
static bool configuredRecord = false;
static bool configuredLnbLive = false;
static bool configuredPlayback = false;
static bool configuredLnbRecord = false;
static bool configuredTimeFilter = false;
static bool configuredDescrambling = false;

const string emptyHardwareId = "";

static string mConfigFilePath;

static vector<string> playbackDvrIds;
static vector<string> recordDvrIds;
static vector<string> audioFilterIds;
static vector<string> videoFilterIds;
static vector<string> recordFilterIds;

#define PROVISION_STR                                      \
    "{                                                   " \
    "  \"id\": 21140844,                                 " \
@@ -310,6 +328,11 @@ struct TunerTestingConfigAidlReader1_0 {
                }
                frontendMap[id].type = type;
                frontendMap[id].isSoftwareFe = feConfig.getIsSoftwareFrontend();
                if (frontendMap[id].isSoftwareFe) {
                    hasSwFe = true;
                } else {
                    hasHwFe = true;
                }
                // TODO: b/182519645 complete the tune status config
                frontendMap[id].tuneStatusTypes = types;
                frontendMap[id].expectTuneStatuses = statuses;
@@ -384,11 +407,13 @@ struct TunerTestingConfigAidlReader1_0 {
                DvrType type;
                switch (dvrConfig.getType()) {
                    case DvrTypeEnum::PLAYBACK:
                        playbackDvrIds.push_back(id);
                        type = DvrType::PLAYBACK;
                        dvrMap[id].settings.set<DvrSettings::Tag::playback>(
                                readPlaybackSettings(dvrConfig));
                        break;
                    case DvrTypeEnum::RECORD:
                        recordDvrIds.push_back(id);
                        type = DvrType::RECORD;
                        dvrMap[id].settings.set<DvrSettings::Tag::record>(
                                readRecordSettings(dvrConfig));
@@ -477,6 +502,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasClearLiveBroadcast()) {
            live.hasFrontendConnection = true;
            configuredLive = true;
        } else {
            live.hasFrontendConnection = false;
            return;
@@ -510,6 +536,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasScan()) {
            scan.hasFrontendConnection = true;
            configuredScan = true;
        } else {
            scan.hasFrontendConnection = false;
            return;
@@ -522,6 +549,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasDvrPlayback()) {
            playback.support = true;
            configuredPlayback = true;
        } else {
            playback.support = false;
            return;
@@ -548,6 +576,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasDvrRecord()) {
            record.support = true;
            configuredRecord = true;
        } else {
            record.support = false;
            return;
@@ -572,6 +601,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasDescrambling()) {
            descrambling.support = true;
            configuredDescrambling = true;
        } else {
            descrambling.support = false;
            return;
@@ -601,6 +631,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasLnbLive()) {
            lnbLive.support = true;
            configuredLnbLive = true;
        } else {
            lnbLive.support = false;
            return;
@@ -625,6 +656,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasLnbRecord()) {
            lnbRecord.support = true;
            configuredLnbRecord = true;
        } else {
            lnbRecord.support = false;
            return;
@@ -649,6 +681,7 @@ struct TunerTestingConfigAidlReader1_0 {
        auto dataFlow = getDataFlowConfiguration();
        if (dataFlow.hasTimeFilter()) {
            timeFilter.support = true;
            configuredTimeFilter = true;
        } else {
            timeFilter.support = false;
            return;
@@ -799,6 +832,14 @@ struct TunerTestingConfigAidlReader1_0 {
        auto mainType = filterConfig.getMainType();
        auto subType = filterConfig.getSubType();

        if (subType == FilterSubTypeEnum::AUDIO) {
            audioFilterIds.push_back(filterConfig.getId());
        } else if (subType == FilterSubTypeEnum::VIDEO) {
            videoFilterIds.push_back(filterConfig.getId());
        } else if (subType == FilterSubTypeEnum::RECORD) {
            recordFilterIds.push_back(filterConfig.getId());
        }

        switch (mainType) {
            case FilterMainTypeEnum::TS: {
                ALOGW("[ConfigReader] filter main type is ts");