Convert LazyServiceRegistrar usage to singleton

Test: lshal
Bug: 139376253
Change-Id: I32cb803fb73aa15b52676847b6e7eb09b86657dc
This commit is contained in:
Peter Kalauskas
2019-08-14 12:11:57 -07:00
parent 0c7812c7f5
commit caed24ba9b
3 changed files with 5 additions and 5 deletions

View File

@@ -49,8 +49,8 @@ int main()
status_t status;
if (kLazyService) {
auto serviceRegistrar = std::make_shared<::android::hardware::LazyServiceRegistrar>();
status = serviceRegistrar->registerService(provider, "legacy/0");
auto serviceRegistrar = ::android::hardware::LazyServiceRegistrar::getInstance();
status = serviceRegistrar.registerService(provider, "legacy/0");
} else {
status = provider->registerAsService("legacy/0");
}

View File

@@ -46,8 +46,8 @@ int main() {
android::sp<IMediaCasService> service = new MediaCasService();
android::status_t status;
if (kLazyService) {
auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
status = serviceRegistrar->registerService(service);
auto serviceRegistrar = LazyServiceRegistrar::getInstance();
status = serviceRegistrar.registerService(service);
} else {
status = service->registerAsService();
}

View File

@@ -58,7 +58,7 @@ int main(int /*argc*/, char** argv) {
std::make_shared<WifiIfaceUtil>(iface_tool),
std::make_shared<WifiFeatureFlags>());
if (kLazyService) {
LazyServiceRegistrar registrar;
auto registrar = LazyServiceRegistrar::getInstance();
CHECK_EQ(registrar.registerService(service), android::NO_ERROR)
<< "Failed to register wifi HAL";
} else {