Consistently deal with onRegistration() transport errors.
In all cases, we remove the registered callback from our
internal state when a call into it fails.
We also register death recipients for each of the registered
callbacks.
Because of this, a registration callback failing should be
an extremely rare event: it can only happen if a callback
is attempted right after the process dies, but before we have
processed the death notification.
Therefore, log registration callbacks failing as errors, as
it may mean there's more going on.
Bug: 31632518
Bug: 34643534
Test: hidl_test; adb shell stop; manually killing processes with
listeners
Change-Id: I73be10c2c56d1a343f875960535a165531b5c235
diff --git a/HidlService.h b/HidlService.h
index 6a3c617..3de0abb 100644
--- a/HidlService.h
+++ b/HidlService.h
@@ -46,6 +46,7 @@
const std::string &getInstanceName() const;
void addListener(const sp<IServiceNotification> &listener);
+ bool removeListener(const wp<IBase> &listener);
void registerPassthroughClient(pid_t pid);
std::string string() const; // e.x. "android.hidl.manager@1.0::IServiceManager/manager"