Merge "servicemanager: rely on auto unlinkToDeath" into stage-aosp-master
am: f881941614

Change-Id: Id3e49ad9ae01110ba3edcc826332195e5d9d624b
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,