Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c58f5a3 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "Add addService to pass in allowIsolated flag." am: a7c3d183

parents 48f1ae04 a7c3d183
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -37,6 +37,22 @@ __BEGIN_DECLS
__attribute__((warn_unused_result)) binder_exception_t AServiceManager_addService(
__attribute__((warn_unused_result)) binder_exception_t AServiceManager_addService(
        AIBinder* binder, const char* instance) __INTRODUCED_IN(29);
        AIBinder* binder, const char* instance) __INTRODUCED_IN(29);


/**
 * This registers the service with the default service manager under this instance name. This does
 * not take ownership of binder.
 *
 * WARNING: when using this API across an APEX boundary, do not use with unstable
 * AIDL services. TODO(b/139325195)
 *
 * \param binder object to register globally with the service manager.
 * \param instance identifier of the service. This will be used to lookup the service.
 * \param allowIsolated allows if this service can be isolated.
 *
 * \return EX_NONE on success.
 */
__attribute__((warn_unused_result)) binder_exception_t AServiceManager_addServiceWithAllowIsolated(
        AIBinder* binder, const char* instance, bool allowIsolated) __INTRODUCED_IN(34);

/**
/**
 * Gets a binder object with this specific instance name. Will return nullptr immediately if the
 * Gets a binder object with this specific instance name. Will return nullptr immediately if the
 * service is not available This also implicitly calls AIBinder_incStrong (so the caller of this
 * service is not available This also implicitly calls AIBinder_incStrong (so the caller of this
+1 −0
Original line number Original line Diff line number Diff line
@@ -163,6 +163,7 @@ LIBBINDER_NDK34 { # introduced=UpsideDownCake
LIBBINDER_NDK_PLATFORM {
LIBBINDER_NDK_PLATFORM {
  global:
  global:
    AParcel_getAllowFds;
    AParcel_getAllowFds;
    AServiceManager_addServiceWithAllowIsolated;
    extern "C++" {
    extern "C++" {
        AIBinder_fromPlatformBinder*;
        AIBinder_fromPlatformBinder*;
        AIBinder_toPlatformBinder*;
        AIBinder_toPlatformBinder*;
+13 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,19 @@ binder_exception_t AServiceManager_addService(AIBinder* binder, const char* inst
    status_t exception = sm->addService(String16(instance), binder->getBinder());
    status_t exception = sm->addService(String16(instance), binder->getBinder());
    return PruneException(exception);
    return PruneException(exception);
}
}

binder_exception_t AServiceManager_addServiceWithAllowIsolated(AIBinder* binder,
                                                               const char* instance,
                                                               bool allowIsolated) {
    if (binder == nullptr || instance == nullptr) {
        return EX_ILLEGAL_ARGUMENT;
    }

    sp<IServiceManager> sm = defaultServiceManager();
    status_t exception = sm->addService(String16(instance), binder->getBinder(), allowIsolated);
    return PruneException(exception);
}

AIBinder* AServiceManager_checkService(const char* instance) {
AIBinder* AServiceManager_checkService(const char* instance) {
    if (instance == nullptr) {
    if (instance == nullptr) {
        return nullptr;
        return nullptr;