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

Commit 271948af authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "effect_device_mask" into main

* changes:
  Skip setDevice to HAL for AUDIO_DEVICE_NONE
  libaudiohal: fix the device mask conversion
parents 044c7145 66e630b8
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ cc_library_shared {


    shared_libs: [
    shared_libs: [
        "audioclient-types-aidl-cpp",
        "audioclient-types-aidl-cpp",
        "libaudiofoundation",
        "libbinder_ndk",
        "libbinder_ndk",
        "libdl",
        "libdl",
        "libhidlbase",
        "libhidlbase",
@@ -75,6 +76,7 @@ cc_library_headers {
    name: "libaudiohal_headers",
    name: "libaudiohal_headers",


    header_libs: [
    header_libs: [
        "libaudiofoundation_headers",
        "libeffectsconfig_headers",
        "libeffectsconfig_headers",
    ],
    ],


+22 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#define LOG_TAG "EffectHalAidl"
#define LOG_TAG "EffectHalAidl"
//#define LOG_NDEBUG 0
//#define LOG_NDEBUG 0


#include <algorithm>
#include <memory>
#include <memory>


#include <audio_utils/primitives.h>
#include <audio_utils/primitives.h>
@@ -63,7 +64,9 @@ using ::aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty;
using ::aidl::android::hardware::audio::effect::kEventFlagDataMqUpdate;
using ::aidl::android::hardware::audio::effect::kEventFlagDataMqUpdate;
using ::aidl::android::hardware::audio::effect::kEventFlagNotEmpty;
using ::aidl::android::hardware::audio::effect::kEventFlagNotEmpty;
using ::aidl::android::hardware::audio::effect::kReopenSupportedVersion;
using ::aidl::android::hardware::audio::effect::kReopenSupportedVersion;
using ::aidl::android::hardware::audio::effect::Parameter;
using ::aidl::android::hardware::audio::effect::State;
using ::aidl::android::hardware::audio::effect::State;
using ::aidl::android::media::audio::common::AudioDeviceDescription;


namespace android {
namespace android {
namespace effect {
namespace effect {
@@ -388,5 +391,24 @@ status_t EffectHalAidl::dump(int fd) {
    return mEffect->dump(fd, nullptr, 0);
    return mEffect->dump(fd, nullptr, 0);
}
}


status_t EffectHalAidl::setDevices(const AudioDeviceTypeAddrVector& deviceTypes) {
    TIME_CHECK();

    // TODO: b/397236443 - add this as part of effect dumpsys
    ALOGD("%s %s", __func__,
          dumpAudioDeviceTypeAddrVector(deviceTypes, false /*includeSensitiveInfo*/).c_str());

    std::vector<AudioDeviceDescription> deviceDescs;
    for (const AudioDeviceTypeAddr& deviceType : deviceTypes) {
        AudioDeviceDescription deviceDesc = VALUE_OR_RETURN_STATUS(
                ::aidl::android::legacy2aidl_audio_devices_t_AudioDeviceDescription(
                        deviceType.mType));
        deviceDescs.emplace_back(std::move(deviceDesc));
    }

    return statusTFromBinderStatus(
            mEffect->setParameter(Parameter::make<Parameter::deviceDescription>(deviceDescs)));
}

} // namespace effect
} // namespace effect
} // namespace android
} // namespace android
+3 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,9 @@ class EffectHalAidl : public EffectHalInterface {
        return mEffect;
        return mEffect;
    }
    }


    // Set devices in AIDL type
    status_t setDevices(const AudioDeviceTypeAddrVector& deviceTypes);

    // for TIME_CHECK
    // for TIME_CHECK
    const std::string getClassName() const { return "EffectHalAidl"; }
    const std::string getClassName() const { return "EffectHalAidl"; }


+3 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,9 @@ class EffectHalHidl : public EffectHalInterface, public EffectConversionHelperHi


    uint64_t effectId() const { return mEffectId; }
    uint64_t effectId() const { return mEffectId; }


    // Not implemented in HIDL effect HAL
    status_t setDevices(const AudioDeviceTypeAddrVector&) { return INVALID_OPERATION; };

  private:
  private:
    friend class EffectsFactoryHalHidl;
    friend class EffectsFactoryHalHidl;
    typedef MessageQueue<Result, hardware::kSynchronizedReadWrite> StatusMQ;
    typedef MessageQueue<Result, hardware::kSynchronizedReadWrite> StatusMQ;
+6 −4
Original line number Original line Diff line number Diff line
@@ -47,7 +47,6 @@ using ::aidl::android::media::audio::common::AudioDeviceAddress;
using ::aidl::android::media::audio::common::AudioSource;
using ::aidl::android::media::audio::common::AudioSource;
using ::aidl::android::media::audio::common::AudioStreamType;
using ::aidl::android::media::audio::common::AudioStreamType;
using ::aidl::android::media::audio::common::AudioUuid;
using ::aidl::android::media::audio::common::AudioUuid;
using ::android::audio::utils::toString;
using ::android::base::unexpected;
using ::android::base::unexpected;
using ::android::detail::AudioHalVersionInfo;
using ::android::detail::AudioHalVersionInfo;


@@ -192,7 +191,8 @@ status_t EffectsFactoryHalAidl::createEffect(const effect_uuid_t* uuid, int32_t
                statusTFromBinderStatus(mFactory->createEffect(aidlUuid, &aidlEffect)));
                statusTFromBinderStatus(mFactory->createEffect(aidlUuid, &aidlEffect)));
    }
    }
    if (aidlEffect == nullptr) {
    if (aidlEffect == nullptr) {
        ALOGE("%s failed to create effect with UUID: %s", __func__, toString(aidlUuid).c_str());
        ALOGE("%s failed to create effect with UUID: %s", __func__,
              ::android::audio::utils::toString(aidlUuid).c_str());
        return NAME_NOT_FOUND;
        return NAME_NOT_FOUND;
    }
    }
    Descriptor desc;
    Descriptor desc;
@@ -231,7 +231,8 @@ status_t EffectsFactoryHalAidl::getHalDescriptorWithImplUuid(const AudioUuid& uu
    auto matchIt = std::find_if(list.begin(), list.end(),
    auto matchIt = std::find_if(list.begin(), list.end(),
                                [&](const auto& desc) { return desc.common.id.uuid == uuid; });
                                [&](const auto& desc) { return desc.common.id.uuid == uuid; });
    if (matchIt == list.end()) {
    if (matchIt == list.end()) {
        ALOGE("%s UUID not found in HAL and proxy list %s", __func__, toString(uuid).c_str());
        ALOGE("%s UUID not found in HAL and proxy list %s", __func__,
              ::android::audio::utils::toString(uuid).c_str());
        return NAME_NOT_FOUND;
        return NAME_NOT_FOUND;
    }
    }


@@ -252,7 +253,8 @@ status_t EffectsFactoryHalAidl::getHalDescriptorWithTypeUuid(
    std::copy_if(mProxyDescList.begin(), mProxyDescList.end(), std::back_inserter(result),
    std::copy_if(mProxyDescList.begin(), mProxyDescList.end(), std::back_inserter(result),
                 [&](auto& desc) { return desc.common.id.type == type; });
                 [&](auto& desc) { return desc.common.id.type == type; });
    if (result.empty()) {
    if (result.empty()) {
        ALOGW("%s UUID type not found in HAL and proxy list %s", __func__, toString(type).c_str());
        ALOGW("%s UUID type not found in HAL and proxy list %s", __func__,
              ::android::audio::utils::toString(type).c_str());
        return BAD_VALUE;
        return BAD_VALUE;
    }
    }


Loading