Merge changes from topic "nnapi-aidl-memory"
* changes:
Update NN utility code and VTS tests with new Memory type
Improve the structure of NNAPI AIDL Memory
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 912c686..7f9186f 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -419,7 +419,7 @@
</hal>
<hal format="aidl" optional="false">
<name>android.hardware.power</name>
- <version>1</version>
+ <version>1-2</version>
<interface>
<name>IPower</name>
<instance>default</instance>
diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
index 8d6e74a..ea40971 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
@@ -117,6 +117,9 @@
DECLARE_TYPED_TAG(ATTESTATION_ID_PRODUCT);
DECLARE_TYPED_TAG(ATTESTATION_ID_MANUFACTURER);
DECLARE_TYPED_TAG(ATTESTATION_ID_MODEL);
+DECLARE_TYPED_TAG(ATTESTATION_ID_SERIAL);
+DECLARE_TYPED_TAG(ATTESTATION_ID_IMEI);
+DECLARE_TYPED_TAG(ATTESTATION_ID_MEID);
DECLARE_TYPED_TAG(AUTH_TIMEOUT);
DECLARE_TYPED_TAG(BLOB_USAGE_REQUIREMENTS);
DECLARE_TYPED_TAG(BLOCK_MODE);
diff --git a/power/aidl/default/power-default.xml b/power/aidl/default/power-default.xml
index caf6ea2..9f56deb 100644
--- a/power/aidl/default/power-default.xml
+++ b/power/aidl/default/power-default.xml
@@ -1,6 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.power</name>
+ <version>2</version>
<fqname>IPower/default</fqname>
</hal>
</manifest>
diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl
index 69ec4ce..b05a0f3 100644
--- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl
+++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl
@@ -118,6 +118,7 @@
MISSING_ISSUER_SUBJECT = -82,
INVALID_ISSUER_SUBJECT = -83,
BOOT_LEVEL_EXCEEDED = -84,
+ HARDWARE_NOT_YET_AVAILABLE = -85,
UNIMPLEMENTED = -100,
VERSION_MISMATCH = -101,
UNKNOWN_ERROR = -1000,
diff --git a/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl b/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl
index 0e2c5f2..137e6b6 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl
@@ -107,6 +107,7 @@
MISSING_ISSUER_SUBJECT = -82,
INVALID_ISSUER_SUBJECT = -83,
BOOT_LEVEL_EXCEEDED = -84,
+ HARDWARE_NOT_YET_AVAILABLE = -85,
UNIMPLEMENTED = -100,
VERSION_MISMATCH = -101,
diff --git a/tv/tuner/1.0/default/Tuner.cpp b/tv/tuner/1.0/default/Tuner.cpp
index 9a6ecf7..c4f610e 100644
--- a/tv/tuner/1.0/default/Tuner.cpp
+++ b/tv/tuner/1.0/default/Tuner.cpp
@@ -139,6 +139,8 @@
// IP filter can be an MMTP filter's data source.
caps.linkCaps = {0x00, 0x00, 0x02, 0x00, 0x00};
+ // Support time filter testing
+ caps.bTimeFilter = true;
_hidl_cb(Result::SUCCESS, caps);
return Void();
}
diff --git a/tv/tuner/1.0/vts/functional/Android.bp b/tv/tuner/1.0/vts/functional/Android.bp
index c27a935..6187c73 100644
--- a/tv/tuner/1.0/vts/functional/Android.bp
+++ b/tv/tuner/1.0/vts/functional/Android.bp
@@ -35,6 +35,15 @@
"DescramblerTests.cpp",
"LnbTests.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",
@@ -49,9 +58,12 @@
],
shared_libs: [
"libbinder",
+ "libxml2",
],
data: [
":tuner_frontend_input_ts",
+ ":tuner_frontend_input_es",
+ ":tuner_testing_dynamic_configuration_V1_0",
],
test_suites: [
"general-tests",
diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.h b/tv/tuner/1.0/vts/functional/FrontendTests.h
index 4974ff3..33ff603 100644
--- a/tv/tuner/1.0/vts/functional/FrontendTests.h
+++ b/tv/tuner/1.0/vts/functional/FrontendTests.h
@@ -132,6 +132,7 @@
static AssertionResult failure() { return ::testing::AssertionFailure(); }
static AssertionResult success() { return ::testing::AssertionSuccess(); }
+ // TODO: replace with customized dvr input
void getDefaultSoftwareFrontendPlaybackConfig(DvrConfig& dvrConfig) {
PlaybackSettings playbackSettings{
.statusMask = 0xf,
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
index 891619a..92996f9 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
@@ -18,16 +18,15 @@
namespace {
-AssertionResult TunerBroadcastHidlTest::filterDataOutputTest(vector<string> /*goldenOutputFiles*/) {
+AssertionResult TunerBroadcastHidlTest::filterDataOutputTest() {
return filterDataOutputTestBase(mFilterTests);
}
-AssertionResult TunerPlaybackHidlTest::filterDataOutputTest(vector<string> /*goldenOutputFiles*/) {
+AssertionResult TunerPlaybackHidlTest::filterDataOutputTest() {
return filterDataOutputTestBase(mFilterTests);
}
-AssertionResult TunerDescramblerHidlTest::filterDataOutputTest(
- vector<string> /*goldenOutputFiles*/) {
+AssertionResult TunerDescramblerHidlTest::filterDataOutputTest() {
return filterDataOutputTestBase(mFilterTests);
}
@@ -62,8 +61,14 @@
}
uint32_t demuxId;
sp<IDemux> demux;
+ DemuxCapabilities caps;
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
+ // TODO: add time filter hardware support checker
+ ASSERT_TRUE(mDemuxTests.getDemuxCaps(caps));
+ if (!caps.bTimeFilter) {
+ return;
+ }
mFilterTests.setDemux(demux);
ASSERT_TRUE(mFilterTests.openTimeFilterInDemux());
ASSERT_TRUE(mFilterTests.setTimeStamp(filterConf.timeStamp));
@@ -75,9 +80,6 @@
void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
FrontendConfig frontendConf) {
- if (!frontendConf.enable) {
- return;
- }
uint32_t feId;
uint32_t demuxId;
sp<IDemux> demux;
@@ -106,7 +108,7 @@
ASSERT_TRUE(mFilterTests.startFilter(filterId));
// tune test
ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
- ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles));
+ ASSERT_TRUE(filterDataOutputTest());
ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mFilterTests.closeFilter(filterId));
@@ -119,12 +121,12 @@
LnbConfig lnbConf) {
vector<uint32_t> ids;
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
- if (!lnbConf.usingLnb) {
+ if (ids.size() == 0) {
return;
}
ASSERT_TRUE(ids.size() > 0);
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
- *mLnbId = ids[0];
+ mLnbId = &ids[0];
ASSERT_TRUE(mLnbTests.setLnbCallback());
ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
@@ -152,7 +154,7 @@
mDvrTests.startPlaybackInputThread(dvrConf.playbackInputFile, dvrConf.settings.playback());
ASSERT_TRUE(mDvrTests.startDvrPlayback());
ASSERT_TRUE(mFilterTests.startFilter(filterId));
- ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles));
+ ASSERT_TRUE(filterDataOutputTest());
mDvrTests.stopPlaybackThread();
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mDvrTests.stopDvrPlayback());
@@ -163,9 +165,6 @@
void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf,
FrontendConfig frontendConf, DvrConfig dvrConf) {
- if (!frontendConf.enable) {
- return;
- }
uint32_t feId;
uint32_t demuxId;
sp<IDemux> demux;
@@ -215,12 +214,12 @@
DvrConfig dvrConf, LnbConfig lnbConf) {
vector<uint32_t> ids;
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
- if (!lnbConf.usingLnb) {
+ if (ids.size() == 0) {
return;
}
ASSERT_TRUE(ids.size() > 0);
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
- *mLnbId = ids[0];
+ mLnbId = &ids[0];
ASSERT_TRUE(mLnbTests.setLnbCallback());
ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
@@ -271,9 +270,6 @@
void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> mediaFilterConfs,
FrontendConfig frontendConf,
DescramblerConfig descConfig) {
- if (!frontendConf.enable) {
- return;
- }
uint32_t feId;
uint32_t demuxId;
sp<IDemux> demux;
@@ -319,7 +315,7 @@
}
// tune test
ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
- ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles));
+ ASSERT_TRUE(filterDataOutputTest());
ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
for (id = filterIds.begin(); id != filterIds.end(); id++) {
ASSERT_TRUE(mFilterTests.stopFilter(*id));
@@ -337,21 +333,27 @@
TEST_P(TunerFrontendHidlTest, TuneFrontend) {
description("Tune one Frontend with specific setting and check Lock event");
- mFrontendTests.tuneTest(frontendArray[defaultFrontend]);
+ mFrontendTests.tuneTest(frontendMap[live.frontendId]);
}
TEST_P(TunerFrontendHidlTest, AutoScanFrontend) {
description("Run an auto frontend scan with specific setting and check lock scanMessage");
- mFrontendTests.scanTest(frontendScanArray[defaultScanFrontend], FrontendScanType::SCAN_AUTO);
+ mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_AUTO);
}
TEST_P(TunerFrontendHidlTest, BlindScanFrontend) {
description("Run an blind frontend scan with specific setting and check lock scanMessage");
- mFrontendTests.scanTest(frontendScanArray[defaultScanFrontend], FrontendScanType::SCAN_BLIND);
+ mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND);
}
TEST_P(TunerLnbHidlTest, OpenLnbByName) {
description("Open and configure an Lnb with name then send a diseqc msg to it.");
+ // TODO: add lnb hardware support checker
+ vector<uint32_t> ids;
+ ASSERT_TRUE(mLnbTests.getLnbIds(ids));
+ if (ids.size() == 0) {
+ return;
+ }
ASSERT_TRUE(mLnbTests.openLnbByName(lnbArray[LNB_EXTERNAL].name));
ASSERT_TRUE(mLnbTests.setLnbCallback());
ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB_EXTERNAL].voltage));
@@ -365,7 +367,7 @@
description("Open and configure an Lnb with specific settings then send a diseqc msg to it.");
vector<uint32_t> ids;
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
- if (!lnbArray[LNB0].usingLnb) {
+ if (ids.size() == 0) {
return;
}
ASSERT_TRUE(ids.size() > 0);
@@ -383,7 +385,7 @@
uint32_t feId;
uint32_t demuxId;
sp<IDemux> demux;
- mFrontendTests.getFrontendIdByType(frontendArray[defaultFrontend].type, feId);
+ mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
ASSERT_TRUE(feId != INVALID_ID);
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
@@ -403,7 +405,7 @@
uint32_t avSyncHwId;
sp<IFilter> mediaFilter;
- mFrontendTests.getFrontendIdByType(frontendArray[defaultFrontend].type, feId);
+ mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
ASSERT_TRUE(feId != INVALID_ID);
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
@@ -431,7 +433,7 @@
TEST_P(TunerFilterHidlTest, StartFilterInDemux) {
description("Open and start a filter in Demux.");
// TODO use paramterized tests
- configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendArray[defaultFrontend]);
+ configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]);
}
TEST_P(TunerFilterHidlTest, SetFilterLinkage) {
@@ -472,27 +474,27 @@
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast use case.");
- broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[defaultFrontend]);
+ broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendMap[live.frontendId]);
}
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowAudioFilterTest) {
description("Test Audio Filter functionality in Broadcast use case.");
- broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[defaultFrontend]);
+ broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendMap[live.frontendId]);
}
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowSectionFilterTest) {
description("Test Section Filter functionality in Broadcast use case.");
- broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[defaultFrontend]);
+ broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendMap[live.frontendId]);
}
TEST_P(TunerBroadcastHidlTest, IonBufferTest) {
description("Test the av filter data bufferring.");
- broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[defaultFrontend]);
+ broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]);
}
TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast with Lnb use case.");
- broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]);
+ broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]);
}
TEST_P(TunerBroadcastHidlTest, BroadcastEsDataFlowMediaFiltersTest) {
@@ -502,7 +504,7 @@
sp<IDemux> demux;
uint32_t filterId;
- mFrontendTests.getFrontendIdByType(frontendArray[defaultFrontend].type, feId);
+ mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
if (feId == INVALID_ID) {
// TODO broadcast test on Cuttlefish needs licensed ts input,
// these tests are runnable on vendor device with real frontend module
@@ -528,6 +530,7 @@
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId, filterArray[TS_VIDEO1].getMqDesc));
ASSERT_TRUE(mFilterTests.startFilter(filterId));
// tune test
+ // TODO: replace with customized dvr input
PlaybackSettings playbackSettings{
.statusMask = 0xf,
.lowThreshold = 0x1000,
@@ -542,9 +545,8 @@
};
dvrConfig.settings.playback(playbackSettings);
mFrontendTests.setSoftwareFrontendDvrConfig(dvrConfig);
- ASSERT_TRUE(
- mFrontendTests.tuneFrontend(frontendArray[defaultFrontend], true /*testWithDemux*/));
- ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles));
+ ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendMap[live.frontendId], true /*testWithDemux*/));
+ ASSERT_TRUE(filterDataOutputTest());
ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mFilterTests.closeFilter(filterId));
@@ -560,27 +562,40 @@
TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) {
description("Attach a single filter to the record dvr test.");
// TODO use paramterized tests
- attachSingleFilterToRecordDvrTest(filterArray[TS_RECORD0], frontendArray[defaultFrontend],
+ if (!record.support) {
+ return;
+ }
+ attachSingleFilterToRecordDvrTest(filterArray[TS_RECORD0], frontendMap[record.frontendId],
dvrArray[DVR_RECORD0]);
}
TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) {
description("Feed ts data from frontend to recording and test with ts record filter");
- recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[defaultFrontend],
+ if (!record.support) {
+ return;
+ }
+ recordSingleFilterTest(filterArray[TS_RECORD0], frontendMap[record.frontendId],
dvrArray[DVR_RECORD0]);
}
TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) {
description("Feed ts data from Fe with Lnb to recording and test with ts record filter");
- recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[DVBS], dvrArray[DVR_RECORD0]);
+ if (record.support) {
+ return;
+ }
+ recordSingleFilterTestWithLnb(filterArray[TS_RECORD0], frontendMap[lnbRecord.frontendId],
+ dvrArray[DVR_RECORD0], lnbArray[LNB0]);
}
TEST_P(TunerDescramblerHidlTest, CreateDescrambler) {
description("Create Descrambler");
+ if (descrambling.support) {
+ return;
+ }
uint32_t feId;
uint32_t demuxId;
sp<IDemux> demux;
- mFrontendTests.getFrontendIdByType(frontendArray[defaultFrontend].type, feId);
+ mFrontendTests.getFrontendIdByType(frontendMap[descrambling.frontendId].type, feId);
ASSERT_TRUE(feId != INVALID_ID);
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
@@ -594,10 +609,14 @@
TEST_P(TunerDescramblerHidlTest, ScrambledBroadcastDataFlowMediaFiltersTest) {
description("Test ts audio filter in scrambled broadcast use case");
+ if (descrambling.support) {
+ return;
+ }
set<FilterConfig> filterConfs;
filterConfs.insert(filterArray[TS_AUDIO0]);
filterConfs.insert(filterArray[TS_VIDEO1]);
- scrambledBroadcastTest(filterConfs, frontendArray[defaultFrontend], descramblerArray[DESC_0]);
+ scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId],
+ descramblerArray[DESC_0]);
}
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 5a23ca5..d1f6a45 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h
@@ -28,14 +28,24 @@
namespace {
-void initConfiguration() {
+bool initConfiguration() {
+ if (!TunerTestingConfigReader::checkConfigFileExists()) {
+ return false;
+ }
initFrontendConfig();
- initFrontendScanConfig();
+ connectHardwaresToTestCases();
+ if (!validateConnections()) {
+ ALOGW("[vts] failed to validate connections.");
+ return false;
+ }
+
initLnbConfig();
initFilterConfig();
initTimeFilterConfig();
initDvrConfig();
initDescramblerConfig();
+
+ return true;
}
AssertionResult filterDataOutputTestBase(FilterTests tests) {
@@ -53,7 +63,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
}
@@ -75,7 +85,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mLnbTests.setService(mService);
}
@@ -97,7 +107,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -123,7 +133,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -152,7 +162,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -173,7 +183,7 @@
LnbTests mLnbTests;
DvrTests mDvrTests;
- AssertionResult filterDataOutputTest(vector<string> goldenOutputFiles);
+ AssertionResult filterDataOutputTest();
void broadcastSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf);
void broadcastSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf,
@@ -191,7 +201,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -210,7 +220,7 @@
FilterTests mFilterTests;
DvrTests mDvrTests;
- AssertionResult filterDataOutputTest(vector<string> goldenOutputFiles);
+ AssertionResult filterDataOutputTest();
void playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf);
};
@@ -223,7 +233,7 @@
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -265,7 +275,7 @@
mCasService = IMediaCasService::getService();
ASSERT_NE(mService, nullptr);
ASSERT_NE(mCasService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -281,7 +291,7 @@
void scrambledBroadcastTest(set<struct FilterConfig> mediaFilterConfs,
FrontendConfig frontendConf, DescramblerConfig descConfig);
- AssertionResult filterDataOutputTest(vector<string> /*goldenOutputFiles*/);
+ AssertionResult filterDataOutputTest();
sp<ITuner> mService;
sp<IMediaCasService> mCasService;
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
index 834e296..384455b 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
@@ -21,6 +21,9 @@
#include <hidl/Status.h>
#include <hidlmemory/FrameworkUtils.h>
+#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;
@@ -54,7 +57,9 @@
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;
@@ -99,12 +104,6 @@
} Linkage;
typedef enum {
- DVBT,
- DVBS,
- FRONTEND_MAX,
-} Frontend;
-
-typedef enum {
LNB0,
LNB_EXTERNAL,
LNB_MAX,
@@ -116,11 +115,6 @@
} Diseqc;
typedef enum {
- SCAN_DVBT,
- SCAN_MAX,
-} FrontendScan;
-
-typedef enum {
DVR_RECORD0,
DVR_PLAYBACK0,
DVR_MAX,
@@ -145,15 +139,6 @@
uint64_t timeStamp;
};
-struct FrontendConfig {
- bool enable;
- bool isSoftwareFe;
- FrontendType type;
- FrontendSettings settings;
- vector<FrontendStatusType> tuneStatusTypes;
- vector<FrontendStatus> expectTuneStatuses;
-};
-
struct LnbConfig {
bool usingLnb;
string name;
@@ -162,14 +147,6 @@
LnbPosition position;
};
-struct ChannelConfig {
- int32_t frontendId;
- int32_t channelId;
- std::string channelName;
- DemuxTpid videoPid;
- DemuxTpid audioPid;
-};
-
struct DvrConfig {
DvrType type;
uint32_t bufferSize;
@@ -183,67 +160,78 @@
vector<uint8_t> hidlPvtData;
};
-static FrontendConfig frontendArray[FILTER_MAX];
-static FrontendConfig frontendScanArray[SCAN_MAX];
+// TODO: remove all the manual config array after the dynamic config refactoring is done.
static LnbConfig lnbArray[LNB_MAX];
static vector<uint8_t> diseqcMsgArray[DISEQC_MAX];
-static ChannelConfig channelArray[FRONTEND_MAX];
static FilterConfig filterArray[FILTER_MAX];
static TimeFilterConfig timeFilterArray[TIMER_MAX];
static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT];
static DvrConfig dvrArray[DVR_MAX];
static DescramblerConfig descramblerArray[DESC_MAX];
-static vector<string> goldenOutputFiles;
-static int defaultFrontend = DVBT;
-static int defaultScanFrontend = SCAN_DVBT;
+
+// Hardware configs
+static map<string, FrontendConfig> frontendMap;
+
+// Hardware and test cases connections
+static LiveBroadcastHardwareConnections live;
+static ScanHardwareConnections scan;
+static DvrRecordHardwareConnections record;
+static DescramblingHardwareConnections descrambling;
+static LnbLiveHardwareConnections lnbLive;
+static LnbRecordHardwareConnections lnbRecord;
/** Configuration array for the frontend tune test */
inline void initFrontendConfig() {
+ // The test will use the internal default fe is default fe is connected to any data flow without
+ // overriding in the xml config.
+ string defaultFeId = "FE_DEFAULT";
FrontendDvbtSettings dvbtSettings{
.frequency = 578000,
.transmissionMode = FrontendDvbtTransmissionMode::AUTO,
.bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ,
- .constellation = FrontendDvbtConstellation::AUTO,
- .hierarchy = FrontendDvbtHierarchy::AUTO,
- .hpCoderate = FrontendDvbtCoderate::AUTO,
- .lpCoderate = FrontendDvbtCoderate::AUTO,
- .guardInterval = FrontendDvbtGuardInterval::AUTO,
.isHighPriority = true,
- .standard = FrontendDvbtStandard::T,
};
- frontendArray[DVBT].type = FrontendType::DVBT, frontendArray[DVBT].settings.dvbt(dvbtSettings);
+ frontendMap[defaultFeId].type = FrontendType::DVBT;
+ frontendMap[defaultFeId].settings.dvbt(dvbtSettings);
+
vector<FrontendStatusType> types;
types.push_back(FrontendStatusType::DEMOD_LOCK);
FrontendStatus status;
status.isDemodLocked(true);
vector<FrontendStatus> statuses;
statuses.push_back(status);
- frontendArray[DVBT].tuneStatusTypes = types;
- frontendArray[DVBT].expectTuneStatuses = statuses;
- frontendArray[DVBT].isSoftwareFe = true;
- frontendArray[DVBT].enable = true;
- frontendArray[DVBS].type = FrontendType::DVBS;
- frontendArray[DVBS].enable = true;
- frontendArray[DVBS].isSoftwareFe = true;
+ frontendMap[defaultFeId].tuneStatusTypes = types;
+ frontendMap[defaultFeId].expectTuneStatuses = statuses;
+ frontendMap[defaultFeId].isSoftwareFe = true;
+
+ // Read customized config
+ TunerTestingConfigReader::readFrontendConfig1_0(frontendMap);
};
-/** Configuration array for the frontend scan test */
-inline void initFrontendScanConfig() {
- frontendScanArray[SCAN_DVBT].type = FrontendType::DVBT;
- frontendScanArray[SCAN_DVBT].settings.dvbt({
- .frequency = 578000,
- .transmissionMode = FrontendDvbtTransmissionMode::MODE_8K,
- .bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ,
- .constellation = FrontendDvbtConstellation::AUTO,
- .hierarchy = FrontendDvbtHierarchy::AUTO,
- .hpCoderate = FrontendDvbtCoderate::AUTO,
- .lpCoderate = FrontendDvbtCoderate::AUTO,
- .guardInterval = FrontendDvbtGuardInterval::AUTO,
- .isHighPriority = true,
- .standard = FrontendDvbtStandard::T,
- });
+/** 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::connectDvrRecord(record);
+ TunerTestingConfigReader::connectDescrambling(descrambling);
+ TunerTestingConfigReader::connectLnbLive(lnbLive);
+ TunerTestingConfigReader::connectLnbRecord(lnbRecord);
};
+inline bool validateConnections() {
+ bool feIsValid = frontendMap.find(live.frontendId) != frontendMap.end() &&
+ frontendMap.find(scan.frontendId) != frontendMap.end();
+ feIsValid &= record.support ? frontendMap.find(record.frontendId) != frontendMap.end() : true;
+ feIsValid &= descrambling.support
+ ? frontendMap.find(descrambling.frontendId) != frontendMap.end()
+ : true;
+ feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true;
+ feIsValid &=
+ lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true;
+ return feIsValid;
+}
+
+// TODO: remove all the manual configs after the dynamic config refactoring is done.
/** Configuration array for the Lnb test */
inline void initLnbConfig() {
lnbArray[LNB0].usingLnb = true;
diff --git a/tv/tuner/1.1/default/Tuner.cpp b/tv/tuner/1.1/default/Tuner.cpp
index 38b2a26..1e940ba 100644
--- a/tv/tuner/1.1/default/Tuner.cpp
+++ b/tv/tuner/1.1/default/Tuner.cpp
@@ -237,6 +237,8 @@
// IP filter can be an MMTP filter's data source.
caps.linkCaps = {0x00, 0x00, 0x02, 0x00, 0x00};
+ // Support time filter testing
+ caps.bTimeFilter = true;
_hidl_cb(Result::SUCCESS, caps);
return Void();
}
diff --git a/tv/tuner/config/Android.bp b/tv/tuner/config/Android.bp
new file mode 100644
index 0000000..ddbf3a7
--- /dev/null
+++ b/tv/tuner/config/Android.bp
@@ -0,0 +1,31 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+xsd_config {
+ name: "tuner_testing_dynamic_configuration_V1_0",
+ srcs: ["tuner_testing_dynamic_configuration.xsd"],
+ package_name: "android.media.tuner.testing.configuration.V1_0",
+ nullability: true,
+}
+
+xsd_config {
+ name: "tuner_testing_dynamic_configuration_V1_0_enums",
+ srcs: ["tuner_testing_dynamic_configuration.xsd"],
+ package_name: "android.media.tuner.testing.configuration.V1_0",
+ nullability: true,
+ enums_only: true,
+}
+
+xsd_config {
+ name: "tuner_testing_dynamic_configuration_V1_0_parser",
+ srcs: ["tuner_testing_dynamic_configuration.xsd"],
+ package_name: "android.media.tuner.testing.configuration.V1_0",
+ nullability: true,
+ parser_only: true,
+}
diff --git a/tv/tuner/config/TunerTestingConfigReader.h b/tv/tuner/config/TunerTestingConfigReader.h
new file mode 100644
index 0000000..5c7f564
--- /dev/null
+++ b/tv/tuner/config/TunerTestingConfigReader.h
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <android/hardware/tv/tuner/1.0/types.h>
+#include <android_media_tuner_testing_configuration_V1_0.h>
+#include <android_media_tuner_testing_configuration_V1_0_enums.h>
+#include <binder/MemoryDealer.h>
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+#include <hidl/Status.h>
+#include <hidlmemory/FrameworkUtils.h>
+
+using namespace std;
+using namespace android::media::tuner::testing::configuration::V1_0;
+
+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::FrontendDvbsSettings;
+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;
+
+const string configFilePath = "/vendor/etc/tuner_vts_config.xml";
+
+struct FrontendConfig {
+ bool isSoftwareFe;
+ FrontendType type;
+ FrontendSettings settings;
+ vector<FrontendStatusType> tuneStatusTypes;
+ vector<FrontendStatus> expectTuneStatuses;
+};
+
+struct LiveBroadcastHardwareConnections {
+ string frontendId;
+ /* string audioFilterId;
+ string videoFilterId;
+ list string of extra filters; */
+};
+
+struct ScanHardwareConnections {
+ string frontendId;
+};
+
+struct DvrRecordHardwareConnections {
+ bool support;
+ string frontendId;
+ /* string recordFilterId;
+ string dvrId; */
+};
+
+struct DescramblingHardwareConnections {
+ bool support;
+ string frontendId;
+ /* string descramblerId;
+ string audioFilterId;
+ string videoFilterId;
+ list string of extra filters; */
+};
+
+struct LnbLiveHardwareConnections {
+ bool support;
+ string frontendId;
+ /* string audioFilterId;
+ string videoFilterId;
+ list string of extra filters;
+ string lnbId; */
+};
+
+struct LnbRecordHardwareConnections {
+ bool support;
+ string frontendId;
+ /* string recordFilterId;
+ list string of extra filters;
+ string lnbId; */
+};
+
+struct TunerTestingConfigReader {
+ public:
+ static bool checkConfigFileExists() {
+ auto res = read(configFilePath.c_str());
+ if (res == nullopt) {
+ ALOGW("[ConfigReader] Couldn't read /vendor/etc/tuner_vts_config.xml."
+ "Please check tuner_testing_dynamic_configuration.xsd"
+ "and sample_tuner_vts_config.xml for more details on how to config Tune VTS.");
+ }
+ return (res != nullopt);
+ }
+
+ static void readFrontendConfig1_0(map<string, FrontendConfig>& frontendMap) {
+ auto hardwareConfig = getHardwareConfig();
+ if (hardwareConfig.hasFrontends()) {
+ // TODO: complete the tune status config
+ vector<FrontendStatusType> types;
+ types.push_back(FrontendStatusType::DEMOD_LOCK);
+ FrontendStatus status;
+ status.isDemodLocked(true);
+ vector<FrontendStatus> statuses;
+ statuses.push_back(status);
+
+ auto frontends = *hardwareConfig.getFirstFrontends();
+ for (auto feConfig : frontends.getFrontend()) {
+ string id = feConfig.getId();
+ if (id.compare(string("FE_DEFAULT")) == 0) {
+ // overrid default
+ frontendMap.erase(string("FE_DEFAULT"));
+ }
+ FrontendType type;
+ switch (feConfig.getType()) {
+ case FrontendTypeEnum::UNDEFINED:
+ type = FrontendType::UNDEFINED;
+ break;
+ // TODO: finish all other frontend settings
+ case FrontendTypeEnum::ANALOG:
+ type = FrontendType::ANALOG;
+ break;
+ case FrontendTypeEnum::ATSC:
+ type = FrontendType::ATSC;
+ break;
+ case FrontendTypeEnum::ATSC3:
+ type = FrontendType::ATSC3;
+ break;
+ case FrontendTypeEnum::DVBC:
+ type = FrontendType::DVBC;
+ break;
+ case FrontendTypeEnum::DVBS:
+ type = FrontendType::DVBS;
+ frontendMap[id].settings.dvbs(readDvbsFrontendSettings(feConfig));
+ break;
+ case FrontendTypeEnum::DVBT: {
+ type = FrontendType::DVBT;
+ frontendMap[id].settings.dvbt(readDvbtFrontendSettings(feConfig));
+ break;
+ }
+ case FrontendTypeEnum::ISDBS:
+ type = FrontendType::ISDBS;
+ break;
+ case FrontendTypeEnum::ISDBS3:
+ type = FrontendType::ISDBS3;
+ break;
+ case FrontendTypeEnum::ISDBT:
+ type = FrontendType::ISDBT;
+ break;
+ case FrontendTypeEnum::DTMB:
+ // dtmb will be handled in readFrontendConfig1_1;
+ continue;
+ case FrontendTypeEnum::UNKNOWN:
+ ALOGW("[ConfigReader] invalid frontend type");
+ return;
+ }
+ frontendMap[id].type = type;
+ frontendMap[id].isSoftwareFe = feConfig.getIsSoftwareFrontend();
+ // TODO: complete the tune status config
+ frontendMap[id].tuneStatusTypes = types;
+ frontendMap[id].expectTuneStatuses = statuses;
+ }
+ }
+ }
+
+ static void connectLiveBroadcast(LiveBroadcastHardwareConnections& live) {
+ auto liveConfig = getDataFlowConfiguration().getFirstClearLiveBroadcast();
+ live.frontendId = liveConfig->getFrontendConnection();
+ }
+
+ static void connectScan(ScanHardwareConnections& scan) {
+ auto scanConfig = getDataFlowConfiguration().getFirstScan();
+ scan.frontendId = scanConfig->getFrontendConnection();
+ }
+
+ static void connectDvrRecord(DvrRecordHardwareConnections& record) {
+ auto dataFlow = getDataFlowConfiguration();
+ if (!dataFlow.hasDvrRecord()) {
+ record.support = false;
+ return;
+ }
+ auto recordConfig = dataFlow.getFirstDvrRecord();
+ record.frontendId = recordConfig->getFrontendConnection();
+ }
+
+ static void connectDescrambling(DescramblingHardwareConnections& descrambling) {
+ auto dataFlow = getDataFlowConfiguration();
+ if (!dataFlow.hasDescrambling()) {
+ descrambling.support = false;
+ return;
+ }
+ auto descConfig = dataFlow.getFirstDescrambling();
+ descrambling.frontendId = descConfig->getFrontendConnection();
+ }
+
+ static void connectLnbLive(LnbLiveHardwareConnections& lnbLive) {
+ auto dataFlow = getDataFlowConfiguration();
+ if (!dataFlow.hasLnbLive()) {
+ lnbLive.support = false;
+ return;
+ }
+ auto lnbLiveConfig = dataFlow.getFirstLnbLive();
+ lnbLive.frontendId = lnbLiveConfig->getFrontendConnection();
+ }
+
+ static void connectLnbRecord(LnbRecordHardwareConnections& lnbRecord) {
+ auto dataFlow = getDataFlowConfiguration();
+ if (!dataFlow.hasLnbRecord()) {
+ lnbRecord.support = false;
+ return;
+ }
+ auto lnbRecordConfig = dataFlow.getFirstLnbRecord();
+ lnbRecord.frontendId = lnbRecordConfig->getFrontendConnection();
+ }
+
+ private:
+ static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) {
+ ALOGW("[ConfigReader] type is dvbt");
+ FrontendDvbtSettings dvbtSettings{
+ .frequency = (uint32_t)feConfig.getFrequency(),
+ };
+ if (!feConfig.hasDvbtFrontendSettings_optional()) {
+ ALOGW("[ConfigReader] no more dvbt settings");
+ return dvbtSettings;
+ }
+ dvbtSettings.transmissionMode = static_cast<FrontendDvbtTransmissionMode>(
+ feConfig.getFirstDvbtFrontendSettings_optional()->getTransmissionMode());
+ dvbtSettings.bandwidth = static_cast<FrontendDvbtBandwidth>(
+ feConfig.getFirstDvbtFrontendSettings_optional()->getBandwidth());
+ dvbtSettings.isHighPriority =
+ feConfig.getFirstDvbtFrontendSettings_optional()->getIsHighPriority();
+ return dvbtSettings;
+ }
+
+ static FrontendDvbsSettings readDvbsFrontendSettings(Frontend feConfig) {
+ ALOGW("[ConfigReader] type is dvbs");
+ FrontendDvbsSettings dvbsSettings{
+ .frequency = (uint32_t)feConfig.getFrequency(),
+ };
+ if (!feConfig.hasDvbsFrontendSettings_optional()) {
+ ALOGW("[ConfigReader] no more dvbs settings");
+ return dvbsSettings;
+ }
+ dvbsSettings.symbolRate = static_cast<uint32_t>(
+ feConfig.getFirstDvbsFrontendSettings_optional()->getSymbolRate());
+ dvbsSettings.inputStreamId = static_cast<uint32_t>(
+ feConfig.getFirstDvbsFrontendSettings_optional()->getInputStreamId());
+ return dvbsSettings;
+ }
+
+ static TunerConfiguration getTunerConfig() { return *read(configFilePath.c_str()); }
+
+ static HardwareConfiguration getHardwareConfig() {
+ return *getTunerConfig().getFirstHardwareConfiguration();
+ }
+
+ static DataFlowConfiguration getDataFlowConfiguration() {
+ return *getTunerConfig().getFirstDataFlowConfiguration();
+ }
+};
diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt
new file mode 100644
index 0000000..b0f410d
--- /dev/null
+++ b/tv/tuner/config/api/current.txt
@@ -0,0 +1,143 @@
+// Signature format: 2.0
+package android.media.tuner.testing.configuration.V1_0 {
+
+ public class DataFlowConfiguration {
+ ctor public DataFlowConfiguration();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.ClearLiveBroadcast getClearLiveBroadcast();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling getDescrambling();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord getDvrRecord();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive getLnbLive();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord getLnbRecord();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan getScan();
+ method public void setClearLiveBroadcast(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.ClearLiveBroadcast);
+ method public void setDescrambling(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling);
+ method public void setDvrRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord);
+ method public void setLnbLive(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive);
+ method public void setLnbRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord);
+ method public void setScan(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan);
+ }
+
+ public static class DataFlowConfiguration.ClearLiveBroadcast {
+ ctor public DataFlowConfiguration.ClearLiveBroadcast();
+ method @Nullable public String getFrontendConnection();
+ method public void setFrontendConnection(@Nullable String);
+ }
+
+ public static class DataFlowConfiguration.Descrambling {
+ ctor public DataFlowConfiguration.Descrambling();
+ method @Nullable public String getFrontendConnection();
+ method public void setFrontendConnection(@Nullable String);
+ }
+
+ public static class DataFlowConfiguration.DvrRecord {
+ ctor public DataFlowConfiguration.DvrRecord();
+ method @Nullable public String getFrontendConnection();
+ method public void setFrontendConnection(@Nullable String);
+ }
+
+ public static class DataFlowConfiguration.LnbLive {
+ ctor public DataFlowConfiguration.LnbLive();
+ method @Nullable public String getFrontendConnection();
+ method public void setFrontendConnection(@Nullable String);
+ }
+
+ public static class DataFlowConfiguration.LnbRecord {
+ ctor public DataFlowConfiguration.LnbRecord();
+ method @Nullable public String getFrontendConnection();
+ method public void setFrontendConnection(@Nullable String);
+ }
+
+ public static class DataFlowConfiguration.Scan {
+ ctor public DataFlowConfiguration.Scan();
+ method @Nullable public String getFrontendConnection();
+ method public void setFrontendConnection(@Nullable String);
+ }
+
+ public class DvbsFrontendSettings {
+ ctor public DvbsFrontendSettings();
+ method @Nullable public java.math.BigInteger getInputStreamId();
+ method @Nullable public java.math.BigInteger getSymbolRate();
+ method public void setInputStreamId(@Nullable java.math.BigInteger);
+ method public void setSymbolRate(@Nullable java.math.BigInteger);
+ }
+
+ public class DvbtFrontendSettings {
+ ctor public DvbtFrontendSettings();
+ method @Nullable public java.math.BigInteger getBandwidth();
+ method @Nullable public java.math.BigInteger getIsHighPriority();
+ method @Nullable public java.math.BigInteger getTransmissionMode();
+ method public void setBandwidth(@Nullable java.math.BigInteger);
+ method public void setIsHighPriority(@Nullable java.math.BigInteger);
+ method public void setTransmissionMode(@Nullable java.math.BigInteger);
+ }
+
+ public class Frontend {
+ ctor public Frontend();
+ method @Nullable public java.math.BigInteger getConnectToCicamId();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbsFrontendSettings getDvbsFrontendSettings_optional();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbtFrontendSettings getDvbtFrontendSettings_optional();
+ method @Nullable public java.math.BigInteger getEndFrequency();
+ method @Nullable public java.math.BigInteger getFrequency();
+ method @Nullable public String getId();
+ method @Nullable public boolean getIsSoftwareFrontend();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum getType();
+ method public void setConnectToCicamId(@Nullable java.math.BigInteger);
+ method public void setDvbsFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.DvbsFrontendSettings);
+ method public void setDvbtFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.DvbtFrontendSettings);
+ method public void setEndFrequency(@Nullable java.math.BigInteger);
+ method public void setFrequency(@Nullable java.math.BigInteger);
+ method public void setId(@Nullable String);
+ method public void setIsSoftwareFrontend(@Nullable boolean);
+ method public void setType(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum);
+ }
+
+ public enum FrontendTypeEnum {
+ method @NonNull public String getRawName();
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ANALOG;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ATSC;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ATSC3;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum DTMB;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum DVBC;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum DVBS;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum DVBT;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ISDBS;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ISDBS3;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ISDBT;
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum UNDEFINED;
+ }
+
+ public class HardwareConfiguration {
+ ctor public HardwareConfiguration();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Frontends getFrontends();
+ method public void setFrontends(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Frontends);
+ }
+
+ public static class HardwareConfiguration.Frontends {
+ ctor public HardwareConfiguration.Frontends();
+ method @Nullable public java.util.List<android.media.tuner.testing.configuration.V1_0.Frontend> getFrontend();
+ }
+
+ public class TunerConfiguration {
+ ctor public TunerConfiguration();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration getDataFlowConfiguration();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration getHardwareConfiguration();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.Version getVersion();
+ method public void setDataFlowConfiguration(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration);
+ method public void setHardwareConfiguration(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration);
+ method public void setVersion(@Nullable android.media.tuner.testing.configuration.V1_0.Version);
+ }
+
+ public enum Version {
+ method @NonNull public String getRawName();
+ enum_constant public static final android.media.tuner.testing.configuration.V1_0.Version _1_0;
+ }
+
+ public class XmlParser {
+ ctor public XmlParser();
+ method @Nullable public static android.media.tuner.testing.configuration.V1_0.TunerConfiguration read(@NonNull java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method @Nullable public static String readText(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static void skip(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
+}
+
diff --git a/tv/tuner/config/api/last_current.txt b/tv/tuner/config/api/last_current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tv/tuner/config/api/last_current.txt
diff --git a/tv/tuner/config/api/last_removed.txt b/tv/tuner/config/api/last_removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tv/tuner/config/api/last_removed.txt
diff --git a/tv/tuner/config/api/removed.txt b/tv/tuner/config/api/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/tv/tuner/config/api/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/tv/tuner/config/sample_tuner_vts_config.xml b/tv/tuner/config/sample_tuner_vts_config.xml
new file mode 100644
index 0000000..c4080d9
--- /dev/null
+++ b/tv/tuner/config/sample_tuner_vts_config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- The Sample Tuner Testing Configuration.
+ Name the customized xml with "tuner_vts_config.xml" and push into the device
+ "/vendor/etc" path. Please use "tuner_testing_dynamic_configuration.xsd" to verify the xml.
+ The version section contains a “version” tag in the form “major.minor” e.g version=”1.0”
+ This shows the tuner dynamic configuration version. -->
+<TunerConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <!-- Hardware Configuration section contains the configurations of all the hardwares
+ that would be used in the tests. In the "dataFlowConfiguration" section, each data flow
+ under test has its required/optional hardwares. The ids configured in the
+ "dataFlowConfiguration" would be used to connect the hardware to each data flow test. -->
+ <hardwareConfiguration>
+ <!-- Frontends section:
+ This section contains configurations of all the frontends that would be used
+ in the tests.
+ - This section is optional and can be skipped to use the default fe settings.
+ - The default settings can be found in the sample_tuner_vts_configurations.xml.
+ - The users can also override the default frontend settings using id="FE_DEFAULT".
+ - The users can configure 1 or more frontend elements in the frontends sections.
+
+ Each frontend element contain the following attributes:
+ "id": unique id of the frontend that could be used to connect to the test the
+ "dataFlowConfiguration"
+ "type": the frontend type. The enums are defined in the xsd.
+ "isSoftwareFrontend": if the test environment is using hardware or software
+ frontend. If using software, a ts input file path needs to be configured.
+ "softwareFeInputPath": used as the source of the software frontend.
+ "connectToCicamId": if the device supports frontend connecting to cicam, the target
+ cicam id needs to be configured here. Supported in Tuner 1.1 or higher.
+ "frequency": the frequency used to configure tune and scan.
+ "endFrequency": the end frequency of scan. Supported in Tuner 1.1 or higher.
+
+ Each frontend element also contains one and only one type-related "frontendSettings".
+ - The settings type should match the frontend "type" attribute.
+ - For example, when frontend type="DVBT", dvbtFrontendSettings can be configured.
+ - This is optional and skipping the settings would pass a setting with frequency
+ config only to the hal.
+ -->
+ <frontends>
+ <frontend id="FE_DEFAULT" type="DVBT" isSoftwareFrontend="true"
+ connectToCicamId="0" frequency="578000" endFrequency="800000">
+ <dvbtFrontendSettings bandwidth="8" transmissionMode="1" isHighPriority="1"/>
+ </frontend>
+ <frontend id="FE_DVBS_0" type="DVBS" isSoftwareFrontend="true"
+ connectToCicamId="0" frequency="578000" endFrequency="800000">
+ </frontend>
+ </frontends>
+ </hardwareConfiguration>
+
+ <!-- Data flow configuration section connects each data flow under test to the ids of the
+ hardwares that would be used during the tests. -->
+ <dataFlowConfiguration>
+ <clearLiveBroadcast frontendConnection="FE_DEFAULT"/>
+ <scan frontendConnection="FE_DEFAULT"/>
+ <descrambling frontendConnection="FE_DEFAULT"/>
+ <dvrRecord frontendConnection="FE_DEFAULT"/>
+ <lnbLive frontendConnection="FE_DVBS_0"/>
+ <lnbRecord frontendConnection="FE_DVBS_0"/>
+ </dataFlowConfiguration>
+</TunerConfiguration>
diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd
new file mode 100644
index 0000000..cd8b061
--- /dev/null
+++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema version="2.0"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <!-- List the dynamic config versions supported by tuner testing. -->
+ <xs:simpleType name="version">
+ <xs:restriction base="xs:decimal">
+ <xs:enumeration value="1.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- FRONTEND SESSION -->
+ <xs:simpleType name="frontendId">
+ <!-- Frontend id must be either FE_DEFAULT or FE_TYPE_NUM
+ <frontend id="FE_DVBS_0"/>
+ -->
+ <xs:restriction base="xs:string">
+ <xs:pattern value="FE_DEFAULT|FE_[A-Z]+_[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="frontendTypeEnum">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="UNDEFINED" />
+ <xs:enumeration value="ANALOG" />
+ <xs:enumeration value="ATSC" />
+ <xs:enumeration value="ATSC3"/>
+ <xs:enumeration value="DVBC"/>
+ <xs:enumeration value="DVBS"/>
+ <xs:enumeration value="DVBT"/>
+ <xs:enumeration value="ISDBS"/>
+ <xs:enumeration value="ISDBS3"/>
+ <xs:enumeration value="ISDBT"/>
+ <xs:enumeration value="DTMB"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="dvbtFrontendSettings">
+ <xs:attribute name="bandwidth" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="transmissionMode" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="isHighPriority" type="xs:nonNegativeInteger" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="dvbsFrontendSettings">
+ <xs:attribute name="inputStreamId" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="symbolRate" type="xs:nonNegativeInteger" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="frontend">
+ <xs:annotation>
+ <xs:documentation>
+ Each frontend element contain the following attributes:
+ "id": unique id of the frontend that could be used to connect to the test the
+ "dataFlowConfiguration"
+ "type": the frontend type. The enums are defined in the xsd.
+ "isSoftwareFrontend": if the test environment is using hardware or software
+ frontend. If using software, a ts input file path needs to be configured.
+ "softwareFeInputPath": used as the source of the software frontend.
+ "connectToCicamId": if the device supports frontend connecting to cicam, the
+ target cicam id needs to be configured here. Supported in Tuner 1.1 or
+ higher.
+ "frequency": the frequency used to configure tune and scan.
+ "endFrequency": the end frequency of scan. Supported in Tuner 1.1 or higher.
+
+ Each frontend element also contains at most one type-related "frontendSettings".
+ - The settings type should match the frontend "type" attribute.
+ - For example, when frontend type="DVBT", dvbtFrontendSettings can be
+ configured.
+ - This is optional and skipping the settings would pass a setting with frequency
+ config only to the hal.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <!-- TODO: finish all the frontend settings structures. -->
+ <!--xs:element name="analog" type="analogSettings"/>
+ <xs:element name="atsc" type="atscSettings"/>
+ <xs:element name="atsc3" type="atsc3Settings"/>
+ <xs:element name="dvbc" type="dvbcSettings"/-->
+ <xs:element name="dvbsFrontendSettings" type="dvbsFrontendSettings"/>
+ <xs:element name="dvbtFrontendSettings" type="dvbtFrontendSettings"/>
+ <!--xs:element name="isdbs" type="isdbsSettings"/>
+ <xs:element name="isdbs3" type="isdbs3Settings"/>
+ <xs:element name="isdbt" type="isdbtSettings"/>
+ <xs:element name="dtmb" type="dtmbSettings"/-->
+ </xs:choice>
+ <xs:attribute name="id" type="frontendId" use="required"/>
+ <xs:attribute name="type" type="frontendTypeEnum" use="required"/>
+ <xs:attribute name="isSoftwareFrontend" type="xs:boolean" use="required"/>
+ <!-- A dvr connection is required in the data flow config section when
+ "isSoftwareFrontend" is true. -->
+ <xs:attribute name="frequency" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="connectToCicamId" type="xs:nonNegativeInteger" use="optional"/>
+ <xs:attribute name="endFrequency" type="xs:nonNegativeInteger" use="optional"/>
+ </xs:complexType>
+
+ <!-- HARDWARE CONFIGURATION SESSION -->
+ <xs:complexType name="hardwareConfiguration">
+ <xs:sequence>
+ <xs:element name="frontends" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ This section contains configurations of all the frontends that would be
+ used in the tests.
+ - This section is optional and can be skipped to use the default
+ fe settings.
+ - The default settings can be found in the
+ sample_tuner_vts_configurations.xml.
+ - The users can also override the default frontend settings using
+ id="FE_DEFAULT".
+ - The users can configure 1 or more frontend elements in the
+ frontends sections.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="frontend" type="frontend" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- DATA FLOW CONFIGURATION SESSION -->
+ <xs:complexType name="dataFlowConfiguration">
+ <xs:sequence>
+ <xs:element name="clearLiveBroadcast" minOccurs="1" maxOccurs="1">
+ <xs:complexType>
+ <!-- TODO: add optional dvr config for software input -->
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="scan" minOccurs="1" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="descrambling" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="dvrRecord" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="lnbLive" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="lnbRecord" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- Full Tuner Configuration. This is the root element of the configuration xml. -->
+ <xs:element name="TunerConfiguration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="hardwareConfiguration" type="hardwareConfiguration" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="dataFlowConfiguration" type="dataFlowConfiguration" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="version" type="version"/>
+ </xs:complexType>
+ <xs:key name="frontendIdUniqueness">
+ <xs:selector xpath="hardwareConfiguration/frontends/frontend"/>
+ <xs:field xpath="@id"/>
+ </xs:key>
+ </xs:element>
+</xs:schema>