summaryrefslogtreecommitdiff
path: root/cmds/servicemanager/ServiceManager.cpp
diff options
context:
space:
mode:
author Jon Spivack <spivack@google.com> 2020-01-25 02:55:04 +0000
committer Jon Spivack <spivack@google.com> 2020-01-25 02:55:04 +0000
commit37f70cc1029e8e984e60f485db59d6e6889cbb1b (patch)
tree5564a869b35766ff2de63fa50f9eadb7f1452034 /cmds/servicemanager/ServiceManager.cpp
parent0ef670c49eeb8eb8c56c9a1187fd0933a535441f (diff)
Revert "Dynamically stop services with multiple interfaces"
Revert "Add aidl_lazy_test_server to Cuttlefish" Revert "Move aidl_lazy_test_server to system_ext" Revert submission 1209453-aidl-lazy-presubmit Reason for revert: b/148282665. A test has begun to fail on git_stage-aosp-master, and I need to verify whether these changes are responsible. Reverted Changes: Ib09a2460e: Add aidl_lazy_test to general-tests Ib08989356: Move aidl_lazy_test_server to system_ext I694e6ad35: Add aidl_lazy_test_server to Cuttlefish I65db12c63: Add aidl_lazy_test to presubmit I7ec80a280: Dynamically stop services with multiple interfaces... Change-Id: I6d3b589bf2861f68d2852c8def7a1f51eea7cf97
Diffstat (limited to 'cmds/servicemanager/ServiceManager.cpp')
-rw-r--r--cmds/servicemanager/ServiceManager.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index abe64365f3..ae74ac3847 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -423,12 +423,11 @@ ssize_t ServiceManager::Service::getNodeStrongRefCount() {
void ServiceManager::handleClientCallbacks() {
for (const auto& [name, service] : mNameToService) {
- handleServiceClientCallback(name, true);
+ handleServiceClientCallback(name);
}
}
-ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceName,
- bool isCalledOnInterval) {
+ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceName) {
auto serviceIt = mNameToService.find(serviceName);
if (serviceIt == mNameToService.end() || mNameToClientCallback.count(serviceName) < 1) {
return -1;
@@ -452,17 +451,14 @@ ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceNa
service.guaranteeClient = false;
}
- // only send notifications if this was called via the interval checking workflow
- if (isCalledOnInterval) {
- if (hasClients && !service.hasClients) {
- // client was retrieved in some other way
- sendClientCallbackNotifications(serviceName, true);
- }
+ if (hasClients && !service.hasClients) {
+ // client was retrieved in some other way
+ sendClientCallbackNotifications(serviceName, true);
+ }
- // there are no more clients, but the callback has not been called yet
- if (!hasClients && service.hasClients) {
- sendClientCallbackNotifications(serviceName, false);
- }
+ // there are no more clients, but the callback has not been called yet
+ if (!hasClients && service.hasClients) {
+ sendClientCallbackNotifications(serviceName, false);
}
return count;
@@ -522,7 +518,7 @@ Status ServiceManager::tryUnregisterService(const std::string& name, const sp<IB
return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
}
- int clients = handleServiceClientCallback(name, false);
+ int clients = handleServiceClientCallback(name);
// clients < 0: feature not implemented or other error. Assume clients.
// Otherwise:
@@ -531,7 +527,7 @@ Status ServiceManager::tryUnregisterService(const std::string& name, const sp<IB
// So, if clients > 2, then at least one other service on the system must hold a refcount.
if (clients < 0 || clients > 2) {
// client callbacks are either disabled or there are other clients
- LOG(INFO) << "Tried to unregister " << name << ", but there are clients: " << clients;
+ LOG(INFO) << "Tried to unregister " << name << " but there are clients: " << clients;
return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
}