mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Convert LazyServiceRegistrar usage to singleton
Test: lshal Bug: 139376253 Change-Id: I32cb803fb73aa15b52676847b6e7eb09b86657dc
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user