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

Commit 105d942b authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder: LazyServiceRegistrar log w/ error codes" am: c9fb9f92

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1701568

Change-Id: Ifabeba2086583da575d22fd9edb8e78e4aeccc9a
parents cd416f36 c9fb9f92
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -123,16 +123,20 @@ bool ClientCounterCallbackImpl::registerService(const sp<IBinder>& service, cons
    std::string regStr = (reRegister) ? "Re-registering" : "Registering";
    ALOGI("%s service %s", regStr.c_str(), name.c_str());

    if (!manager->addService(name.c_str(), service, allowIsolated, dumpFlags).isOk()) {
        ALOGE("Failed to register service %s", name.c_str());
    if (Status status = manager->addService(name.c_str(), service, allowIsolated, dumpFlags);
        !status.isOk()) {
        ALOGE("Failed to register service %s (%s)", name.c_str(), status.toString8().c_str());
        return false;
    }

    if (!reRegister) {
        if (!manager->registerClientCallback(name, service,
                                             sp<android::os::IClientCallback>::fromExisting(this))
                     .isOk()) {
            ALOGE("Failed to add client callback for service %s", name.c_str());
        if (Status status =
                    manager->registerClientCallback(name, service,
                                                    sp<android::os::IClientCallback>::fromExisting(
                                                            this));
            !status.isOk()) {
            ALOGE("Failed to add client callback for service %s (%s)", name.c_str(),
                  status.toString8().c_str());
            return false;
        }

@@ -171,10 +175,10 @@ bool ClientCounterCallbackImpl::tryUnregister() {
    auto manager = interface_cast<AidlServiceManager>(asBinder(defaultServiceManager()));

    for (auto& [name, entry] : mRegisteredServices) {
        bool success = manager->tryUnregisterService(name, entry.service).isOk();
        Status status = manager->tryUnregisterService(name, entry.service);

        if (!success) {
            ALOGI("Failed to unregister service %s", name.c_str());
        if (!status.isOk()) {
            ALOGI("Failed to unregister service %s (%s)", name.c_str(), status.toString8().c_str());
            return false;
        }
        entry.registered = false;