diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 9c1d45791e..4c92665b63 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -441,11 +441,9 @@ TEST_P(TunerFilterHidlTest, SetFilterLinkage) { if (caps.linkCaps[i] & (bitMask << j)) { uint32_t sourceFilterId; uint32_t sinkFilterId; - ASSERT_TRUE(mFilterTests.openFilterInDemux(filterLinkageTypes[SOURCE][i], - FMQ_SIZE_16M)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(getLinkageFilterType(i), FMQ_SIZE_16M)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(sourceFilterId)); - ASSERT_TRUE( - mFilterTests.openFilterInDemux(filterLinkageTypes[SINK][j], FMQ_SIZE_16M)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(getLinkageFilterType(j), FMQ_SIZE_16M)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(sinkFilterId)); ASSERT_TRUE(mFilterTests.setFilterDataSource(sourceFilterId, sinkFilterId)); ASSERT_TRUE(mFilterTests.setFilterDataSourceToDemux(sinkFilterId)); @@ -561,7 +559,7 @@ TEST_P(TunerDescramblerHidlTest, ScrambledBroadcastDataFlowMediaFiltersTest) { filterConfs.insert(static_cast(filterMap[descrambling.audioFilterId])); filterConfs.insert(static_cast(filterMap[descrambling.videoFilterId])); scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId], - descramblerArray[DESC_0]); + descramblerMap[descrambling.descramblerId]); } INSTANTIATE_TEST_SUITE_P( diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h index bf8e383294..e2406042df 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h @@ -20,6 +20,9 @@ #include "LnbTests.h" using android::hardware::tv::tuner::V1_0::DataFormat; +using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxMmtpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxTlvFilterType; using android::hardware::tv::tuner::V1_0::IDescrambler; static AssertionResult success() { @@ -37,14 +40,12 @@ bool initConfiguration() { initDvrConfig(); initLnbConfig(); initTimeFilterConfig(); + initDescramblerConfig(); connectHardwaresToTestCases(); if (!validateConnections()) { ALOGW("[vts] failed to validate connections."); return false; } - - initDescramblerConfig(); - return true; } @@ -148,6 +149,29 @@ class TunerFilterHidlTest : public testing::TestWithParam { void configSingleFilterInDemuxTest(FilterConfig filterConf, FrontendConfig frontendConf); void testTimeFilter(TimeFilterConfig filterConf); + DemuxFilterType getLinkageFilterType(int bit) { + DemuxFilterType type; + type.mainType = static_cast(1 << bit); + switch (type.mainType) { + case DemuxFilterMainType::TS: + type.subType.tsFilterType(DemuxTsFilterType::UNDEFINED); + break; + case DemuxFilterMainType::MMTP: + type.subType.mmtpFilterType(DemuxMmtpFilterType::UNDEFINED); + break; + case DemuxFilterMainType::IP: + type.subType.ipFilterType(DemuxIpFilterType::UNDEFINED); + break; + case DemuxFilterMainType::TLV: + type.subType.tlvFilterType(DemuxTlvFilterType::UNDEFINED); + break; + case DemuxFilterMainType::ALP: + type.subType.alpFilterType(DemuxAlpFilterType::UNDEFINED); + break; + } + return type; + } + sp mService; FrontendTests mFrontendTests; DemuxTests mDemuxTests; diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h index bdf94dc4e6..65f8615ad8 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h @@ -23,82 +23,23 @@ #include "../../../config/TunerTestingConfigReader.h" -// TODO: remove unnecessary imports after config reader refactoring is done. -using android::hardware::tv::tuner::V1_0::DataFormat; -using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType; -using android::hardware::tv::tuner::V1_0::DemuxFilterEvent; using android::hardware::tv::tuner::V1_0::DemuxFilterMainType; -using android::hardware::tv::tuner::V1_0::DemuxFilterSettings; -using android::hardware::tv::tuner::V1_0::DemuxFilterType; -using android::hardware::tv::tuner::V1_0::DemuxIpFilterType; -using android::hardware::tv::tuner::V1_0::DemuxMmtpFilterType; -using android::hardware::tv::tuner::V1_0::DemuxRecordScIndexType; -using android::hardware::tv::tuner::V1_0::DemuxTlvFilterType; -using android::hardware::tv::tuner::V1_0::DemuxTpid; using android::hardware::tv::tuner::V1_0::DemuxTsFilterType; -using android::hardware::tv::tuner::V1_0::DvrSettings; -using android::hardware::tv::tuner::V1_0::DvrType; using android::hardware::tv::tuner::V1_0::FrontendDvbtBandwidth; -using android::hardware::tv::tuner::V1_0::FrontendDvbtCoderate; -using android::hardware::tv::tuner::V1_0::FrontendDvbtConstellation; -using android::hardware::tv::tuner::V1_0::FrontendDvbtGuardInterval; -using android::hardware::tv::tuner::V1_0::FrontendDvbtHierarchy; using android::hardware::tv::tuner::V1_0::FrontendDvbtSettings; -using android::hardware::tv::tuner::V1_0::FrontendDvbtStandard; using android::hardware::tv::tuner::V1_0::FrontendDvbtTransmissionMode; using android::hardware::tv::tuner::V1_0::FrontendSettings; using android::hardware::tv::tuner::V1_0::FrontendStatus; using android::hardware::tv::tuner::V1_0::FrontendStatusType; using android::hardware::tv::tuner::V1_0::FrontendType; -using android::hardware::tv::tuner::V1_0::LnbPosition; -using android::hardware::tv::tuner::V1_0::LnbTone; -using android::hardware::tv::tuner::V1_0::LnbVoltage; -using android::hardware::tv::tuner::V1_0::PlaybackSettings; -using android::hardware::tv::tuner::V1_0::RecordSettings; using namespace std; using namespace android::media::tuner::testing::configuration::V1_0; -// TODO: remove all the constants and structs after config reader refactoring is done. -const uint32_t FMQ_SIZE_512K = 0x80000; -const uint32_t FMQ_SIZE_1M = 0x100000; const uint32_t FMQ_SIZE_4M = 0x400000; const uint32_t FMQ_SIZE_16M = 0x1000000; -#define CLEAR_KEY_SYSTEM_ID 0xF6D8 -#define FILTER_MAIN_TYPE_BIT_COUNT 32 -#define PROVISION_STR \ - "{ " \ - " \"id\": 21140844, " \ - " \"name\": \"Test Title\", " \ - " \"lowercase_organization_name\": \"Android\", " \ - " \"asset_key\": { " \ - " \"encryption_key\": \"nezAr3CHFrmBR9R8Tedotw==\" " \ - " }, " \ - " \"cas_type\": 1, " \ - " \"track_types\": [ ] " \ - "} " - -typedef enum { - SOURCE, - SINK, - LINKAGE_DIR, -} Linkage; - -typedef enum { - DESC_0, - DESC_MAX, -} Descrambler; - -struct DescramblerConfig { - uint32_t casSystemId; - string provisionStr; - vector hidlPvtData; -}; - -// TODO: remove all the manual config array after the dynamic config refactoring is done. -static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT]; -static DescramblerConfig descramblerArray[DESC_MAX]; +#define FILTER_MAIN_TYPE_BIT_COUNT 5 // Hardware configs static map frontendMap; @@ -107,6 +48,7 @@ static map dvrMap; static map lnbMap; static map timeFilterMap; static map> diseqcMsgMap; +static map descramblerMap; // Hardware and test cases connections static LiveBroadcastHardwareConnections live; @@ -187,6 +129,12 @@ inline void initTimeFilterConfig() { TunerTestingConfigReader::readTimeFilterConfig1_0(timeFilterMap); }; +/** Config all the descramblers that would be used in the tests */ +inline void initDescramblerConfig() { + // Read customized config + TunerTestingConfigReader::readDescramblerConfig1_0(descramblerMap); +}; + /** Read the vendor configurations of which hardware to use for each test cases/data flows */ inline void connectHardwaresToTestCases() { TunerTestingConfigReader::connectLiveBroadcast(live); @@ -265,6 +213,16 @@ inline bool validateConnections() { return false; } + bool descramblerIsValid = + descrambling.support + ? descramblerMap.find(descrambling.descramblerId) != descramblerMap.end() + : true; + + if (!descramblerIsValid) { + ALOGW("[vts config] dynamic config descrambler connection is invalid."); + return false; + } + bool diseqcMsgIsValid = true; if (lnbLive.support) { for (auto msgName : lnbLive.diseqcMsgs) { @@ -284,11 +242,3 @@ inline bool validateConnections() { return true; } - -// TODO: remove all the manual configs after the dynamic config refactoring is done. -/** Configuration array for the descrambler test */ -inline void initDescramblerConfig() { - descramblerArray[DESC_0].casSystemId = CLEAR_KEY_SYSTEM_ID; - descramblerArray[DESC_0].provisionStr = PROVISION_STR; - descramblerArray[DESC_0].hidlPvtData.resize(256); -}; diff --git a/tv/tuner/config/TunerTestingConfigReader.h b/tv/tuner/config/TunerTestingConfigReader.h index bc35ac4128..90499c414c 100644 --- a/tv/tuner/config/TunerTestingConfigReader.h +++ b/tv/tuner/config/TunerTestingConfigReader.h @@ -66,6 +66,18 @@ using android::hardware::tv::tuner::V1_0::RecordSettings; const string configFilePath = "/vendor/etc/tuner_vts_config.xml"; const string emptyHardwareId = ""; +#define PROVISION_STR \ + "{ " \ + " \"id\": 21140844, " \ + " \"name\": \"Test Title\", " \ + " \"lowercase_organization_name\": \"Android\", " \ + " \"asset_key\": { " \ + " \"encryption_key\": \"nezAr3CHFrmBR9R8Tedotw==\" " \ + " }, " \ + " \"cas_type\": 1, " \ + " \"track_types\": [ ] " \ + "} " + struct FrontendConfig { bool isSoftwareFe; FrontendType type; @@ -101,6 +113,12 @@ struct TimeFilterConfig { uint64_t timeStamp; }; +struct DescramblerConfig { + uint32_t casSystemId; + string provisionStr; + vector hidlPvtData; +}; + struct LiveBroadcastHardwareConnections { string frontendId; string dvrSoftwareFeId; @@ -139,8 +157,8 @@ struct DescramblingHardwareConnections { string dvrSoftwareFeId; string audioFilterId; string videoFilterId; - /* string descramblerId; - list string of extra filters; */ + string descramblerId; + /* list string of extra filters; */ }; struct LnbLiveHardwareConnections { @@ -326,6 +344,31 @@ struct TunerTestingConfigReader { } } + static void readDescramblerConfig1_0(map& descramblerMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasDescramblers()) { + auto descramblers = *hardwareConfig.getFirstDescramblers(); + for (auto descramblerConfig : descramblers.getDescrambler()) { + string id = descramblerConfig.getId(); + descramblerMap[id].casSystemId = + static_cast(descramblerConfig.getCasSystemId()); + if (descramblerConfig.hasProvisionStr()) { + descramblerMap[id].provisionStr = descramblerConfig.getProvisionStr(); + } else { + descramblerMap[id].provisionStr = PROVISION_STR; + } + if (descramblerConfig.hasSesstionPrivatData()) { + auto privateData = descramblerConfig.getSesstionPrivatData(); + int size = privateData.size(); + descramblerMap[id].hidlPvtData.resize(size); + memcpy(descramblerMap[id].hidlPvtData.data(), privateData.data(), size); + } else { + descramblerMap[id].hidlPvtData.resize(256); + } + } + } + } + static void readDiseqcMessages(map>& diseqcMsgMap) { auto hardwareConfig = getHardwareConfig(); if (hardwareConfig.hasDiseqcMessages()) { @@ -420,6 +463,7 @@ struct TunerTestingConfigReader { } auto descConfig = *dataFlow.getFirstDescrambling(); descrambling.frontendId = descConfig.getFrontendConnection(); + descrambling.descramblerId = descConfig.getDescramblerConnection(); descrambling.audioFilterId = descConfig.getAudioFilterConnection(); descrambling.videoFilterId = descConfig.getVideoFilterConnection(); if (descConfig.hasDvrSoftwareFeConnection()) { diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 78e958be44..4255a60d16 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -46,10 +46,12 @@ package android.media.tuner.testing.configuration.V1_0 { public static class DataFlowConfiguration.Descrambling { ctor public DataFlowConfiguration.Descrambling(); method @Nullable public String getAudioFilterConnection(); + method @Nullable public String getDescramblerConnection(); method @Nullable public String getDvrSoftwareFeConnection(); method @Nullable public String getFrontendConnection(); method @Nullable public String getVideoFilterConnection(); method public void setAudioFilterConnection(@Nullable String); + method public void setDescramblerConnection(@Nullable String); method public void setDvrSoftwareFeConnection(@Nullable String); method public void setFrontendConnection(@Nullable String); method public void setVideoFilterConnection(@Nullable String); @@ -119,6 +121,18 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setTimeFilterConnection(@Nullable String); } + public class Descrambler { + ctor public Descrambler(); + method @Nullable public java.math.BigInteger getCasSystemId(); + method @Nullable public String getId(); + method @Nullable public String getProvisionStr(); + method @Nullable public java.util.List getSesstionPrivatData(); + method public void setCasSystemId(@Nullable java.math.BigInteger); + method public void setId(@Nullable String); + method public void setProvisionStr(@Nullable String); + method public void setSesstionPrivatData(@Nullable java.util.List); + } + public class DiseqcMessage { ctor public DiseqcMessage(); method @Nullable public java.util.List getMsgBody(); @@ -269,12 +283,14 @@ package android.media.tuner.testing.configuration.V1_0 { public class HardwareConfiguration { ctor public HardwareConfiguration(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Descramblers getDescramblers(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.DiseqcMessages getDiseqcMessages(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Dvrs getDvrs(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Filters getFilters(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Frontends getFrontends(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Lnbs getLnbs(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.TimeFilters getTimeFilters(); + method public void setDescramblers(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Descramblers); method public void setDiseqcMessages(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.DiseqcMessages); method public void setDvrs(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Dvrs); method public void setFilters(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Filters); @@ -283,6 +299,11 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setTimeFilters(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.TimeFilters); } + public static class HardwareConfiguration.Descramblers { + ctor public HardwareConfiguration.Descramblers(); + method @Nullable public java.util.List getDescrambler(); + } + public static class HardwareConfiguration.DiseqcMessages { ctor public HardwareConfiguration.DiseqcMessages(); method @Nullable public java.util.List getDiseqcMessage(); diff --git a/tv/tuner/config/sample_tuner_vts_config.xml b/tv/tuner/config/sample_tuner_vts_config.xml index 6a3e814e83..570171edb7 100644 --- a/tv/tuner/config/sample_tuner_vts_config.xml +++ b/tv/tuner/config/sample_tuner_vts_config.xml @@ -168,6 +168,22 @@ + + + + + + + + + + + + + + + + + + Each descrambler element contain the following attributes: + "id": unique id of the descrambler that could be used to connect to the test the + "dataFlowConfiguration" + "casSystemId": the cas system id to connect to the descrambler. + "provisionStr": the provision string to use with the cas plugin. + "sesstionPrivatData": the session private data used to open the cas session. + + + + + + + + @@ -483,6 +511,23 @@ + + + + + This section contains configurations of all the descramblers that would + be used in the tests. + - This section is optional and can be skipped if descrambling is not + supported. + - The users can configure 1 or more descrambler elements in the + descramblers sections. + + + + + + + @@ -509,6 +554,7 @@ + @@ -590,5 +636,9 @@ + + + +