1 #include <binder/IBinder.h> 2 #include <binder/IPCThreadState.h> 3 #include <binder/IServiceManager.h> 4 #include <binder/LazyServiceRegistrar.h> 5 #include <utils/Log.h> 6 #include "LazyTestService.h" 7 8 using android::BBinder; 9 using android::IBinder; 10 using android::IPCThreadState; 11 using android::OK; 12 using android::sp; 13 using android::binder::LazyServiceRegistrar; 14 using android::binder::LazyTestService; 15 main()16int main() { 17 sp<LazyTestService> service1 = new LazyTestService(); 18 sp<LazyTestService> service2 = new LazyTestService(); 19 20 auto lazyRegistrar = LazyServiceRegistrar::getInstance(); 21 LOG_ALWAYS_FATAL_IF(OK != lazyRegistrar.registerService(service1, "aidl_lazy_test_1"), ""); 22 LOG_ALWAYS_FATAL_IF(OK != lazyRegistrar.registerService(service2, "aidl_lazy_test_2"), ""); 23 24 IPCThreadState::self()->joinThreadPool(); 25 26 return 1; 27 } 28