Make the default tuner HAL to be a dynamic AIDL
Add lazy tuner service.
Refine code to allow Tuner reference count to be 0 when no one uses it.
Bug: 236002754
Test: atest VtsHalTvTunerTargetTest on both lazy and normal HALs
Test: atest android.media.tv.tuner.cts on both lazy and normal HALs
Change-Id: I0cc69fe8ffd79a66db00cb72d212c222130629b5
diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp
index a94b4ad..60fd899 100644
--- a/tv/tuner/aidl/default/Demux.cpp
+++ b/tv/tuner/aidl/default/Demux.cpp
@@ -37,6 +37,7 @@
}
Demux::~Demux() {
+ ALOGV("%s", __FUNCTION__);
close();
}
@@ -180,7 +181,10 @@
mRecordFilterIds.clear();
mFilters.clear();
mLastUsedFilterId = -1;
- mTuner->removeDemux(mDemuxId);
+ if (mTuner != nullptr) {
+ mTuner->removeDemux(mDemuxId);
+ mTuner = nullptr;
+ }
return ::ndk::ScopedAStatus::ok();
}