diff options
-rw-r--r-- | libs/binder/LazyServiceRegistrar.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libs/binder/LazyServiceRegistrar.cpp b/libs/binder/LazyServiceRegistrar.cpp index f064bd77ce..71d8130df9 100644 --- a/libs/binder/LazyServiceRegistrar.cpp +++ b/libs/binder/LazyServiceRegistrar.cpp @@ -64,8 +64,7 @@ private: bool ClientCounterCallback::registerService(const sp<IBinder>& service, const std::string& name, bool allowIsolated, int dumpFlags) { - auto manager = interface_cast<AidlServiceManager>( - ProcessState::self()->getContextObject(nullptr)); + auto manager = interface_cast<AidlServiceManager>(asBinder(defaultServiceManager())); bool reRegister = mRegisteredServices.count(name) > 0; std::string regStr = (reRegister) ? "Re-registering" : "Registering"; @@ -114,9 +113,7 @@ Status ClientCounterCallback::onClients(const sp<IBinder>& service, bool clients void ClientCounterCallback::tryShutdown() { ALOGI("Trying to shut down the service. No clients in use for any service in process."); - // This makes the same assumption as IServiceManager.cpp. Could dedupe if used in more places. - auto manager = interface_cast<AidlServiceManager>( - ProcessState::self()->getContextObject(nullptr)); + auto manager = interface_cast<AidlServiceManager>(asBinder(defaultServiceManager())); auto unRegisterIt = mRegisteredServices.begin(); for (; unRegisterIt != mRegisteredServices.end(); ++unRegisterIt) { |