diff options
author | 2024-11-29 10:40:41 +0000 | |
---|---|---|
committer | 2024-12-03 17:46:33 +0000 | |
commit | 5e1b7e1b0a23a47ab76ed022284fd40b67ebe503 (patch) | |
tree | d3a7bb860c95427b32ea175c35ea235847925d94 /libs/binder/IServiceManager.cpp | |
parent | dc207544897a30fe412ffcc0deab07dd974358d1 (diff) |
Remove static list in libbinder for caching
This adds a new flag to identify Lazy services.
This flag is set when addService is called from
LazyServiceRegistrar.
This flag is then used by libbinder in a client.
When getService is called, libbinder decides if
the binder should be cached or not using this flag.
Doc: go/libbinder-cache-v2
Flag: RELEASE_LIBBINDER_REMOVE_STATIC_LIST
Test: atest binderCacheUnitTest
Bug: 333854840
Change-Id: I5fff0140f635dddb4f5a6d618f4e9abace6feb54
Diffstat (limited to 'libs/binder/IServiceManager.cpp')
-rw-r--r-- | libs/binder/IServiceManager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 61866d70d3..53435c357b 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -152,7 +152,8 @@ protected: virtual Status realGetService(const std::string& name, sp<IBinder>* _aidl_return) { Service service; Status status = mUnifiedServiceManager->getService2(name, &service); - *_aidl_return = service.get<Service::Tag::binder>(); + auto serviceWithMetadata = service.get<Service::Tag::serviceWithMetadata>(); + *_aidl_return = serviceWithMetadata.service; return status; } }; @@ -607,7 +608,7 @@ sp<IBinder> CppBackendShim::checkService(const String16& name) const { if (!mUnifiedServiceManager->checkService(String8(name).c_str(), &ret).isOk()) { return nullptr; } - return ret.get<Service::Tag::binder>(); + return ret.get<Service::Tag::serviceWithMetadata>().service; } status_t CppBackendShim::addService(const String16& name, const sp<IBinder>& service, |