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/include/hidl/HidlLazyUtils.h b/transport/include/hidl/HidlLazyUtils.h
index 2205daa..257de98 100644
--- a/transport/include/hidl/HidlLazyUtils.h
+++ b/transport/include/hidl/HidlLazyUtils.h
@@ -29,12 +29,13 @@
/** Exits when all HALs registered through this object have 0 clients */
class LazyServiceRegistrar {
public:
- LazyServiceRegistrar();
- status_t registerService(const sp<::android::hidl::base::V1_0::IBase>& service,
- const std::string& name = "default");
+ LazyServiceRegistrar();
+ static LazyServiceRegistrar& getInstance();
+ status_t registerService(const sp<::android::hidl::base::V1_0::IBase>& service,
+ const std::string& name = "default");
private:
- std::shared_ptr<details::LazyServiceRegistrarImpl> mImpl;
+ std::shared_ptr<details::LazyServiceRegistrarImpl> mImpl;
};
} // namespace hardware