Allow CPP<->legacy and NDK<->legacy to coexist in the same module
Introduce BACKEND_CPP_NDK define for modules that need to use
both CPP<->legacy and NDK<->legacy converters, for example,
to bridge CPP and NDK types, as in libaudiohal@aidl.
Restructure AidlConversion* headers to support this.
Also, brush up some headers for better compliance to the style
guide.
Note that in modules that import both conversion packages,
"legacy2aidl" functions need to be called using a fully qualified
name to avoid ambiguities since the CPP and NDK backend versions
only differ by the return type.
Bug: 205884982
Test: m
Change-Id: Iec35c73563459cde60a5c0265a0c8d0ef1fc5fbd
diff --git a/media/libaudiohal/impl/StreamHalAidl.cpp b/media/libaudiohal/impl/StreamHalAidl.cpp
index 1c15cfb..5f62ad8 100644
--- a/media/libaudiohal/impl/StreamHalAidl.cpp
+++ b/media/libaudiohal/impl/StreamHalAidl.cpp
@@ -505,7 +505,8 @@
// Initialize the offload metadata
mOffloadMetadata.sampleRate = static_cast<int32_t>(config.sample_rate);
mOffloadMetadata.channelMask = VALUE_OR_FATAL(
- legacy2aidl_audio_channel_mask_t_AudioChannelLayout(config.channel_mask, false));
+ ::aidl::android::legacy2aidl_audio_channel_mask_t_AudioChannelLayout(
+ config.channel_mask, false));
mOffloadMetadata.averageBitRatePerSecond = static_cast<int32_t>(config.offload_info.bit_rate);
}
@@ -769,8 +770,9 @@
return BAD_VALUE;
}
mOffloadMetadata.channelMask =
- VALUE_OR_RETURN_STATUS(legacy2aidl_audio_channel_mask_t_AudioChannelLayout(
- channel_mask, false));
+ VALUE_OR_RETURN_STATUS(
+ ::aidl::android::legacy2aidl_audio_channel_mask_t_AudioChannelLayout(
+ channel_mask, false));
parameters.remove(String8(AudioParameter::keyOffloadCodecChannels));
}