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
This commit is contained in:
Amy Zhang
2021-01-21 12:52:05 -08:00
parent f0715e0bce
commit 9eeba43cfd
2 changed files with 14 additions and 7 deletions

View File

@@ -51,8 +51,12 @@ Result LnbClient::setCallback(sp<LnbClientCallback> cb) {
return TunerClient::getServiceSpecificErrorCode(s);
}
mHidlCallback = new HidlLnbCallback(cb);
return mLnb->setCallback(mHidlCallback);
if (mLnb != NULL) {
mHidlCallback = new HidlLnbCallback(cb);
return mLnb->setCallback(mHidlCallback);
}
return Result::INVALID_STATE;
}
Result LnbClient::setVoltage(LnbVoltage voltage) {

View File

@@ -37,7 +37,9 @@ int TunerClient::mTunerVersion;
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 @@ TunerClient::TunerClient() {
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 @@ vector<FrontendId> TunerClient::getFrontendIds() {
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;
}