summaryrefslogtreecommitdiff
path: root/cmds/servicemanager/ServiceManager.cpp
diff options
context:
space:
mode:
author Alice Wang <aliceywang@google.com> 2024-07-25 12:03:22 +0000
committer Alice Wang <aliceywang@google.com> 2024-07-26 08:13:54 +0000
commit11da150351b13f5d216793176b41d0edfa2cf29e (patch)
tree1c520d90b92fbe074182a20d7380b27068c2ac11 /cmds/servicemanager/ServiceManager.cpp
parent725f82805c174911e1cfbb2d1bea0001335af20c (diff)
[native] Restore ServiceManager#getService() to return IBinder
This fixes a crash in 3p libraries. A new API ServiceManager#getService2() has been introduced to work with the Service enum type. Bug: 354674329 Bug: 355187769 Test: atest servicemanager_test Test: atest vm_accessor_test Test: Run the demo app in b/354674329 and check it works Change-Id: If1e0e9bee6dcd3cfceea69bea58ed5fbe431e81d
Diffstat (limited to 'cmds/servicemanager/ServiceManager.cpp')
-rw-r--r--cmds/servicemanager/ServiceManager.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index c44e540c6d..ef2fa4dff7 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -392,7 +392,16 @@ ServiceManager::~ServiceManager() {
}
}
-Status ServiceManager::getService(const std::string& name, os::Service* outService) {
+Status ServiceManager::getService(const std::string& name, sp<IBinder>* outBinder) {
+ SM_PERFETTO_TRACE_FUNC(PERFETTO_TE_PROTO_FIELDS(
+ PERFETTO_TE_PROTO_FIELD_CSTR(kProtoServiceName, name.c_str())));
+
+ *outBinder = tryGetBinder(name, true);
+ // returns ok regardless of result for legacy reasons
+ return Status::ok();
+}
+
+Status ServiceManager::getService2(const std::string& name, os::Service* outService) {
SM_PERFETTO_TRACE_FUNC(PERFETTO_TE_PROTO_FIELDS(
PERFETTO_TE_PROTO_FIELD_CSTR(kProtoServiceName, name.c_str())));