summaryrefslogtreecommitdiff
path: root/transport/HidlTransportUtils.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2019-01-24 18:09:16 -0800
committerSteven Moreland <smoreland@google.com>2019-01-25 21:40:23 +0000
commitea2fb5512079284dafa21b4ee9fc30a62e19ea5e (patch)
tree92b9d73dca8a149973735414190be97b026b2eb4 /transport/HidlTransportUtils.cpp
parent70a823a0326041c4e1c80329fc459a62aa0a1887 (diff)
downloadlibhidl-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.cpp4
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();