From e106f475b6cfdf9abcc560d723a0148d5c4f3d82 Mon Sep 17 00:00:00 2001 From: Hongguang Date: Tue, 11 Jan 2022 12:09:22 -0800 Subject: [PATCH] Add API to filter out unnecessary PIDs from frontend output. Bug: 213287138 Test: atest VtsHalTvTunerTargetTest Change-Id: I075d68d722b2804f54d57a1ac9c350e2a9724ae3 --- .../current/android/hardware/tv/tuner/IFrontend.aidl | 1 + tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl | 9 +++++++++ tv/tuner/aidl/default/Frontend.cpp | 7 +++++++ tv/tuner/aidl/default/Frontend.h | 1 + tv/tuner/aidl/vts/functional/FrontendTests.cpp | 8 ++++++++ tv/tuner/aidl/vts/functional/FrontendTests.h | 1 + tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h | 9 +++++++-- tv/tuner/config/api/current.txt | 2 ++ tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml | 8 ++++++-- tv/tuner/config/tuner_testing_dynamic_configuration.xsd | 3 +++ 10 files changed, 45 insertions(+), 4 deletions(-) diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IFrontend.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IFrontend.aidl index e7aa070552..e240e40666 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IFrontend.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IFrontend.aidl @@ -46,4 +46,5 @@ interface IFrontend { int linkCiCam(in int ciCamId); void unlinkCiCam(in int ciCamId); String getHardwareInfo(); + void removeOutputPid(int pid); } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl index 5b3ce39c29..f8248e660b 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl @@ -146,4 +146,13 @@ interface IFrontend { * @return the frontend hardware information. */ String getHardwareInfo(); + + /** + * Filter out unnecessary PID from frontend output. + * + * @param pid specify the PID will be filtered out. + * + * @return UNAVAILABLE if the frontend doesn’t support PID filtering out. + */ + void removeOutputPid(int pid); } diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp index 714612d006..9fcb432ed3 100644 --- a/tv/tuner/aidl/default/Frontend.cpp +++ b/tv/tuner/aidl/default/Frontend.cpp @@ -759,6 +759,13 @@ binder_status_t Frontend::dump(int fd, const char** /* args */, uint32_t /* numA return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus Frontend::removeOutputPid(int32_t /* in_pid */) { + ALOGV("%s", __FUNCTION__); + + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::UNAVAILABLE)); +} + FrontendType Frontend::getFrontendType() { return mType; } diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h index fdedf1ef6f..3df1aa1d78 100644 --- a/tv/tuner/aidl/default/Frontend.h +++ b/tv/tuner/aidl/default/Frontend.h @@ -50,6 +50,7 @@ class Frontend : public BnFrontend { ::ndk::ScopedAStatus linkCiCam(int32_t in_ciCamId, int32_t* _aidl_return) override; ::ndk::ScopedAStatus unlinkCiCam(int32_t in_ciCamId) override; ::ndk::ScopedAStatus getHardwareInfo(std::string* _aidl_return) override; + ::ndk::ScopedAStatus removeOutputPid(int32_t in_pid) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp index 41e98ea586..a9feeabbc3 100644 --- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp +++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp @@ -298,6 +298,13 @@ AssertionResult FrontendTests::linkCiCam(int32_t ciCamId) { return AssertionResult(status.isOk()); } +AssertionResult FrontendTests::removeOutputPid(int32_t removePid) { + ndk::ScopedAStatus status; + status = mFrontend->removeOutputPid(removePid); + return AssertionResult(status.isOk() || status.getServiceSpecificError() == + static_cast(Result::UNAVAILABLE)); +} + AssertionResult FrontendTests::unlinkCiCam(int32_t ciCamId) { ndk::ScopedAStatus status = mFrontend->unlinkCiCam(ciCamId); return AssertionResult(status.isOk()); @@ -501,6 +508,7 @@ void FrontendTests::tuneTest(FrontendConfig frontendConf) { ASSERT_TRUE(setFrontendCallback()); if (frontendConf.canConnectToCiCam) { ASSERT_TRUE(linkCiCam(frontendConf.ciCamId)); + ASSERT_TRUE(removeOutputPid(frontendConf.removePid)); ASSERT_TRUE(unlinkCiCam(frontendConf.ciCamId)); } ASSERT_TRUE(tuneFrontend(frontendConf, false /*testWithDemux*/)); diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.h b/tv/tuner/aidl/vts/functional/FrontendTests.h index 1745f76cd8..537c419256 100644 --- a/tv/tuner/aidl/vts/functional/FrontendTests.h +++ b/tv/tuner/aidl/vts/functional/FrontendTests.h @@ -95,6 +95,7 @@ class FrontendTests { AssertionResult linkCiCam(int32_t ciCamId); AssertionResult unlinkCiCam(int32_t ciCamId); AssertionResult verifyHardwareInfo(); + AssertionResult removeOutputPid(int32_t removePid); void getFrontendIdByType(FrontendType feType, int32_t& feId); void tuneTest(FrontendConfig frontendConf); diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index b73d59411b..3009c4a28d 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -83,6 +83,7 @@ struct FrontendConfig { FrontendType type; bool canConnectToCiCam; int32_t ciCamId; + int32_t removePid; FrontendSettings settings; vector tuneStatusTypes; vector expectTuneStatuses; @@ -304,7 +305,8 @@ struct TunerTestingConfigAidlReader1_0 { // TODO: b/182519645 complete the tune status config frontendMap[id].tuneStatusTypes = types; frontendMap[id].expectTuneStatuses = statuses; - getCiCamInfo(feConfig, frontendMap[id].canConnectToCiCam, frontendMap[id].ciCamId); + getCiCamInfo(feConfig, frontendMap[id].canConnectToCiCam, frontendMap[id].ciCamId, + frontendMap[id].removePid); } } } @@ -1004,13 +1006,16 @@ struct TunerTestingConfigAidlReader1_0 { return recordSettings; } - static void getCiCamInfo(Frontend feConfig, bool& canConnectToCiCam, int32_t& ciCamId) { + static void getCiCamInfo(Frontend feConfig, bool& canConnectToCiCam, int32_t& ciCamId, + int32_t& removePid) { if (!feConfig.hasConnectToCicamId()) { canConnectToCiCam = false; ciCamId = -1; + removePid = -1; return; } canConnectToCiCam = true; ciCamId = static_cast(feConfig.getConnectToCicamId()); + removePid = static_cast(feConfig.getRemoveOutputPid()); } }; diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 4d519d7cb5..383d49f452 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -317,6 +317,7 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public java.math.BigInteger getFrequency(); method @Nullable public String getId(); method @Nullable public boolean getIsSoftwareFrontend(); + method @Nullable public java.math.BigInteger getRemoveOutputPid(); 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); @@ -325,6 +326,7 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setFrequency(@Nullable java.math.BigInteger); method public void setId(@Nullable String); method public void setIsSoftwareFrontend(@Nullable boolean); + method public void setRemoveOutputPid(@Nullable java.math.BigInteger); method public void setType(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum); } diff --git a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml index da77200f8a..fefe86edab 100644 --- a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml +++ b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml @@ -42,6 +42,8 @@ "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. + "removeOutputPid": the unnecessary PID will be filtered out from frontend + output. Supported in Tuner 2.0 or higher. "frequency": the frequency used to configure tune and scan. "endFrequency": the end frequency of scan. Supported in Tuner 1.1 or higher. @@ -53,11 +55,13 @@ --> + connectToCicamId="0" removeOutputPid="10" frequency="578000000" + endFrequency="800000000"> + connectToCicamId="0" removeOutputPid="10" frequency="578000000" + endFrequency="800000000">