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

Commit 0ee6cb9b authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

Remove temporary workarounds in AIDL HAL config processing

Removed the code in DevicesFactoryHalAidl::openDevice which
was checking whether the module is actually published.

Removed the fallback to default surround sound config
when AIDL HAL provided an empty config (this is not allowed).

Bug: 205884982
Test: use CF with AIDL audio HAL
Change-Id: I1b614e62a28ae1662a3c7fccce62aa943da9431d
parent 99cc276a
Loading
Loading
Loading
Loading
+7 −16
Original line number Diff line number Diff line
@@ -83,24 +83,15 @@ status_t DevicesFactoryHalAidl::openDevice(const char *name, sp<DeviceHalInterfa
    if (name == nullptr || device == nullptr) {
        return BAD_VALUE;
    }

    // FIXME: Remove this call and the check for the supported module names
    // after implementing retrieval of module names on the framework side.
    // Currently it is still using the legacy XML config.
    std::vector<std::string> deviceNames;
    if (status_t status = getDeviceNames(&deviceNames); status != OK) {
        return status;
    }
    std::shared_ptr<IModule> service;
    if (std::find(deviceNames.begin(), deviceNames.end(), name) != deviceNames.end()) {
    if (strcmp(name, "primary") == 0) name = "default";
    auto serviceName = std::string(IModule::descriptor) + "/" + name;
    service = IModule::fromBinder(
            ndk::SpAIBinder(AServiceManager_waitForService(serviceName.c_str())));
        ALOGE_IF(service == nullptr, "%s fromBinder %s failed", __func__, serviceName.c_str());
    if (service == nullptr) {
        ALOGE("%s fromBinder %s failed", __func__, serviceName.c_str());
        return NO_INIT;
    }
    // If the service is a nullptr, the device object will not be really functional,
    // but will not crash either.
    *device = sp<DeviceHalAidl>::make(name, service);
    return OK;
}
+0 −4
Original line number Diff line number Diff line
@@ -256,10 +256,6 @@ status_t AudioPolicyConfig::loadFromAidl(const media::AudioPolicyConfig& aidl) {
            media::audio::common::AudioMode::CALL_SCREEN) != aidl.supportedModes.end();
    mSurroundFormats = VALUE_OR_RETURN_STATUS(
            aidl2legacy_SurroundSoundConfig_SurroundFormats(aidl.surroundSoundConfig));
    // TODO(b/205884982): Remove after landing aosp/2353423.
    if (mSurroundFormats.empty()) {
        setDefaultSurroundFormats();
    }
    mSource = kAidlConfigSource;
    // No need to augmentData() as AIDL HAL must provide correct mic addresses.
    return NO_ERROR;