Add API to filter out unnecessary PIDs from frontend output.

Bug: 213287138
Test: atest VtsHalTvTunerTargetTest
Change-Id: I075d68d722b2804f54d57a1ac9c350e2a9724ae3
This commit is contained in:
Hongguang 2022-01-11 12:09:22 -08:00
parent 962deadfd2
commit e106f475b6
10 changed files with 45 additions and 4 deletions

View file

@ -46,4 +46,5 @@ interface IFrontend {
int linkCiCam(in int ciCamId);
void unlinkCiCam(in int ciCamId);
String getHardwareInfo();
void removeOutputPid(int pid);
}

View file

@ -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 doesnt support PID filtering out.
*/
void removeOutputPid(int pid);
}

View file

@ -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<int32_t>(Result::UNAVAILABLE));
}
FrontendType Frontend::getFrontendType() {
return mType;
}

View file

@ -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;

View file

@ -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<int32_t>(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*/));

View file

@ -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);

View file

@ -83,6 +83,7 @@ struct FrontendConfig {
FrontendType type;
bool canConnectToCiCam;
int32_t ciCamId;
int32_t removePid;
FrontendSettings settings;
vector<FrontendStatusType> tuneStatusTypes;
vector<FrontendStatus> 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<int32_t>(feConfig.getConnectToCicamId());
removePid = static_cast<int32_t>(feConfig.getRemoveOutputPid());
}
};

View file

@ -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);
}

View file

@ -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 @@
-->
<frontends>
<frontend id="FE_DEFAULT" type="DVBT" isSoftwareFrontend="true"
connectToCicamId="0" frequency="578000000" endFrequency="800000000">
connectToCicamId="0" removeOutputPid="10" frequency="578000000"
endFrequency="800000000">
<dvbtFrontendSettings bandwidth="8" transmissionMode="128" isHighPriority="1"/>
</frontend>
<frontend id="FE_DVBS_0" type="DVBS" isSoftwareFrontend="true"
connectToCicamId="0" frequency="578000000" endFrequency="800000000">
connectToCicamId="0" removeOutputPid="10" frequency="578000000"
endFrequency="800000000">
</frontend>
</frontends>
<!-- Filter section:

View file

@ -94,6 +94,8 @@
"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.
@ -125,6 +127,7 @@
<xs:attribute name="isSoftwareFrontend" type="xs:boolean" use="required"/>
<xs:attribute name="frequency" type="xs:nonNegativeInteger" use="required"/>
<xs:attribute name="connectToCicamId" type="xs:nonNegativeInteger" use="optional"/>
<xs:attribute name="removeOutputPid" type="xs:nonNegativeInteger" use="optional"/>
<xs:attribute name="endFrequency" type="xs:nonNegativeInteger" use="optional"/>
</xs:complexType>