Add new features to tuner AIDL HAL.
*) Adding key frame info (ScIndexMask) to DemuxFilterMediaEvent.
*) Add more AAC formats.
*) Support dumping frontend hardware information.
*) Move LNA from IFrontend to ITuner.
Bug: 202978951
Bug: 205265630
Bug: 184017033
Bug: 203623028
Test: atest VtsHalTvTunerTargetTest
Change-Id: I8256da7f41c96d7de66d2796dd35c51637078da0
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl
index bfd2aa8..6c538ea 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl
@@ -51,4 +51,8 @@
OPUS = 13,
VORBIS = 14,
DRA = 15,
+ AAC_ADTS = 16,
+ AAC_LATM = 17,
+ AAC_HE_ADTS = 18,
+ AAC_HE_LATM = 19,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
index 993c639..61a9555 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
@@ -48,4 +48,5 @@
int mpuSequenceNumber;
boolean isPesPrivateData;
android.hardware.tv.tuner.DemuxFilterMediaEventExtraMetaData extraMetaData;
+ android.hardware.tv.tuner.DemuxFilterScIndexMask scIndexMask;
}
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 ed5b0c0..e7aa070 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
@@ -43,7 +43,7 @@
void stopScan();
android.hardware.tv.tuner.FrontendStatus[] getStatus(in android.hardware.tv.tuner.FrontendStatusType[] statusTypes);
void setLnb(in int lnbId);
- void setLna(in boolean bEnable);
int linkCiCam(in int ciCamId);
void unlinkCiCam(in int ciCamId);
+ String getHardwareInfo();
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl
index 0e903d8..decf5b1 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl
@@ -44,4 +44,5 @@
int[] getLnbIds();
android.hardware.tv.tuner.ILnb openLnbById(in int lnbId);
android.hardware.tv.tuner.ILnb openLnbByName(in String lnbName, out int[] lnbId);
+ void setLna(in boolean bEnable);
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/AudioStreamType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/AudioStreamType.aidl
index 1bb5c68f..9e9a8cf 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/AudioStreamType.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/AudioStreamType.aidl
@@ -99,4 +99,24 @@
* SJ/T 11368-2006
*/
DRA,
+
+ /*
+ * AAC with ADTS (Audio Data Transport Format).
+ */
+ AAC_ADTS,
+
+ /*
+ * AAC with ADTS with LATM (Low-overhead MPEG-4 Audio Transport Multiplex).
+ */
+ AAC_LATM,
+
+ /*
+ * High-Efficiency AAC (HE-AAC) with ADTS (Audio Data Transport Format).
+ */
+ AAC_HE_ADTS,
+
+ /*
+ * High-Efficiency AAC (HE-AAC) with LATM (Low-overhead MPEG-4 Audio Transport Multiplex).
+ */
+ AAC_HE_LATM,
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
index e92b711..32f0cb2 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
@@ -19,6 +19,7 @@
import android.hardware.common.NativeHandle;
import android.hardware.tv.tuner.DemuxFilterMediaEventExtraMetaData;
+import android.hardware.tv.tuner.DemuxFilterScIndexMask;
/**
* Filter Event for Audio or Video Filter.
@@ -84,4 +85,10 @@
boolean isPesPrivateData;
DemuxFilterMediaEventExtraMetaData extraMetaData;
+
+ /**
+ * DemuxFilterScIndexMask for the key frame info. It's optional to hardware which can only
+ * access unit framing at decode stage.
+ */
+ DemuxFilterScIndexMask scIndexMask;
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl
index b2717db..5b3ce39 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl
@@ -117,13 +117,6 @@
void setLnb(in int lnbId);
/**
- * Enable or Disable Low Noise Amplifier (LNA).
- *
- * @param bEnable true if activate LNA module; false if deactivate LNA
- */
- void setLna(in boolean bEnable);
-
- /**
* Link Conditional Access Modules (CAM) to Frontend support Common
* Interface (CI) bypass mode.
*
@@ -143,4 +136,14 @@
* @param ciCamId specify CI-CAM Id to unlink.
*/
void unlinkCiCam(in int ciCamId);
+
+ /**
+ * Request Hardware information about the frontend.
+ *
+ * The client may use this to collect vendor specific hardware information, e.g. RF
+ * chip version, Demod chip version, detailed status of dvbs blind scan, etc.
+ *
+ * @return the frontend hardware information.
+ */
+ String getHardwareInfo();
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl
index ab8b0b8..1fcbb06 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl
@@ -120,4 +120,11 @@
* @return the newly opened Lnb iterface.
*/
ILnb openLnbByName(in String lnbName, out int[] lnbId);
+
+ /**
+ * Enable or Disable Low Noise Amplifier (LNA).
+ *
+ * @param bEnable true if activate LNA module; false if deactivate LNA
+ */
+ void setLna(in boolean bEnable);
}
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index a4dde2a..e35a8d9 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -691,12 +691,6 @@
return ::ndk::ScopedAStatus::ok();
}
-::ndk::ScopedAStatus Frontend::setLna(bool /* in_bEnable */) {
- ALOGV("%s", __FUNCTION__);
-
- return ::ndk::ScopedAStatus::ok();
-}
-
::ndk::ScopedAStatus Frontend::setLnb(int32_t /* in_lnbId */) {
ALOGV("%s", __FUNCTION__);
if (!supportsSatellite()) {
@@ -731,6 +725,13 @@
return STATUS_OK;
}
+::ndk::ScopedAStatus Frontend::getHardwareInfo(std::string* _aidl_return) {
+ ALOGV("%s", __FUNCTION__);
+
+ *_aidl_return = "Sample Frontend";
+ return ::ndk::ScopedAStatus::ok();
+}
+
FrontendType Frontend::getFrontendType() {
return mType;
}
diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h
index 5e7b10c..66ae901 100644
--- a/tv/tuner/aidl/default/Frontend.h
+++ b/tv/tuner/aidl/default/Frontend.h
@@ -46,9 +46,9 @@
::ndk::ScopedAStatus getStatus(const std::vector<FrontendStatusType>& in_statusTypes,
std::vector<FrontendStatus>* _aidl_return) override;
::ndk::ScopedAStatus setLnb(int32_t in_lnbId) override;
- ::ndk::ScopedAStatus setLna(bool in_bEnable) override;
::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;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp
index 96e83bb..fbf4763 100644
--- a/tv/tuner/aidl/default/Tuner.cpp
+++ b/tv/tuner/aidl/default/Tuner.cpp
@@ -317,6 +317,12 @@
return ::ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus Tuner::setLna(bool /* in_bEnable */) {
+ ALOGV("%s", __FUNCTION__);
+
+ return ::ndk::ScopedAStatus::ok();
+}
+
binder_status_t Tuner::dump(int fd, const char** args, uint32_t numArgs) {
ALOGV("%s", __FUNCTION__);
{
diff --git a/tv/tuner/aidl/default/Tuner.h b/tv/tuner/aidl/default/Tuner.h
index 682496c..b33a1be 100644
--- a/tv/tuner/aidl/default/Tuner.h
+++ b/tv/tuner/aidl/default/Tuner.h
@@ -56,6 +56,7 @@
::ndk::ScopedAStatus openLnbByName(const std::string& in_lnbName,
std::vector<int32_t>* out_lnbId,
std::shared_ptr<ILnb>* _aidl_return) override;
+ ::ndk::ScopedAStatus setLna(bool in_bEnable) 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 12b1f33..59a2582 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -475,6 +475,13 @@
feId = INVALID_ID;
}
+AssertionResult FrontendTests::verifyHardwareInfo() {
+ EXPECT_TRUE(mFrontend) << "Test with openFrontendById first.";
+ std::string info;
+ ndk::ScopedAStatus status = mFrontend->getHardwareInfo(&info);
+ return AssertionResult(status.isOk() && !info.empty());
+}
+
void FrontendTests::tuneTest(FrontendConfig frontendConf) {
int32_t feId;
getFrontendIdByType(frontendConf.type, feId);
@@ -491,6 +498,18 @@
ASSERT_TRUE(closeFrontend());
}
+void FrontendTests::debugInfoTest(FrontendConfig frontendConf) {
+ int32_t feId;
+ getFrontendIdByType(frontendConf.type, feId);
+ ASSERT_TRUE(feId != INVALID_ID);
+ ASSERT_TRUE(openFrontendById(feId));
+ ASSERT_TRUE(setFrontendCallback());
+ ASSERT_TRUE(tuneFrontend(frontendConf, false /*testWithDemux*/));
+ ASSERT_TRUE(verifyHardwareInfo());
+ ASSERT_TRUE(stopTuneFrontend(false /*testWithDemux*/));
+ ASSERT_TRUE(closeFrontend());
+}
+
void FrontendTests::scanTest(FrontendConfig frontendConf, FrontendScanType scanType) {
int32_t feId;
getFrontendIdByType(frontendConf.type, feId);
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.h b/tv/tuner/aidl/vts/functional/FrontendTests.h
index e5a9cd3..8f769a0 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.h
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.h
@@ -94,10 +94,12 @@
AssertionResult linkCiCam(int32_t ciCamId);
AssertionResult unlinkCiCam(int32_t ciCamId);
+ AssertionResult verifyHardwareInfo();
void getFrontendIdByType(FrontendType feType, int32_t& feId);
void tuneTest(FrontendConfig frontendConf);
void scanTest(FrontendConfig frontend, FrontendScanType type);
+ void debugInfoTest(FrontendConfig frontendConf);
void setDvrTests(DvrTests* dvrTests) { mExternalDvrTests = dvrTests; }
void setDemux(std::shared_ptr<IDemux> demux) { getDvrTests()->setDemux(demux); }
diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
index 89e42df..202f83f 100644
--- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
+++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
@@ -883,6 +883,14 @@
mFrontendTests.tuneTest(frontendMap[live.frontendId]);
}
+TEST_P(TunerFrontendAidlTest, getHardwareInfo) {
+ description("Test Frontend get hardware info");
+ if (!live.hasFrontendConnection) {
+ return;
+ }
+ mFrontendTests.debugInfoTest(frontendMap[live.frontendId]);
+}
+
TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast use case.");
if (!live.hasFrontendConnection) {