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

Commit 857cd25e authored by Steven Moreland's avatar Steven Moreland Committed by Gerrit Code Review
Browse files

Merge "libbinder: RPC node toString"

parents 4477824c 3fa3292d
Loading
Loading
Loading
Loading
+22 −17
Original line number Diff line number Diff line
@@ -258,7 +258,9 @@ void RpcState::clear() {
    mTerminated = true;
    for (auto& [address, node] : mNodeForAddress) {
        sp<IBinder> binder = node.binder.promote();
        LOG_ALWAYS_FATAL_IF(binder == nullptr, "Binder %p expected to be owned.", binder.get());
        LOG_ALWAYS_FATAL_IF(binder == nullptr,
                            "Binder expected to be owned with address: %" PRIu64 " %s", address,
                            node.toString().c_str());

        if (node.sentRef != nullptr) {
            tempHoldBinder.push_back(node.sentRef);
@@ -275,12 +277,18 @@ void RpcState::dumpLocked() {
    ALOGE("DUMP OF RpcState %p", this);
    ALOGE("DUMP OF RpcState (%zu nodes)", mNodeForAddress.size());
    for (const auto& [address, node] : mNodeForAddress) {
        sp<IBinder> binder = node.binder.promote();
        ALOGE("- address: %" PRIu64 " %s", address, node.toString().c_str());
    }
    ALOGE("END DUMP OF RpcState");
}

std::string RpcState::BinderNode::toString() const {
    sp<IBinder> strongBinder = this->binder.promote();

    const char* desc;
        if (binder) {
            if (binder->remoteBinder()) {
                if (binder->remoteBinder()->isRpcBinder()) {
    if (strongBinder) {
        if (strongBinder->remoteBinder()) {
            if (strongBinder->remoteBinder()->isRpcBinder()) {
                desc = "(rpc binder proxy)";
            } else {
                desc = "(binder proxy)";
@@ -289,16 +297,13 @@ void RpcState::dumpLocked() {
            desc = "(local binder)";
        }
    } else {
            desc = "(null)";
        desc = "(not promotable)";
    }

        ALOGE("- BINDER NODE: %p times sent:%zu times recd: %zu a: %" PRIu64 " type: %s",
              node.binder.unsafe_get(), node.timesSent, node.timesRecd, address, desc);
    }
    ALOGE("END DUMP OF RpcState");
    return StringPrintf("node{%p times sent: %zu times recd: %zu type: %s}",
                        this->binder.unsafe_get(), this->timesSent, this->timesRecd, desc);
}


RpcState::CommandData::CommandData(size_t size) : mSize(size) {
    // The maximum size for regular binder is 1MB for all concurrent
    // transactions. A very small proportion of transactions are even
+2 −0
Original line number Diff line number Diff line
@@ -258,6 +258,8 @@ private:
        //

        // (no additional data specific to remote binders)

        std::string toString() const;
    };

    // checks if there is any reference left to a node and erases it. If erase