Loading cmds/servicemanager/ServiceManager.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -410,7 +410,16 @@ Status ServiceManager::getService2(const std::string& name, os::Service* outServ return Status::ok(); } Status ServiceManager::checkService(const std::string& name, os::Service* outService) { Status ServiceManager::checkService(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, false).service; // returns ok regardless of result for legacy reasons return Status::ok(); } Status ServiceManager::checkService2(const std::string& name, os::Service* outService) { SM_PERFETTO_TRACE_FUNC(PERFETTO_TE_PROTO_FIELDS( PERFETTO_TE_PROTO_FIELD_CSTR(kProtoServiceName, name.c_str()))); Loading cmds/servicemanager/ServiceManager.h +2 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ public: // getService will try to start any services it cannot find binder::Status getService(const std::string& name, sp<IBinder>* outBinder) override; binder::Status getService2(const std::string& name, os::Service* outService) override; binder::Status checkService(const std::string& name, os::Service* outService) override; binder::Status checkService(const std::string& name, sp<IBinder>* outBinder) override; binder::Status checkService2(const std::string& name, os::Service* outService) override; binder::Status addService(const std::string& name, const sp<IBinder>& binder, bool allowIsolated, int32_t dumpPriority) override; binder::Status listServices(int32_t dumpPriority, std::vector<std::string>* outList) override; Loading cmds/servicemanager/test_sm.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,11 @@ TEST(GetService, HappyHappy) { sp<IBinder> outBinder; EXPECT_TRUE(sm->getService("foo", &outBinder).isOk()); EXPECT_EQ(service, outBinder); EXPECT_TRUE(sm->checkService2("foo", &out).isOk()); EXPECT_EQ(service, out.get<Service::Tag::serviceWithMetadata>().service); EXPECT_TRUE(sm->checkService("foo", &outBinder).isOk()); EXPECT_EQ(service, outBinder); } TEST(GetService, NonExistant) { Loading libs/binder/BackendUnifiedServiceManager.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -238,7 +238,17 @@ Status BackendUnifiedServiceManager::getService2(const ::std::string& name, os:: return status; } Status BackendUnifiedServiceManager::checkService(const ::std::string& name, os::Service* _out) { Status BackendUnifiedServiceManager::checkService(const ::std::string& name, sp<IBinder>* _aidl_return) { os::Service service; Status status = checkService2(name, &service); if (status.isOk()) { *_aidl_return = service.get<os::Service::Tag::serviceWithMetadata>().service; } return status; } Status BackendUnifiedServiceManager::checkService2(const ::std::string& name, os::Service* _out) { os::Service service; if (returnIfCached(name, _out)) { return Status::ok(); Loading @@ -246,7 +256,7 @@ Status BackendUnifiedServiceManager::checkService(const ::std::string& name, os: Status status = Status::ok(); if (mTheRealServiceManager) { status = mTheRealServiceManager->checkService(name, &service); status = mTheRealServiceManager->checkService2(name, &service); } if (status.isOk()) { status = toBinderService(name, service, _out); Loading libs/binder/BackendUnifiedServiceManager.h +2 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,8 @@ public: binder::Status getService(const ::std::string& name, sp<IBinder>* _aidl_return) override; binder::Status getService2(const ::std::string& name, os::Service* out) override; binder::Status checkService(const ::std::string& name, os::Service* out) override; binder::Status checkService(const ::std::string& name, sp<IBinder>* _aidl_return) override; binder::Status checkService2(const ::std::string& name, os::Service* out) override; binder::Status addService(const ::std::string& name, const sp<IBinder>& service, bool allowIsolated, int32_t dumpPriority) override; binder::Status listServices(int32_t dumpPriority, Loading Loading
cmds/servicemanager/ServiceManager.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -410,7 +410,16 @@ Status ServiceManager::getService2(const std::string& name, os::Service* outServ return Status::ok(); } Status ServiceManager::checkService(const std::string& name, os::Service* outService) { Status ServiceManager::checkService(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, false).service; // returns ok regardless of result for legacy reasons return Status::ok(); } Status ServiceManager::checkService2(const std::string& name, os::Service* outService) { SM_PERFETTO_TRACE_FUNC(PERFETTO_TE_PROTO_FIELDS( PERFETTO_TE_PROTO_FIELD_CSTR(kProtoServiceName, name.c_str()))); Loading
cmds/servicemanager/ServiceManager.h +2 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ public: // getService will try to start any services it cannot find binder::Status getService(const std::string& name, sp<IBinder>* outBinder) override; binder::Status getService2(const std::string& name, os::Service* outService) override; binder::Status checkService(const std::string& name, os::Service* outService) override; binder::Status checkService(const std::string& name, sp<IBinder>* outBinder) override; binder::Status checkService2(const std::string& name, os::Service* outService) override; binder::Status addService(const std::string& name, const sp<IBinder>& binder, bool allowIsolated, int32_t dumpPriority) override; binder::Status listServices(int32_t dumpPriority, std::vector<std::string>* outList) override; Loading
cmds/servicemanager/test_sm.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,11 @@ TEST(GetService, HappyHappy) { sp<IBinder> outBinder; EXPECT_TRUE(sm->getService("foo", &outBinder).isOk()); EXPECT_EQ(service, outBinder); EXPECT_TRUE(sm->checkService2("foo", &out).isOk()); EXPECT_EQ(service, out.get<Service::Tag::serviceWithMetadata>().service); EXPECT_TRUE(sm->checkService("foo", &outBinder).isOk()); EXPECT_EQ(service, outBinder); } TEST(GetService, NonExistant) { Loading
libs/binder/BackendUnifiedServiceManager.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -238,7 +238,17 @@ Status BackendUnifiedServiceManager::getService2(const ::std::string& name, os:: return status; } Status BackendUnifiedServiceManager::checkService(const ::std::string& name, os::Service* _out) { Status BackendUnifiedServiceManager::checkService(const ::std::string& name, sp<IBinder>* _aidl_return) { os::Service service; Status status = checkService2(name, &service); if (status.isOk()) { *_aidl_return = service.get<os::Service::Tag::serviceWithMetadata>().service; } return status; } Status BackendUnifiedServiceManager::checkService2(const ::std::string& name, os::Service* _out) { os::Service service; if (returnIfCached(name, _out)) { return Status::ok(); Loading @@ -246,7 +256,7 @@ Status BackendUnifiedServiceManager::checkService(const ::std::string& name, os: Status status = Status::ok(); if (mTheRealServiceManager) { status = mTheRealServiceManager->checkService(name, &service); status = mTheRealServiceManager->checkService2(name, &service); } if (status.isOk()) { status = toBinderService(name, service, _out); Loading
libs/binder/BackendUnifiedServiceManager.h +2 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,8 @@ public: binder::Status getService(const ::std::string& name, sp<IBinder>* _aidl_return) override; binder::Status getService2(const ::std::string& name, os::Service* out) override; binder::Status checkService(const ::std::string& name, os::Service* out) override; binder::Status checkService(const ::std::string& name, sp<IBinder>* _aidl_return) override; binder::Status checkService2(const ::std::string& name, os::Service* out) override; binder::Status addService(const ::std::string& name, const sp<IBinder>& service, bool allowIsolated, int32_t dumpPriority) override; binder::Status listServices(int32_t dumpPriority, Loading