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

Commit 53f73336 authored by Devin Moore's avatar Devin Moore Committed by Gerrit Code Review
Browse files

Merge "If the swcodec HAL is declared, then register it with servicemanager" into main

parents 177886c9 392e462f
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -819,19 +819,21 @@ extern "C" void RegisterCodecServices() {
    }

    bool registered = false;
    if (platformVersion >= __ANDROID_API_V__) {
    const std::string aidlServiceName =
        std::string(c2_aidl::IComponentStore::descriptor) + "/software";
    if (__builtin_available(android __ANDROID_API_S__, *)) {
        if (AServiceManager_isDeclared(aidlServiceName.c_str())) {
            if (!aidlStore) {
                aidlStore = ::ndk::SharedRefBase::make<c2_aidl::utils::ComponentStore>(
                        std::make_shared<H2C2ComponentStore>(nullptr));
            }
        const std::string serviceName =
            std::string(c2_aidl::IComponentStore::descriptor) + "/software";
            binder_exception_t ex = AServiceManager_addService(
                aidlStore->asBinder().get(), serviceName.c_str());
                    aidlStore->asBinder().get(), aidlServiceName.c_str());
            if (ex == EX_NONE) {
                registered = true;
            } else {
            LOG(ERROR) << "Cannot register software Codec2 AIDL service.";
                LOG(WARNING) << "Cannot register software Codec2 AIDL service. Exception: " << ex;
            }
        }
    }