libaudiohal@aidl: Use system property to detect IHalAdapterVendorExtension
Use of the device manifest for this purpose was discouraged after
a discussion. The alternative is to use a system property which
needs to be set by vendors together with putting an implementation
of IHalAdapterVendorExtension to the `system_ext` partition.
Remove the vintf fragment to avoid confusing vintf assembly and test
processes.
Bug: 323989070
Test: atest audiorouting_test
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:38a393256d5f224816cba8dad7422dd114d29d13)
Merged-In: If00ec0653590cf2f078d94bc57dfce47d8e98e01
Change-Id: If00ec0653590cf2f078d94bc57dfce47d8e98e01
diff --git a/media/libaudiohal/impl/DevicesFactoryHalAidl.cpp b/media/libaudiohal/impl/DevicesFactoryHalAidl.cpp
index 01fc7fb..347afa6 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalAidl.cpp
+++ b/media/libaudiohal/impl/DevicesFactoryHalAidl.cpp
@@ -26,6 +26,7 @@
#include <aidl/android/hardware/audio/core/IModule.h>
#include <aidl/android/media/audio/BnHalAdapterVendorExtension.h>
#include <android/binder_manager.h>
+#include <cutils/properties.h>
#include <media/AidlConversionNdkCpp.h>
#include <media/AidlConversionUtil.h>
#include <utils/Log.h>
@@ -121,8 +122,8 @@
std::shared_ptr<IHalAdapterVendorExtension> getService(bool reset = false) {
std::lock_guard l(mLock);
if (reset || !mVendorExt.has_value()) {
- auto serviceName = std::string(IHalAdapterVendorExtension::descriptor) + "/default";
- if (AServiceManager_isDeclared(serviceName.c_str())) {
+ if (property_get_bool("ro.audio.ihaladaptervendorextension_enabled", false)) {
+ auto serviceName = std::string(IHalAdapterVendorExtension::descriptor) + "/default";
mVendorExt = std::shared_ptr<IHalAdapterVendorExtension>(
IHalAdapterVendorExtension::fromBinder(ndk::SpAIBinder(
AServiceManager_waitForService(serviceName.c_str()))));