@1.2::IServiceManager:onNoClients->onClients(bool)

The onClients method is now called with a boolean reflecting whether
clients are present or not. This is to handle a case where multiple
HALs are in the same process, and when none of them are being used,
the process can be shut down.

- onClients(true) (when true) must be called immediately
- onClients(false) (when false) may be delayed when hwservicemanager (or
    something else in the future) thinks that the HAL may be used again.
    For instance, in the future, we may add heuristic where if a client
    has been used for X HAL in the last 10 minutes, we wouldn't ever
    notify the HAL that it has no clients. The important thing is that
    this ownership of the lifecycle is retained by hwservicemanager.

Given this behavior, when multiple hals are in the same lazy process,
they can wait until onClients(false) is true for each of them and then
shutdown.

Fixes: 117779690
Test: hidl_test
Test: manually test and use this API
Change-Id: Ic8d9fa8485855daa5a7d5639b09934305a560a0a
2 files changed