libbinder: avoid re-registering callback
This code assumes that it is only registered once, and so in some cases,
the service wasn't shutting down.
Bug: 140310064
Test: aidl_lazy_test
Change-Id: I19474e105b4c4b3669499ac71c8cf22b67a0176b
diff --git a/libs/binder/LazyServiceRegistrar.cpp b/libs/binder/LazyServiceRegistrar.cpp
index d4f26a1..6d01652 100644
--- a/libs/binder/LazyServiceRegistrar.cpp
+++ b/libs/binder/LazyServiceRegistrar.cpp
@@ -82,12 +82,12 @@
return false;
}
- if (!manager->registerClientCallback(name, service, this).isOk()) {
- ALOGE("Failed to add client callback for service %s", name.c_str());
- return false;
- }
-
if (!reRegister) {
+ if (!manager->registerClientCallback(name, service, this).isOk()) {
+ ALOGE("Failed to add client callback for service %s", name.c_str());
+ return false;
+ }
+
// Only add this when a service is added for the first time, as it is not removed
mRegisteredServices[name] = {service, allowIsolated, dumpFlags};
}