HidlLazyUtils: avoid race w/ register & onClients
In HIDL, the threadpool is started whenever a binder object is sent to
another process, so there is the rare race condition:
- a process has a threadpool of size > 1
- it calls register service
- when sending this service to hwservicemanager, under the hood, the
threadpool is started (but it hasn't recorded internally that the
service is registered)
- another process gets ahold of the service
- hwservicemanager tells the service it has a client
- the service aborts, because it has no record of registering this
service
Bug: 191608065
Test: hidl_lazy_test
Change-Id: Ia430352db4fb1345ba3e6633e3918b441af24fd7
2 files changed