Change constructor of ServiceManagerShim

Without this change the defaultServiceManager()
would return a ServiceManagerShim with a BackendUnifiedServiceManager
holding a BackendUnifiedServiceManager.

Test: atest aidl_integration_test
Bug: 333854840
Flag: Exempt Bugfix
Change-Id: I3d3bcfa3392da89085b8f034c42aff30759a2cd2
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 8b80aed..3e848ab 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -82,7 +82,7 @@
 class ServiceManagerShim : public IServiceManager
 {
 public:
-    explicit ServiceManagerShim (const sp<AidlServiceManager>& impl);
+    explicit ServiceManagerShim(const sp<BackendUnifiedServiceManager>& impl);
 
     sp<IBinder> getService(const String16& name) const override;
     sp<IBinder> checkService(const String16& name) const override;
@@ -278,9 +278,8 @@
 
 // ----------------------------------------------------------------------
 
-ServiceManagerShim::ServiceManagerShim(const sp<AidlServiceManager>& impl) {
-    mUnifiedServiceManager = sp<BackendUnifiedServiceManager>::make(impl);
-}
+ServiceManagerShim::ServiceManagerShim(const sp<BackendUnifiedServiceManager>& impl)
+      : mUnifiedServiceManager(impl) {}
 
 // This implementation could be simplified and made more efficient by delegating
 // to waitForService. However, this changes the threading structure in some
@@ -621,7 +620,7 @@
 public:
     ServiceManagerHostShim(const sp<AidlServiceManager>& impl,
                            const RpcDelegateServiceManagerOptions& options)
-          : ServiceManagerShim(impl), mOptions(options) {}
+          : ServiceManagerShim(sp<BackendUnifiedServiceManager>::make(impl)), mOptions(options) {}
     // ServiceManagerShim::getService is based on checkService, so no need to override it.
     sp<IBinder> checkService(const String16& name) const override {
         return getDeviceService({String8(name).c_str()}, mOptions);