Call guaranteeClient on all services in interface chain am: 5531f87ad3

Original change: https://android-review.googlesource.com/c/platform/system/hwservicemanager/+/1339063

Change-Id: Id5baacf57daa7de2d1fa581574c2b5477198bd24
diff --git a/ServiceManager.cpp b/ServiceManager.cpp
index 0e45cc6..fffe281 100644
--- a/ServiceManager.cpp
+++ b/ServiceManager.cpp
@@ -284,6 +284,12 @@
     // Let HidlService know that we handed out a client. If the client drops the service before the
     // next time handleClientCallbacks is called, it will still know that the service had been handed out.
     hidlService->guaranteeClient();
+    forEachExistingService([&] (HidlService *otherService) {
+        if (otherService != hidlService && interfacesEqual(service, otherService->getService())) {
+            otherService->guaranteeClient();
+        }
+        return true;
+    });
 
     // This is executed immediately after the binder driver confirms the transaction. The driver
     // will update the appropriate data structures to reflect the fact that the client now has the