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

Commit e99c6637 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

libaudiohal: Fix probing of the AIDL HAL presence

Since the AIDL HAL service is starting in parallel
with the audioserver, using `checkService` can result
in false negatives. Need to use `isDeclared` which
does the check based on the vendor manifest.

Bug: 205884982
Test: start cuttlefish with AIDL HAL enabled,
      look for `FactoryHal` tag in logcat
Change-Id: I17c4da17eb8172cdc2440070fe332b69b6d64c0e
parent 1753209c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -105,12 +105,12 @@ bool createHalService(const AudioHalVersionInfo& version, bool isDevice, void**

bool hasAidlHalService(const InterfaceName& interface, const AudioHalVersionInfo& version) {
    const std::string name = interface.first + "." + interface.second + "/default";
    AIBinder* binder = AServiceManager_checkService(name.c_str());
    if (binder == nullptr) {
        ALOGW("%s Service %s doesn't exist", __func__, name.c_str());
    const bool isDeclared = AServiceManager_isDeclared(name.c_str());
    if (!isDeclared) {
        ALOGW("%s %s: false", __func__, name.c_str());
        return false;
    }
    ALOGI("%s AIDL Service %s exist: %s", __func__, name.c_str(), version.toString().c_str());
    ALOGI("%s %s: true, version %s", __func__, name.c_str(), version.toString().c_str());
    return true;
}