Reland "servicemanager: fix lazy service issues"

This reverts commit 66417657c54cebaeda3be19e539bb17d89172ed4.

This CL is relanding removing a check, that was
actually hit when services die.

Most of the issues here occured in a single thread, and
they were due to inconsistent state in the state machine
around clients, and it appears there were a lot of other
things added which papered over these issues.

I've marked explanations in more detail in the code
itself.

Bug: 264814573
Test: aidl_lazy_test in a loop at 500x speed by
    adjusting timings, running for an hour

Change-Id: Icbd72470dbe91761800761e81893f3ebe343e430
diff --git a/cmds/servicemanager/ServiceManager.h b/cmds/servicemanager/ServiceManager.h
index f9d4f8f..3aa6731 100644
--- a/cmds/servicemanager/ServiceManager.h
+++ b/cmds/servicemanager/ServiceManager.h
@@ -80,6 +80,8 @@
 
         // the number of clients of the service, including servicemanager itself
         ssize_t getNodeStrongRefCount();
+
+        ~Service();
     };
 
     using ServiceCallbackMap = std::map<std::string, std::vector<sp<IServiceCallback>>>;
@@ -91,7 +93,9 @@
     void removeRegistrationCallback(const wp<IBinder>& who,
                         ServiceCallbackMap::iterator* it,
                         bool* found);
-    ssize_t handleServiceClientCallback(const std::string& serviceName, bool isCalledOnInterval);
+    // returns whether there are known clients in addition to the count provided
+    bool handleServiceClientCallback(size_t knownClients, const std::string& serviceName,
+                                     bool isCalledOnInterval);
     // Also updates mHasClients (of what the last callback was)
     void sendClientCallbackNotifications(const std::string& serviceName, bool hasClients,
                                          const char* context);