Skip to content

Commit 43e3b8b

Browse files
committed
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
1 parent e1c075b commit 43e3b8b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

libs/binder/IServiceManager.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ IServiceManager::~IServiceManager() {}
8282
class ServiceManagerShim : public IServiceManager
8383
{
8484
public:
85-
explicit ServiceManagerShim (const sp<AidlServiceManager>& impl);
85+
explicit ServiceManagerShim(const sp<BackendUnifiedServiceManager>& impl);
8686

8787
sp<IBinder> getService(const String16& name) const override;
8888
sp<IBinder> checkService(const String16& name) const override;
@@ -278,9 +278,8 @@ void* openDeclaredPassthroughHal(const String16& interface, const String16& inst
278278

279279
// ----------------------------------------------------------------------
280280

281-
ServiceManagerShim::ServiceManagerShim(const sp<AidlServiceManager>& impl) {
282-
mUnifiedServiceManager = sp<BackendUnifiedServiceManager>::make(impl);
283-
}
281+
ServiceManagerShim::ServiceManagerShim(const sp<BackendUnifiedServiceManager>& impl)
282+
: mUnifiedServiceManager(impl) {}
284283

285284
// This implementation could be simplified and made more efficient by delegating
286285
// to waitForService. However, this changes the threading structure in some
@@ -621,7 +620,7 @@ class ServiceManagerHostShim : public ServiceManagerShim {
621620
public:
622621
ServiceManagerHostShim(const sp<AidlServiceManager>& impl,
623622
const RpcDelegateServiceManagerOptions& options)
624-
: ServiceManagerShim(impl), mOptions(options) {}
623+
: ServiceManagerShim(sp<BackendUnifiedServiceManager>::make(impl)), mOptions(options) {}
625624
// ServiceManagerShim::getService is based on checkService, so no need to override it.
626625
sp<IBinder> checkService(const String16& name) const override {
627626
return getDeviceService({String8(name).c_str()}, mOptions);

0 commit comments

Comments
 (0)