Implement addWithChain.

This prevents hwservicemanager from having to make non-oneway calls.

Bug: 36424585
Test: hidl_test
Change-Id: Id044c472f3cb0aa4bcf037fa261b76dbc77c393a
diff --git a/ServiceManager.h b/ServiceManager.h
index 361cfd4..44936d5 100644
--- a/ServiceManager.h
+++ b/ServiceManager.h
@@ -57,11 +57,20 @@
                                         const sp<IClientCallback>& cb) override;
     Return<bool> unregisterClientCallback(const sp<IBase>& server,
                                           const sp<IClientCallback>& cb) override;
+    Return<bool> addWithChain(const hidl_string& name,
+                              const sp<IBase>& service,
+                              const hidl_vec<hidl_string>& chain) override;
 
     void handleClientCallbacks();
 
     virtual void serviceDied(uint64_t cookie, const wp<IBase>& who);
 private:
+    bool addImpl(const hidl_string& name,
+                 const sp<IBase>& service,
+                 const hidl_vec<hidl_string>& interfaceChain,
+                 const AccessControl::Context &context,
+                 pid_t pid);
+
     // if restrictToInstanceName is nullptr, remove all, otherwise only those services
     // which match this instance name. Returns whether all instances were removed.
     bool removeService(const wp<IBase>& who, const std::string* restrictToInstanceName);