CSD: add logic for selecting ISoundDose interface
There are two options for supporting sound dose. 1) the hardware
implements the standalone AIDL sound dose interface together with the
legacy audio HIDL HAL or 2) the hardware implements the new sound dose
methods as part of the audio AIDL HAL. The new logic selects the
implementation to use depending on the audio HAL that is active.
Test: bluejay-userdebug logs
Bug: 264254879
Change-Id: I0af9cd31c2e97bb9c9895439f55bbfa50e87e159
diff --git a/media/libaudiohal/impl/DeviceHalHidl.h b/media/libaudiohal/impl/DeviceHalHidl.h
index 052eb65..30fbd6d 100644
--- a/media/libaudiohal/impl/DeviceHalHidl.h
+++ b/media/libaudiohal/impl/DeviceHalHidl.h
@@ -130,12 +130,17 @@
status_t dump(int fd, const Vector<String16>& args) override;
+ status_t getSoundDoseInterface(const std::string& module,
+ ::ndk::SpAIBinder* soundDoseBinder) override;
+
private:
friend class DevicesFactoryHalHidl;
sp<::android::hardware::audio::CPP_VERSION::IDevice> mDevice;
// Null if it's not a primary device.
sp<::android::hardware::audio::CPP_VERSION::IPrimaryDevice> mPrimaryDevice;
bool supportsSetConnectedState7_1 = true;
+ class SoundDoseWrapper;
+ const std::unique_ptr<SoundDoseWrapper> mSoundDoseWrapper;
// Can not be constructed directly by clients.
explicit DeviceHalHidl(const sp<::android::hardware::audio::CPP_VERSION::IDevice>& device);