From 0d84430bbc95036bd189105510ee693aa4f041d6 Mon Sep 17 00:00:00 2001 From: Jon Spivack Date: Mon, 22 Jul 2019 18:40:34 -0700 Subject: ServiceManager signals init to start lazy services This allows services to be disabled at boot and dynamically enabled as they are needed. When servicemanager receives a getService request, it will check whether the service is running. If it is not, servicemanager will attempt to start the service by signaling init with the ctl.interface_start control message. Bug: 138756857 Test: Manual (using mediaextractor as a test service), test_sm Change-Id: Ic2d47d21769b936381e3fae2f2cf739d3b7501a4 --- libs/binder/IServiceManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libs/binder/IServiceManager.cpp') diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 715a4609d6..eefc5b1c4f 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -232,7 +232,7 @@ public: const std::string name = String8(name16).c_str(); sp out; - if(!mTheRealServiceManager->checkService(name, &out).isOk()) { + if (!mTheRealServiceManager->getService(name, &out).isOk()) { return nullptr; } if(out != nullptr) return out; @@ -256,13 +256,13 @@ public: // Handle race condition for lazy services. Here is what can happen: // - the service dies (not processed by init yet). // - sm processes death notification. - // - sm gets checkService and calls init to start service. + // - sm gets getService and calls init to start service. // - init gets the start signal, but the service already appears // started, so it does nothing. // - init gets death signal, but doesn't know it needs to restart // the service // - we need to request service again to get it to start - if(!mTheRealServiceManager->checkService(name, &out).isOk()) { + if (!mTheRealServiceManager->getService(name, &out).isOk()) { return nullptr; } if(out != nullptr) return out; -- cgit v1.2.3-59-g8ed1b