Notify TunerService to updateTunerResources when Tuner Client is init
This CL also:
1. Fixed some bugs in Tuner Client.
2. Getting rid of the Result return of the getFrontendIds API in
TunerService Aidl(Since we decided to use AIDL status channel to
return the error message for all the Tuner Service APIs)
Test: atest android.media.tv.tuner.cts (LNB test only)
Bug: 159067322
Change-Id: I2fd4b8d3e5016438e61a41033e227e1311a24a21
diff --git a/media/jni/tuner/TunerClient.cpp b/media/jni/tuner/TunerClient.cpp
index 498ba0e..73a2cf2 100644
--- a/media/jni/tuner/TunerClient.cpp
+++ b/media/jni/tuner/TunerClient.cpp
@@ -37,7 +37,9 @@
TunerClient::TunerClient() {
// Get HIDL Tuner in migration stage.
getHidlTuner();
- updateTunerResources();
+ if (mTuner != NULL) {
+ updateTunerResources();
+ }
// Connect with Tuner Service.
::ndk::SpAIBinder binder(AServiceManager_getService("media.tuner"));
mTunerService = ITunerService::fromBinder(binder);
@@ -45,6 +47,9 @@
mTunerService = NULL;
if (mTunerService == NULL) {
ALOGE("Failed to get tuner service");
+ } else {
+ // TODO: b/178124017 update TRM in TunerService independently.
+ mTunerService->updateTunerResources();
}
}
@@ -60,10 +65,8 @@
if (mTunerService != NULL) {
vector<int32_t> v;
- int aidl_return;
- Status s = mTunerService->getFrontendIds(&v, &aidl_return);
- if (!s.isOk() || aidl_return != (int) Result::SUCCESS
- || v.size() == 0) {
+ Status s = mTunerService->getFrontendIds(&v);
+ if (getServiceSpecificErrorCode(s) != Result::SUCCESS || v.size() == 0) {
ids.clear();
return ids;
}