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

Commit 88860b02 authored by Steven Moreland's avatar Steven Moreland
Browse files

servicemanager: rely on auto unlinkToDeath

unlinkToDeath happens automatically when the last strong ref to a proxy
goes away (see 80d23935).

Bug: 136027762
Test: boot and check for log:
    "onLastStrongRef automatically unlinking death recipients"

Change-Id: Iec16013548d9bda24f6e96d5cf80c69071953cb0
parent 62561f76
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -98,18 +98,12 @@ Status ServiceManager::addService(const std::string& name, const sp<IBinder>& bi
        return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT);
    }

    // implicitly unlinked when the binder is removed
    if (OK != binder->linkToDeath(this)) {
        LOG(ERROR) << "Could not linkToDeath when adding " << name;
        return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
    }

    auto it = mNameToService.find(name);
    if (it != mNameToService.end()) {
        if (OK != it->second.binder->unlinkToDeath(this)) {
            LOG(WARNING) << "Could not unlinkToDeath when adding " << name;
        }
    }

    mNameToService[name] = Service {
        .binder = binder,
        .allowIsolated = allowIsolated,