Fix race conditions for lazy services.
Add hidlFqName/hidlName to registerClientCallbacks to make it more
explicit, provide better errors, and for general sanity.
Add tryUnregister so that a service can unregister itself before
shutting down.
Bug: 123318663
Test: hidl_test, manual
Change-Id: I3ee26ba96dbc9732e72aaa16281abc47ce6a02c9
diff --git a/transport/HidlTransportUtils.cpp b/transport/HidlTransportUtils.cpp
index 4e952eb..8c61281 100644
--- a/transport/HidlTransportUtils.cpp
+++ b/transport/HidlTransportUtils.cpp
@@ -56,6 +56,10 @@
}
std::string getDescriptor(IBase* interface) {
+ if (interface == nullptr) {
+ return "";
+ }
+
std::string myDescriptor{};
auto ret = interface->interfaceDescriptor([&](const hidl_string &types) {
myDescriptor = types.c_str();