Add getInstance call to LazyServiceRegistrar
This is the first step in converting LazyServiceRegistrar to a
singleton. A later CL will make the constructor private.
Test: lshal
Bug: 139376253
Change-Id: I07f65327737b94656a91b2a9dcc67a28075b4406
diff --git a/transport/HidlLazyUtils.cpp b/transport/HidlLazyUtils.cpp
index 8e3fdf3..08ed676 100644
--- a/transport/HidlLazyUtils.cpp
+++ b/transport/HidlLazyUtils.cpp
@@ -181,6 +181,11 @@
mImpl = std::make_shared<details::LazyServiceRegistrarImpl>();
}
+LazyServiceRegistrar& LazyServiceRegistrar::getInstance() {
+ static auto registrarInstance = new LazyServiceRegistrar();
+ return *registrarInstance;
+}
+
status_t LazyServiceRegistrar::registerService(
const sp<::android::hidl::base::V1_0::IBase>& service, const std::string& name) {
return mImpl->registerService(service, name);