The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2005 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Steven Moreland | c7a871e | 2020-11-10 21:56:57 +0000 | [diff] [blame] | 17 | #pragma once |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 18 | #include <binder/Common.h> |
Mathias Agopian | c5b2c0b | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 19 | #include <binder/IInterface.h> |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 20 | // Trusty has its own definition of socket APIs from trusty_ipc.h |
| 21 | #ifndef __TRUSTY__ |
| 22 | #include <sys/socket.h> |
| 23 | #endif // __TRUSTY__ |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | #include <utils/String16.h> |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 25 | #include <utils/Vector.h> |
Steven Moreland | edd4e07 | 2021-04-21 00:27:29 +0000 | [diff] [blame] | 26 | #include <optional> |
Devin Moore | c370db4 | 2024-08-09 23:18:05 +0000 | [diff] [blame] | 27 | #include <set> |
Steven Moreland | edd4e07 | 2021-04-21 00:27:29 +0000 | [diff] [blame] | 28 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | namespace android { |
| 30 | |
Steven Moreland | 583685e | 2019-10-02 16:45:11 -0700 | [diff] [blame] | 31 | /** |
| 32 | * Service manager for C++ services. |
| 33 | * |
| 34 | * IInterface is only for legacy ABI compatibility |
| 35 | */ |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 36 | class LIBBINDER_EXPORTED IServiceManager : public IInterface { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | public: |
Steven Moreland | 583685e | 2019-10-02 16:45:11 -0700 | [diff] [blame] | 38 | // for ABI compatibility |
| 39 | virtual const String16& getInterfaceDescriptor() const; |
| 40 | |
| 41 | IServiceManager(); |
| 42 | virtual ~IServiceManager(); |
| 43 | |
Vishnu Nair | 64afc02 | 2018-02-01 15:29:34 -0800 | [diff] [blame] | 44 | /** |
Steven Moreland | 635a291 | 2019-10-02 15:50:10 -0700 | [diff] [blame] | 45 | * Must match values in IServiceManager.aidl |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 46 | */ |
Vishnu Nair | 64afc02 | 2018-02-01 15:29:34 -0800 | [diff] [blame] | 47 | /* Allows services to dump sections according to priorities. */ |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 48 | static const int DUMP_FLAG_PRIORITY_CRITICAL = 1 << 0; |
| 49 | static const int DUMP_FLAG_PRIORITY_HIGH = 1 << 1; |
| 50 | static const int DUMP_FLAG_PRIORITY_NORMAL = 1 << 2; |
Vishnu Nair | 64afc02 | 2018-02-01 15:29:34 -0800 | [diff] [blame] | 51 | /** |
| 52 | * Services are by default registered with a DEFAULT dump priority. DEFAULT priority has the |
| 53 | * same priority as NORMAL priority but the services are not called with dump priority |
| 54 | * arguments. |
| 55 | */ |
| 56 | static const int DUMP_FLAG_PRIORITY_DEFAULT = 1 << 3; |
| 57 | static const int DUMP_FLAG_PRIORITY_ALL = DUMP_FLAG_PRIORITY_CRITICAL | |
| 58 | DUMP_FLAG_PRIORITY_HIGH | DUMP_FLAG_PRIORITY_NORMAL | DUMP_FLAG_PRIORITY_DEFAULT; |
| 59 | static const int DUMP_FLAG_PROTO = 1 << 4; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | |
| 61 | /** |
Steven Moreland | 658fc4f | 2022-03-09 00:30:07 +0000 | [diff] [blame] | 62 | * Retrieve an existing service, blocking for a few seconds if it doesn't yet exist. This |
| 63 | * does polling. A more efficient way to make sure you unblock as soon as the service is |
| 64 | * available is to use waitForService or to use service notifications. |
| 65 | * |
| 66 | * Warning: when using this API, typically, you should call it in a loop. It's dangerous to |
| 67 | * assume that nullptr could mean that the service is not available. The service could just |
| 68 | * be starting. Generally, whether a service exists, this information should be declared |
| 69 | * externally (for instance, an Android feature might imply the existence of a service, |
| 70 | * a system property, or in the case of services in the VINTF manifest, it can be checked |
| 71 | * with isDeclared). |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 72 | */ |
Steven Moreland | 800113e | 2022-12-09 01:32:26 +0000 | [diff] [blame] | 73 | [[deprecated("this polls for 5s, prefer waitForService or checkService")]] |
| 74 | virtual sp<IBinder> getService(const String16& name) const = 0; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Retrieve an existing service, non-blocking. |
| 78 | */ |
| 79 | virtual sp<IBinder> checkService( const String16& name) const = 0; |
| 80 | |
| 81 | /** |
| 82 | * Register a service. |
| 83 | */ |
Jiyong Park | b86c866 | 2018-10-29 23:01:57 +0900 | [diff] [blame] | 84 | // NOLINTNEXTLINE(google-default-arguments) |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 85 | virtual status_t addService(const String16& name, const sp<IBinder>& service, |
| 86 | bool allowIsolated = false, |
Vishnu Nair | 64afc02 | 2018-02-01 15:29:34 -0800 | [diff] [blame] | 87 | int dumpsysFlags = DUMP_FLAG_PRIORITY_DEFAULT) = 0; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Return list of all existing services. |
| 91 | */ |
Jiyong Park | b86c866 | 2018-10-29 23:01:57 +0900 | [diff] [blame] | 92 | // NOLINTNEXTLINE(google-default-arguments) |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 93 | virtual Vector<String16> listServices(int dumpsysFlags = DUMP_FLAG_PRIORITY_ALL) = 0; |
Steven Moreland | 1c47b58 | 2019-08-27 18:05:27 -0700 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Efficiently wait for a service. |
| 97 | * |
| 98 | * Returns nullptr only for permission problem or fatal error. |
| 99 | */ |
| 100 | virtual sp<IBinder> waitForService(const String16& name) = 0; |
Steven Moreland | b82b8f8 | 2019-10-28 10:52:34 -0700 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * Check if a service is declared (e.g. VINTF manifest). |
| 104 | * |
| 105 | * If this returns true, waitForService should always be able to return the |
| 106 | * service. |
| 107 | */ |
| 108 | virtual bool isDeclared(const String16& name) = 0; |
Steven Moreland | 2e293aa | 2020-09-23 00:25:16 +0000 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * Get all instances of a service as declared in the VINTF manifest |
| 112 | */ |
| 113 | virtual Vector<String16> getDeclaredInstances(const String16& interface) = 0; |
Steven Moreland | edd4e07 | 2021-04-21 00:27:29 +0000 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * If this instance is updatable via an APEX, returns the APEX with which |
| 117 | * this can be updated. |
| 118 | */ |
| 119 | virtual std::optional<String16> updatableViaApex(const String16& name) = 0; |
Devin Moore | 5e4c2f1 | 2021-09-09 22:36:33 +0000 | [diff] [blame] | 120 | |
| 121 | /** |
Jooyung Han | 76944fe | 2022-10-25 17:02:45 +0900 | [diff] [blame] | 122 | * Returns all instances which are updatable via the APEX. Instance names are fully qualified |
| 123 | * like `pack.age.IFoo/default`. |
| 124 | */ |
| 125 | virtual Vector<String16> getUpdatableNames(const String16& apexName) = 0; |
| 126 | |
| 127 | /** |
Devin Moore | 5e4c2f1 | 2021-09-09 22:36:33 +0000 | [diff] [blame] | 128 | * If this instance has declared remote connection information, returns |
| 129 | * the ConnectionInfo. |
| 130 | */ |
| 131 | struct ConnectionInfo { |
| 132 | std::string ipAddress; |
| 133 | unsigned int port; |
| 134 | }; |
| 135 | virtual std::optional<ConnectionInfo> getConnectionInfo(const String16& name) = 0; |
Jayant Chowdhary | 3070094 | 2022-01-31 14:12:40 -0800 | [diff] [blame] | 136 | |
| 137 | struct LocalRegistrationCallback : public virtual RefBase { |
| 138 | virtual void onServiceRegistration(const String16& instance, const sp<IBinder>& binder) = 0; |
| 139 | virtual ~LocalRegistrationCallback() {} |
| 140 | }; |
| 141 | |
| 142 | virtual status_t registerForNotifications(const String16& name, |
| 143 | const sp<LocalRegistrationCallback>& callback) = 0; |
| 144 | |
| 145 | virtual status_t unregisterForNotifications(const String16& name, |
| 146 | const sp<LocalRegistrationCallback>& callback) = 0; |
Jayant Chowdhary | a0a8eb2 | 2022-05-20 03:30:09 +0000 | [diff] [blame] | 147 | |
| 148 | struct ServiceDebugInfo { |
| 149 | std::string name; |
| 150 | int pid; |
| 151 | }; |
| 152 | virtual std::vector<ServiceDebugInfo> getServiceDebugInfo() = 0; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | }; |
| 154 | |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 155 | LIBBINDER_EXPORTED sp<IServiceManager> defaultServiceManager(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 156 | |
Brett Chabot | 38dbade | 2020-01-24 12:59:43 -0800 | [diff] [blame] | 157 | /** |
| 158 | * Directly set the default service manager. Only used for testing. |
Martijn Coenen | 402c867 | 2020-02-03 10:01:36 +0100 | [diff] [blame] | 159 | * Note that the caller is responsible for caling this method |
| 160 | * *before* any call to defaultServiceManager(); if the latter is |
| 161 | * called first, setDefaultServiceManager() will abort. |
Brett Chabot | 38dbade | 2020-01-24 12:59:43 -0800 | [diff] [blame] | 162 | */ |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 163 | LIBBINDER_EXPORTED void setDefaultServiceManager(const sp<IServiceManager>& sm); |
Brett Chabot | 38dbade | 2020-01-24 12:59:43 -0800 | [diff] [blame] | 164 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | template<typename INTERFACE> |
Steven Moreland | 1c47b58 | 2019-08-27 18:05:27 -0700 | [diff] [blame] | 166 | sp<INTERFACE> waitForService(const String16& name) { |
| 167 | const sp<IServiceManager> sm = defaultServiceManager(); |
| 168 | return interface_cast<INTERFACE>(sm->waitForService(name)); |
| 169 | } |
| 170 | |
| 171 | template<typename INTERFACE> |
Steven Moreland | b82b8f8 | 2019-10-28 10:52:34 -0700 | [diff] [blame] | 172 | sp<INTERFACE> waitForDeclaredService(const String16& name) { |
| 173 | const sp<IServiceManager> sm = defaultServiceManager(); |
| 174 | if (!sm->isDeclared(name)) return nullptr; |
| 175 | return interface_cast<INTERFACE>(sm->waitForService(name)); |
| 176 | } |
| 177 | |
Steven Moreland | f1b02a4 | 2019-11-05 16:14:20 -0800 | [diff] [blame] | 178 | template <typename INTERFACE> |
| 179 | sp<INTERFACE> checkDeclaredService(const String16& name) { |
| 180 | const sp<IServiceManager> sm = defaultServiceManager(); |
| 181 | if (!sm->isDeclared(name)) return nullptr; |
| 182 | return interface_cast<INTERFACE>(sm->checkService(name)); |
| 183 | } |
| 184 | |
Steven Moreland | b82b8f8 | 2019-10-28 10:52:34 -0700 | [diff] [blame] | 185 | template<typename INTERFACE> |
Steven Moreland | c73571f | 2019-10-31 09:48:58 -0700 | [diff] [blame] | 186 | sp<INTERFACE> waitForVintfService( |
| 187 | const String16& instance = String16("default")) { |
| 188 | return waitForDeclaredService<INTERFACE>( |
| 189 | INTERFACE::descriptor + String16("/") + instance); |
| 190 | } |
| 191 | |
| 192 | template<typename INTERFACE> |
Steven Moreland | f1b02a4 | 2019-11-05 16:14:20 -0800 | [diff] [blame] | 193 | sp<INTERFACE> checkVintfService( |
| 194 | const String16& instance = String16("default")) { |
| 195 | return checkDeclaredService<INTERFACE>( |
| 196 | INTERFACE::descriptor + String16("/") + instance); |
| 197 | } |
| 198 | |
| 199 | template<typename INTERFACE> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 200 | status_t getService(const String16& name, sp<INTERFACE>* outService) |
| 201 | { |
| 202 | const sp<IServiceManager> sm = defaultServiceManager(); |
Yi Kong | 0cf7584 | 2018-07-10 11:44:36 -0700 | [diff] [blame] | 203 | if (sm != nullptr) { |
Pawan Wagh | 838396f | 2023-01-10 01:25:34 +0000 | [diff] [blame] | 204 | #pragma clang diagnostic push |
| 205 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 206 | *outService = interface_cast<INTERFACE>(sm->getService(name)); |
Pawan Wagh | 838396f | 2023-01-10 01:25:34 +0000 | [diff] [blame] | 207 | #pragma clang diagnostic pop // getService deprecation |
Yi Kong | 0cf7584 | 2018-07-10 11:44:36 -0700 | [diff] [blame] | 208 | if ((*outService) != nullptr) return NO_ERROR; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 209 | } |
| 210 | return NAME_NOT_FOUND; |
| 211 | } |
| 212 | |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 213 | LIBBINDER_EXPORTED void* openDeclaredPassthroughHal(const String16& interface, |
| 214 | const String16& instance, int flag); |
Jooyung Han | 75fc06f | 2024-02-03 03:56:59 +0900 | [diff] [blame] | 215 | |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 216 | LIBBINDER_EXPORTED bool checkCallingPermission(const String16& permission); |
| 217 | LIBBINDER_EXPORTED bool checkCallingPermission(const String16& permission, int32_t* outPid, |
| 218 | int32_t* outUid); |
| 219 | LIBBINDER_EXPORTED bool checkPermission(const String16& permission, pid_t pid, uid_t uid, |
| 220 | bool logPermissionFailure = true); |
Mathias Agopian | 375f563 | 2009-06-15 18:24:59 -0700 | [diff] [blame] | 221 | |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 222 | // ---------------------------------------------------------------------- |
| 223 | // Trusty's definition of the socket APIs does not include sockaddr types |
| 224 | #ifndef __TRUSTY__ |
| 225 | typedef std::function<status_t(const String16& name, sockaddr* outAddr, socklen_t addrSize)> |
| 226 | RpcSocketAddressProvider; |
| 227 | |
Devin Moore | c370db4 | 2024-08-09 23:18:05 +0000 | [diff] [blame] | 228 | /** |
| 229 | * This callback provides a way for clients to get access to remote services by |
| 230 | * providing an Accessor object from libbinder that can connect to the remote |
| 231 | * service over sockets. |
| 232 | * |
| 233 | * \param instance name of the service that the callback will provide an |
| 234 | * Accessor for. The provided accessor will be used to set up a client |
| 235 | * RPC connection in libbinder in order to return a binder for the |
| 236 | * associated remote service. |
| 237 | * |
| 238 | * \return IBinder of the Accessor object that libbinder implements. |
| 239 | * nullptr if the provider callback doesn't know how to reach the |
| 240 | * service or doesn't want to provide access for any other reason. |
| 241 | */ |
| 242 | typedef std::function<sp<IBinder>(const String16& instance)> RpcAccessorProvider; |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 243 | |
| 244 | class AccessorProvider; |
| 245 | |
| 246 | /** |
Devin Moore | c370db4 | 2024-08-09 23:18:05 +0000 | [diff] [blame] | 247 | * Register a RpcAccessorProvider for the service manager APIs. |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 248 | * |
Devin Moore | c370db4 | 2024-08-09 23:18:05 +0000 | [diff] [blame] | 249 | * \param instances that the RpcAccessorProvider knows about and can provide an |
| 250 | * Accessor for. |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 251 | * \param provider callback that generates Accessors. |
| 252 | * |
| 253 | * \return A pointer used as a recept for the successful addition of the |
| 254 | * AccessorProvider. This is needed to unregister it later. |
| 255 | */ |
| 256 | [[nodiscard]] LIBBINDER_EXPORTED std::weak_ptr<AccessorProvider> addAccessorProvider( |
Devin Moore | c370db4 | 2024-08-09 23:18:05 +0000 | [diff] [blame] | 257 | std::set<std::string>&& instances, RpcAccessorProvider&& providerCallback); |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 258 | |
| 259 | /** |
| 260 | * Remove an accessor provider using the pointer provided by addAccessorProvider |
| 261 | * along with the cookie pointer that was used. |
| 262 | * |
| 263 | * \param provider cookie that was returned by addAccessorProvider to keep track |
| 264 | * of this instance. |
| 265 | */ |
| 266 | [[nodiscard]] LIBBINDER_EXPORTED status_t |
| 267 | removeAccessorProvider(std::weak_ptr<AccessorProvider> provider); |
| 268 | |
| 269 | /** |
| 270 | * Create an Accessor associated with a service that can create a socket connection based |
| 271 | * on the connection info from the supplied RpcSocketAddressProvider. |
| 272 | * |
| 273 | * \param instance name of the service that this Accessor is associated with |
| 274 | * \param connectionInfoProvider a callback that returns connection info for |
| 275 | * connecting to the service. |
| 276 | * \return the binder of the IAccessor implementation from libbinder |
| 277 | */ |
| 278 | LIBBINDER_EXPORTED sp<IBinder> createAccessor(const String16& instance, |
| 279 | RpcSocketAddressProvider&& connectionInfoProvider); |
| 280 | |
| 281 | /** |
| 282 | * Check to make sure this binder is the expected binder that is an IAccessor |
| 283 | * associated with a specific instance. |
| 284 | * |
| 285 | * This helper function exists to avoid adding the IAccessor type to |
| 286 | * libbinder_ndk. |
| 287 | * |
| 288 | * \param instance name of the service that this Accessor should be associated with |
| 289 | * \param binder to validate |
| 290 | * |
| 291 | * \return OK if the binder is an IAccessor for `instance` |
| 292 | */ |
| 293 | LIBBINDER_EXPORTED status_t validateAccessor(const String16& instance, const sp<IBinder>& binder); |
Devin Moore | 0555fbf | 2024-08-29 15:51:50 +0000 | [diff] [blame] | 294 | |
| 295 | /** |
| 296 | * Have libbinder wrap this IAccessor binder in an IAccessorDelegator and return |
| 297 | * it. |
| 298 | * |
| 299 | * This is required only in very specific situations when the process that has |
| 300 | * permissions to connect the to RPC service's socket and create the FD for it |
| 301 | * is in a separate process from this process that wants to service the Accessor |
| 302 | * binder and the communication between these two processes is binder RPC. This |
| 303 | * is needed because the binder passed over the binder RPC connection can not be |
| 304 | * used as a kernel binder, and needs to be wrapped by a kernel binder that can |
| 305 | * then be registered with service manager. |
| 306 | * |
| 307 | * \param instance name of the Accessor. |
| 308 | * \param binder to wrap in a Delegator and register with service manager. |
| 309 | * \param outDelegator the wrapped kernel binder for IAccessorDelegator |
| 310 | * |
| 311 | * \return OK if the binder is an IAccessor for `instance` and the delegator was |
| 312 | * successfully created. |
| 313 | */ |
| 314 | LIBBINDER_EXPORTED status_t delegateAccessor(const String16& name, const sp<IBinder>& accessor, |
| 315 | sp<IBinder>* delegator); |
Devin Moore | 18f6375 | 2024-08-08 21:01:24 +0000 | [diff] [blame] | 316 | #endif // __TRUSTY__ |
| 317 | |
Yifan Hong | f776001 | 2021-06-04 16:04:42 -0700 | [diff] [blame] | 318 | #ifndef __ANDROID__ |
| 319 | // Create an IServiceManager that delegates the service manager on the device via adb. |
| 320 | // This is can be set as the default service manager at program start, so that |
| 321 | // defaultServiceManager() returns it: |
| 322 | // int main() { |
| 323 | // setDefaultServiceManager(createRpcDelegateServiceManager()); |
| 324 | // auto sm = defaultServiceManager(); |
| 325 | // // ... |
| 326 | // } |
| 327 | // Resources are cleaned up when the object is destroyed. |
Yifan Hong | 5a05ef7 | 2021-10-08 17:33:47 -0700 | [diff] [blame] | 328 | // |
Steven Moreland | feb13e8 | 2023-03-01 01:25:33 +0000 | [diff] [blame] | 329 | // For each returned binder object, at most |maxOutgoingConnections| outgoing connections are |
| 330 | // instantiated, depending on how many the service on the device is configured with. |
| 331 | // Hence, only |maxOutgoingConnections| calls can be made simultaneously. |
| 332 | // See also RpcSession::setMaxOutgoingConnections. |
Yifan Hong | 5a05ef7 | 2021-10-08 17:33:47 -0700 | [diff] [blame] | 333 | struct RpcDelegateServiceManagerOptions { |
Steven Moreland | feb13e8 | 2023-03-01 01:25:33 +0000 | [diff] [blame] | 334 | std::optional<size_t> maxOutgoingConnections; |
Yifan Hong | 5a05ef7 | 2021-10-08 17:33:47 -0700 | [diff] [blame] | 335 | }; |
Frederick Mayle | f7b65d1 | 2024-05-14 16:55:14 -0700 | [diff] [blame] | 336 | LIBBINDER_EXPORTED sp<IServiceManager> createRpcDelegateServiceManager( |
Yifan Hong | 5a05ef7 | 2021-10-08 17:33:47 -0700 | [diff] [blame] | 337 | const RpcDelegateServiceManagerOptions& options); |
Yifan Hong | f776001 | 2021-06-04 16:04:42 -0700 | [diff] [blame] | 338 | #endif |
| 339 | |
Steven Moreland | 61ff849 | 2019-09-26 16:05:45 -0700 | [diff] [blame] | 340 | } // namespace android |