Update libaudiohal with AudioHalVersionInfo
Bug: 261129656
Test: atest VtsHalAudioEffectTargetTest
Flash to Cuttlefish and Panther and check audio.
Change-Id: Ieace37b25dc03d50048b35b1c63b4ec5f39257c8
diff --git a/services/audioflinger/DeviceEffectManager.cpp b/services/audioflinger/DeviceEffectManager.cpp
index a614736..bd0d7fb 100644
--- a/services/audioflinger/DeviceEffectManager.cpp
+++ b/services/audioflinger/DeviceEffectManager.cpp
@@ -30,6 +30,7 @@
namespace android {
+using media::AudioHalVersion;
using media::IEffectClient;
void AudioFlinger::DeviceEffectManager::onCreateAudioPatch(audio_patch_handle_t handle,
@@ -115,14 +116,19 @@
return BAD_VALUE;
}
- static const float sMinDeviceEffectHalVersion = 6.0;
- float halVersion = effectsFactory->getHalVersion();
+ static AudioHalVersion sMinDeviceEffectHalVersion;
+ sMinDeviceEffectHalVersion.type = AudioHalVersion::Type::HIDL;
+ sMinDeviceEffectHalVersion.major = 6;
+ sMinDeviceEffectHalVersion.minor = 0;
+ AudioHalVersion halVersion = effectsFactory->getHalVersion();
+ // We can trust AIDL generated AudioHalVersion comparison operator (based on std::tie) as long
+ // as the type, major and minor sequence doesn't change in the definition.
if (((desc->flags & EFFECT_FLAG_TYPE_MASK) != EFFECT_FLAG_TYPE_PRE_PROC
&& (desc->flags & EFFECT_FLAG_TYPE_MASK) != EFFECT_FLAG_TYPE_POST_PROC)
|| halVersion < sMinDeviceEffectHalVersion) {
- ALOGW("%s() non pre/post processing device effect %s or incompatible API version %f",
- __func__, desc->name, halVersion);
+ ALOGW("%s() non pre/post processing device effect %s or incompatible API version %s",
+ __func__, desc->name, halVersion.toString().c_str());
return BAD_VALUE;
}