servicemanager: rely on auto unlinkToDeath
unlinkToDeath happens automatically when the last strong ref to a proxy
goes away (see 80d23935ff9d2c7ad9490800c163171151b6de20).
Bug: 136027762
Test: boot and check for log:
"onLastStrongRef automatically unlinking death recipients"
Change-Id: Iec16013548d9bda24f6e96d5cf80c69071953cb0
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index 5f7dc25..f35f360 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -98,18 +98,12 @@
return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT);
}
+ // implicitly unlinked when the binder is removed
if (OK != binder->linkToDeath(this)) {
LOG(ERROR) << "Could not linkToDeath when adding " << name;
return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
}
- auto it = mNameToService.find(name);
- if (it != mNameToService.end()) {
- if (OK != it->second.binder->unlinkToDeath(this)) {
- LOG(WARNING) << "Could not unlinkToDeath when adding " << name;
- }
- }
-
mNameToService[name] = Service {
.binder = binder,
.allowIsolated = allowIsolated,