diff options
author | Steven Moreland <smoreland@google.com> | 2019-01-24 18:09:16 -0800 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2019-01-25 21:40:23 +0000 |
commit | ea2fb5512079284dafa21b4ee9fc30a62e19ea5e (patch) | |
tree | 92b9d73dca8a149973735414190be97b026b2eb4 /transport/HidlTransportUtils.cpp | |
parent | 70a823a0326041c4e1c80329fc459a62aa0a1887 (diff) | |
download | libhidl-ea2fb5512079284dafa21b4ee9fc30a62e19ea5e.tar.gz |
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
Diffstat (limited to 'transport/HidlTransportUtils.cpp')
-rw-r--r-- | transport/HidlTransportUtils.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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 @@ Return<bool> canCastInterface(IBase* interface, const char* castTo, bool emitErr } std::string getDescriptor(IBase* interface) { + if (interface == nullptr) { + return ""; + } + std::string myDescriptor{}; auto ret = interface->interfaceDescriptor([&](const hidl_string &types) { myDescriptor = types.c_str(); |