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/EffectsFactoryHalAidl.cpp b/media/libaudiohal/impl/EffectsFactoryHalAidl.cpp
index b418b6c..f289f24 100644
--- a/media/libaudiohal/impl/EffectsFactoryHalAidl.cpp
+++ b/media/libaudiohal/impl/EffectsFactoryHalAidl.cpp
@@ -89,7 +89,8 @@
return BAD_VALUE;
}
- AudioUuid uuid = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(*halUuid));
+ AudioUuid uuid = VALUE_OR_RETURN_STATUS(
+ ::aidl::android::legacy2aidl_audio_uuid_t_AudioUuid(*halUuid));
std::lock_guard lg(mLock);
return getHalDescriptorWithImplUuid_l(uuid, pDescriptor);
}
@@ -100,7 +101,8 @@
return BAD_VALUE;
}
- AudioUuid type = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(*halType));
+ AudioUuid type = VALUE_OR_RETURN_STATUS(
+ ::aidl::android::legacy2aidl_audio_uuid_t_AudioUuid(*halType));
std::lock_guard lg(mLock);
return getHalDescriptorWithTypeUuid_l(type, descriptors);
}
@@ -117,7 +119,8 @@
ALOGI("%s session %d ioId %d", __func__, sessionId, ioId);
- AudioUuid aidlUuid = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(*uuid));
+ AudioUuid aidlUuid = VALUE_OR_RETURN_STATUS(
+ ::aidl::android::legacy2aidl_audio_uuid_t_AudioUuid(*uuid));
std::shared_ptr<IEffect> aidlEffect;
Descriptor desc;
RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(mFactory->createEffect(aidlUuid, &aidlEffect)));