Add missing Cap Settings aidl support and helper
Bug: 307310023
Test: atest AudioCoreConfig
Change-Id: I08c71ce9a67f065df36f71c0602e2c9e4e97ae6b
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
diff --git a/audio/aidl/common/Android.bp b/audio/aidl/common/Android.bp
index 5c0c685..c14d19d 100644
--- a/audio/aidl/common/Android.bp
+++ b/audio/aidl/common/Android.bp
@@ -32,10 +32,12 @@
header_libs: [
"libbase_headers",
"libsystem_headers",
+ "libutils_headers",
],
export_header_lib_headers: [
"libbase_headers",
"libsystem_headers",
+ "libutils_headers",
],
srcs: [
"StreamWorker.cpp",
diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h
index 74be3c4..dd0c7e7 100644
--- a/audio/aidl/common/include/Utils.h
+++ b/audio/aidl/common/include/Utils.h
@@ -32,6 +32,7 @@
#include <aidl/android/media/audio/common/AudioPolicyForcedConfig.h>
#include <aidl/android/media/audio/common/PcmType.h>
#include <android/binder_auto_utils.h>
+#include <utils/FastStrcmp.h>
namespace ndk {
@@ -84,6 +85,11 @@
::aidl::android::media::audio::common::AudioPolicyForcedConfig::BT_BLE,
};
+constexpr bool iequals(const std::string& str1, const std::string& str2) {
+ return str1.length() == str2.length() &&
+ !fasticmp<strncmp>(str1.c_str(), str2.c_str(), str1.length());
+}
+
constexpr size_t getPcmSampleSizeInBytes(::aidl::android::media::audio::common::PcmType pcm) {
using ::aidl::android::media::audio::common::PcmType;
switch (pcm) {