diff options
author | 2024-05-03 09:01:56 +0000 | |
---|---|---|
committer | 2024-07-19 16:49:07 +0000 | |
commit | 8578f13447d10824b9c29b0130f2096bb9401575 (patch) | |
tree | 5ed7ad2ec0f211c4a46e9be8b5d6250715caa4ae /libs/binder/IServiceManager.cpp | |
parent | 454e2fef1f5756553128a2c573d34eac9a1815e7 (diff) |
Support IAccessor in libbinder for RPC services
This cl sets up preconnected RPC binder for services launched with
IAccessor as a proxy.
Bug: 338541373
Test: m
Test: atest vm_accessor_test
Change-Id: Ic54732980778bc9ba8fec3395a0e98d336fea440
Diffstat (limited to 'libs/binder/IServiceManager.cpp')
-rw-r--r-- | libs/binder/IServiceManager.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 17e522d921..12a18f2a69 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -26,6 +26,7 @@ #include <android-base/properties.h> #include <android/os/BnServiceCallback.h> +#include <android/os/IAccessor.h> #include <android/os/IServiceManager.h> #include <binder/IPCThreadState.h> #include <binder/Parcel.h> @@ -57,6 +58,8 @@ using AidlRegistrationCallback = IServiceManager::LocalRegistrationCallback; using AidlServiceManager = android::os::IServiceManager; using android::binder::Status; +using android::os::IAccessor; +using android::os::Service; // libbinder's IServiceManager.h can't rely on the values generated by AIDL // because many places use its headers via include_dirs (meaning, without @@ -139,7 +142,10 @@ protected: // When implementing ServiceManagerShim, use realGetService instead of // mUnifiedServiceManager->getService so that it can be overridden in ServiceManagerHostShim. virtual Status realGetService(const std::string& name, sp<IBinder>* _aidl_return) { - return mUnifiedServiceManager->getService(name, _aidl_return); + Service service; + Status status = mUnifiedServiceManager->getService(name, &service); + *_aidl_return = service.get<Service::Tag::binder>(); + return status; } }; @@ -327,11 +333,11 @@ sp<IBinder> ServiceManagerShim::getService(const String16& name) const sp<IBinder> ServiceManagerShim::checkService(const String16& name) const { - sp<IBinder> ret; + Service ret; if (!mUnifiedServiceManager->checkService(String8(name).c_str(), &ret).isOk()) { return nullptr; } - return ret; + return ret.get<Service::Tag::binder>(); } status_t ServiceManagerShim::addService(const String16& name, const sp<IBinder>& service, |