Loading libs/binder/include/binder/IServiceManager.h +10 −2 Original line number Original line Diff line number Diff line Loading @@ -56,8 +56,16 @@ public: static const int DUMP_FLAG_PROTO = 1 << 4; static const int DUMP_FLAG_PROTO = 1 << 4; /** /** * Retrieve an existing service, blocking for a few seconds * Retrieve an existing service, blocking for a few seconds if it doesn't yet exist. This * if it doesn't yet exist. * does polling. A more efficient way to make sure you unblock as soon as the service is * available is to use waitForService or to use service notifications. * * Warning: when using this API, typically, you should call it in a loop. It's dangerous to * assume that nullptr could mean that the service is not available. The service could just * be starting. Generally, whether a service exists, this information should be declared * externally (for instance, an Android feature might imply the existence of a service, * a system property, or in the case of services in the VINTF manifest, it can be checked * with isDeclared). */ */ virtual sp<IBinder> getService( const String16& name) const = 0; virtual sp<IBinder> getService( const String16& name) const = 0; Loading libs/binder/ndk/include_platform/android/binder_manager.h +9 −1 Original line number Original line Diff line number Diff line Loading @@ -53,11 +53,19 @@ __attribute__((warn_unused_result)) AIBinder* AServiceManager_checkService(const /** /** * Gets a binder object with this specific instance name. Blocks for a couple of seconds waiting on * Gets a binder object with this specific instance name. Blocks for a couple of seconds waiting on * it. This also implicitly calls AIBinder_incStrong (so the caller of this function is responsible * it. This also implicitly calls AIBinder_incStrong (so the caller of this function is responsible * for calling AIBinder_decStrong). * for calling AIBinder_decStrong). This does polling. A more efficient way to make sure you * unblock as soon as the service is available is to use AIBinder_waitForService. * * * WARNING: when using this API across an APEX boundary, do not use with unstable * WARNING: when using this API across an APEX boundary, do not use with unstable * AIDL services. TODO(b/139325195) * AIDL services. TODO(b/139325195) * * * WARNING: when using this API, typically, you should call it in a loop. It's dangerous to * assume that nullptr could mean that the service is not available. The service could just * be starting. Generally, whether a service exists, this information should be declared * externally (for instance, an Android feature might imply the existence of a service, * a system property, or in the case of services in the VINTF manifest, it can be checked * with AServiceManager_isDeclared). * * \param instance identifier of the service used to lookup the service. * \param instance identifier of the service used to lookup the service. */ */ __attribute__((warn_unused_result)) AIBinder* AServiceManager_getService(const char* instance) __attribute__((warn_unused_result)) AIBinder* AServiceManager_getService(const char* instance) Loading Loading
libs/binder/include/binder/IServiceManager.h +10 −2 Original line number Original line Diff line number Diff line Loading @@ -56,8 +56,16 @@ public: static const int DUMP_FLAG_PROTO = 1 << 4; static const int DUMP_FLAG_PROTO = 1 << 4; /** /** * Retrieve an existing service, blocking for a few seconds * Retrieve an existing service, blocking for a few seconds if it doesn't yet exist. This * if it doesn't yet exist. * does polling. A more efficient way to make sure you unblock as soon as the service is * available is to use waitForService or to use service notifications. * * Warning: when using this API, typically, you should call it in a loop. It's dangerous to * assume that nullptr could mean that the service is not available. The service could just * be starting. Generally, whether a service exists, this information should be declared * externally (for instance, an Android feature might imply the existence of a service, * a system property, or in the case of services in the VINTF manifest, it can be checked * with isDeclared). */ */ virtual sp<IBinder> getService( const String16& name) const = 0; virtual sp<IBinder> getService( const String16& name) const = 0; Loading
libs/binder/ndk/include_platform/android/binder_manager.h +9 −1 Original line number Original line Diff line number Diff line Loading @@ -53,11 +53,19 @@ __attribute__((warn_unused_result)) AIBinder* AServiceManager_checkService(const /** /** * Gets a binder object with this specific instance name. Blocks for a couple of seconds waiting on * Gets a binder object with this specific instance name. Blocks for a couple of seconds waiting on * it. This also implicitly calls AIBinder_incStrong (so the caller of this function is responsible * it. This also implicitly calls AIBinder_incStrong (so the caller of this function is responsible * for calling AIBinder_decStrong). * for calling AIBinder_decStrong). This does polling. A more efficient way to make sure you * unblock as soon as the service is available is to use AIBinder_waitForService. * * * WARNING: when using this API across an APEX boundary, do not use with unstable * WARNING: when using this API across an APEX boundary, do not use with unstable * AIDL services. TODO(b/139325195) * AIDL services. TODO(b/139325195) * * * WARNING: when using this API, typically, you should call it in a loop. It's dangerous to * assume that nullptr could mean that the service is not available. The service could just * be starting. Generally, whether a service exists, this information should be declared * externally (for instance, an Android feature might imply the existence of a service, * a system property, or in the case of services in the VINTF manifest, it can be checked * with AServiceManager_isDeclared). * * \param instance identifier of the service used to lookup the service. * \param instance identifier of the service used to lookup the service. */ */ __attribute__((warn_unused_result)) AIBinder* AServiceManager_getService(const char* instance) __attribute__((warn_unused_result)) AIBinder* AServiceManager_getService(const char* instance) Loading