Create a null HIDL wrapper if AIDL is registered
On upgrading devices the codec mainline module needs to be able to
register either HIDL or AIDL based on a sysprop. When one is selected,
the other is registered with a small null implementation.
Test: m
Bug: none
Change-Id: Ic9b69da991e030d6abf6a3e90c99cc7181bfeb20
diff --git a/media/module/codecserviceregistrant/CodecServiceRegistrant.cpp b/media/module/codecserviceregistrant/CodecServiceRegistrant.cpp
index e01bf0d..6df9dc8 100644
--- a/media/module/codecserviceregistrant/CodecServiceRegistrant.cpp
+++ b/media/module/codecserviceregistrant/CodecServiceRegistrant.cpp
@@ -858,6 +858,14 @@
// If the software component store isn't declared in the manifest, we don't
// need to create the service and register it.
if (hidlStore) {
+ if (registered && aidlSelected) {
+ LOG(INFO) << "Both HIDL and AIDL software codecs are declared in the vintf "
+ << "manifest, but AIDL was selected. "
+ << "Creating a null HIDL service so it's not accidentally "
+ << "used. The AIDL software codec is already registered.";
+ hidlStore = ::android::sp<V1_2::utils::ComponentStore>::make(
+ std::make_shared<H2C2ComponentStore>(nullptr));
+ }
if (hidlStore->registerAsService("software") == android::OK) {
registered = true;
} else {