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

Commit 89c22e49 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Shunkai Yao
Browse files

Clean up EffectHalInterface

Remove `isLocal`, it's a legacy from the HIDL transition times.

Make `effectId` specific to EffectHalHidl, remove usages
outside of libaudiohal.

Bug: 205884982
Test: m
Change-Id: I0486d5fb48d8cfce46aca9152136e7a1a68cf215
parent 79f98745
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include <util/CoreUtils.h>

#include "DeviceHalHidl.h"
#include "EffectHalHidl.h"
#include "ParameterUtils.h"
#include "StreamHalHidl.h"

@@ -501,8 +502,9 @@ status_t DeviceHalHidl::addDeviceEffect(
        audio_port_handle_t device, sp<EffectHalInterface> effect) {
    TIME_CHECK();
    if (mDevice == 0) return NO_INIT;
    auto hidlEffect = sp<effect::EffectHalHidl>::cast(effect);
    return processReturn("addDeviceEffect", mDevice->addDeviceEffect(
            static_cast<AudioPortHandle>(device), effect->effectId()));
            static_cast<AudioPortHandle>(device), hidlEffect->effectId()));
}
#else
status_t DeviceHalHidl::addDeviceEffect(
@@ -516,8 +518,9 @@ status_t DeviceHalHidl::removeDeviceEffect(
        audio_port_handle_t device, sp<EffectHalInterface> effect) {
    TIME_CHECK();
    if (mDevice == 0) return NO_INIT;
    auto hidlEffect = sp<effect::EffectHalHidl>::cast(effect);
    return processReturn("removeDeviceEffect", mDevice->removeDeviceEffect(
            static_cast<AudioPortHandle>(device), effect->effectId()));
            static_cast<AudioPortHandle>(device), hidlEffect->effectId()));
}
#else
status_t DeviceHalHidl::removeDeviceEffect(
+2 −2
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@

#include "ConversionHelperHidl.h"

#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h)
#include PATH(android/hardware/audio/effect/COMMON_TYPES_FILE_VERSION/types.h)

using EffectResult = ::android::hardware::audio::effect::CPP_VERSION::Result;
using EffectResult = ::android::hardware::audio::effect::COMMON_TYPES_CPP_VERSION::Result;

namespace android {

+1 −2
Original line number Diff line number Diff line
@@ -61,12 +61,11 @@ namespace android {
namespace effect {

EffectHalAidl::EffectHalAidl(const std::shared_ptr<IFactory>& factory,
                             const std::shared_ptr<IEffect>& effect, uint64_t effectId,
                             const std::shared_ptr<IEffect>& effect,
                             int32_t sessionId, int32_t ioId, const Descriptor& desc,
                             bool isProxyEffect)
    : mFactory(factory),
      mEffect(effect),
      mEffectId(effectId),
      mSessionId(sessionId),
      mIoId(ioId),
      mDesc(desc),
+1 −7
Original line number Diff line number Diff line
@@ -56,13 +56,8 @@ class EffectHalAidl : public EffectHalInterface {
    // Free resources on the remote side.
    status_t close() override;

    // Whether it's a local implementation.
    bool isLocal() const override { return false; }

    status_t dump(int fd) override;

    uint64_t effectId() const override { return mEffectId; }

    const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect> getIEffect() const {
        return mEffect;
    }
@@ -75,7 +70,6 @@ class EffectHalAidl : public EffectHalInterface {

    const std::shared_ptr<::aidl::android::hardware::audio::effect::IFactory> mFactory;
    const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect> mEffect;
    const uint64_t mEffectId;
    const int32_t mSessionId;
    const int32_t mIoId;
    const ::aidl::android::hardware::audio::effect::Descriptor mDesc;
@@ -93,7 +87,7 @@ class EffectHalAidl : public EffectHalInterface {
    EffectHalAidl(
            const std::shared_ptr<::aidl::android::hardware::audio::effect::IFactory>& factory,
            const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>& effect,
            uint64_t effectId, int32_t sessionId, int32_t ioId,
            int32_t sessionId, int32_t ioId,
            const ::aidl::android::hardware::audio::effect::Descriptor& desc,
            bool isProxyEffect);
    bool setEffectReverse(bool reverse);
+3 −6
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#ifndef ANDROID_HARDWARE_EFFECT_HAL_HIDL_H
#define ANDROID_HARDWARE_EFFECT_HAL_HIDL_H

#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffect.h)
#include PATH(android/hardware/audio/effect/COMMON_TYPES_FILE_VERSION/IEffect.h)
#include <media/audiohal/EffectHalInterface.h>
#include <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
@@ -31,7 +31,7 @@ using ::android::hardware::MessageQueue;
namespace android {
namespace effect {

using namespace ::android::hardware::audio::effect::CPP_VERSION;
using namespace ::android::hardware::audio::effect::COMMON_TYPES_CPP_VERSION;

class EffectHalHidl : public EffectHalInterface, public EffectConversionHelperHidl
{
@@ -59,12 +59,9 @@ class EffectHalHidl : public EffectHalInterface, public EffectConversionHelperHi
    // Free resources on the remote side.
    virtual status_t close();

    // Whether it's a local implementation.
    virtual bool isLocal() const { return false; }

    virtual status_t dump(int fd);

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

  private:
    friend class EffectsFactoryHalHidl;
Loading