Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8ccaaea authored by Hongguang's avatar Hongguang
Browse files

Add new features to tuner service.

*) Add AAC formats backward compatibility.
*) Support dumping frontend hardware information.
*) Add DemuxFilterMediaEvent ScIndexMask backward compatibility.
*) Move setLna to TunerService and add Hidl backward compatibility.

Bug: 205265630
Bug: 184017033
Bug: 202978951
Bug: 203623028
Test: atest android.media.tv.tuner.cts on AIDL and HIDL HALs
Change-Id: I491da4e21649b61b25734fc1f9bf64bb77f52a87
parent 9c6496c2
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -115,16 +115,6 @@ TunerFrontend::~TunerFrontend() {
    return mFrontend->setLnb(static_cast<TunerLnb*>(lnb.get())->getId());
}

::ndk::ScopedAStatus TunerFrontend::setLna(bool bEnable) {
    if (mFrontend == nullptr) {
        ALOGD("IFrontend is not initialized");
        return ::ndk::ScopedAStatus::fromServiceSpecificError(
                static_cast<int32_t>(Result::UNAVAILABLE));
    }

    return mFrontend->setLna(bEnable);
}

::ndk::ScopedAStatus TunerFrontend::linkCiCamToFrontend(int32_t ciCamId, int32_t* _aidl_return) {
    if (mFrontend == nullptr) {
        ALOGD("IFrontend is not initialized");
@@ -174,6 +164,16 @@ TunerFrontend::~TunerFrontend() {
    return ::ndk::ScopedAStatus::ok();
}

::ndk::ScopedAStatus TunerFrontend::getHardwareInfo(std::string* _aidl_return) {
    if (mFrontend == nullptr) {
        ALOGD("IFrontend is not initialized");
        return ::ndk::ScopedAStatus::fromServiceSpecificError(
                static_cast<int32_t>(Result::UNAVAILABLE));
    }

    return mFrontend->getHardwareInfo(_aidl_return);
}

/////////////// FrontendCallback ///////////////////////
::ndk::ScopedAStatus TunerFrontend::FrontendCallback::onEvent(FrontendEventType frontendEventType) {
    ALOGV("FrontendCallback::onEvent, type=%d", frontendEventType);
+1 −1
Original line number Diff line number Diff line
@@ -56,13 +56,13 @@ public:
                              FrontendScanType in_frontendScanType) override;
    ::ndk::ScopedAStatus stopScan() override;
    ::ndk::ScopedAStatus setLnb(const shared_ptr<ITunerLnb>& in_lnb) override;
    ::ndk::ScopedAStatus setLna(bool in_bEnable) override;
    ::ndk::ScopedAStatus linkCiCamToFrontend(int32_t in_ciCamId, int32_t* _aidl_return) override;
    ::ndk::ScopedAStatus unlinkCiCamToFrontend(int32_t in_ciCamId) override;
    ::ndk::ScopedAStatus close() override;
    ::ndk::ScopedAStatus getStatus(const vector<FrontendStatusType>& in_statusTypes,
                                   vector<FrontendStatus>* _aidl_return) override;
    ::ndk::ScopedAStatus getFrontendId(int32_t* _aidl_return) override;
    ::ndk::ScopedAStatus getHardwareInfo(std::string* _aidl_return) override;

    struct FrontendCallback : public BnFrontendCallback {
        FrontendCallback(const shared_ptr<ITunerFrontendCallback> tunerFrontendCallback)
+10 −0
Original line number Diff line number Diff line
@@ -260,6 +260,16 @@ bool TunerService::hasITuner() {
    return ::ndk::ScopedAStatus::ok();
}

::ndk::ScopedAStatus TunerService::setLna(bool bEnable) {
    if (!hasITuner()) {
        ALOGD("get ITuner failed");
        return ::ndk::ScopedAStatus::fromServiceSpecificError(
                static_cast<int32_t>(Result::UNAVAILABLE));
    }

    return mTuner->setLna(bEnable);
}

string TunerService::addFilterToShared(const shared_ptr<TunerFilter>& sharedFilter) {
    Mutex::Autolock _l(mSharedFiltersLock);

+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public:
    ::ndk::ScopedAStatus openSharedFilter(const string& in_filterToken,
                                          const shared_ptr<ITunerFilterCallback>& in_cb,
                                          shared_ptr<ITunerFilter>* _aidl_return) override;
    ::ndk::ScopedAStatus setLna(bool in_bEnable) override;

    string addFilterToShared(const shared_ptr<TunerFilter>& sharedFilter);
    void removeSharedFilter(const shared_ptr<TunerFilter>& sharedFilter);
+5 −7
Original line number Diff line number Diff line
@@ -68,13 +68,6 @@ interface ITunerFrontend {
     */
    void setLnb(in ITunerLnb lnb);

    /**
     * Enable or Disable Low Noise Amplifier (LNA).
     *
     * @param bEnable enable Lna or not.
     */
    void setLna(in boolean bEnable);

    /**
     * Link Frontend to the cicam with given id.
     *
@@ -101,4 +94,9 @@ interface ITunerFrontend {
     * Gets the id of the frontend.
     */
    int getFrontendId();

    /**
     * Request hardware information about the frontend.
     */
    String getHardwareInfo();
}
Loading