Support lazy tuner server
*) Refine code to not use global instance. It makes us easier to debug
reference count.
*) The service will only be started if the tuner feature is declard by
the vendor. So we don't need to check tuner feature and whether tuner
HAL is presented anymore.
*) The service will register its resources to TRM every time when it's
started. The TRM will update its resource mapping accordingly.
*) Use tuner.server.enable to change tuner server to be a normal service
if the HAL is not a lazy HAL.
Bug: 236002754
Test: atest android.media.tv.tuner.cts on both lazy and normal HALs
Change-Id: I564490fd46154bb0a8bcf6b77e2b2d9478471434
diff --git a/services/tuner/main_tunerservice.cpp b/services/tuner/main_tunerservice.cpp
index 43ff95c..f8311ff 100644
--- a/services/tuner/main_tunerservice.cpp
+++ b/services/tuner/main_tunerservice.cpp
@@ -32,6 +32,7 @@
sp<ProcessState> proc(ProcessState::self());
sp<IServiceManager> sm = defaultServiceManager();
+ ProcessState::self()->setThreadPoolMaxThreadCount(8);
// Check legacy HIDL HAL first. If it's not existed, use AIDL HAL.
binder_status_t status = TunerHidlService::instantiate();
@@ -40,7 +41,6 @@
CHECK(status == STATUS_OK);
}
- ProcessState::self()->setThreadPoolMaxThreadCount(8);
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
return EXIT_FAILURE; // should not reached