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

Commit 58087cd4 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: better BpBinder descriptor logs

Distinguish between uncached and empty-string.

Bugs: me
Test: N/A
Flags: EXEMPT .
Change-Id: I187ae2adfadd49a4f49504aed28a376d720b863c
parent ede80828
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -292,8 +292,20 @@ std::optional<int32_t> BpBinder::getDebugBinderHandle() const {
    }
}

// Macro makes this simpler to call, since we need to allocate, and
// we return something with a temporary lifetime.
//
// If you are missing an interface descriptor, try adding:
//   'if (getpid() > 500) getInterfaceDescriptor();' in onFirstRef
#define BPBINDER_BEST_DESCRIPTOR_LOCKED \
    (isDescriptorCachedLocked() ? String8(mDescriptorCache).c_str() : "(not cached)")

bool BpBinder::isDescriptorCached() const {
    RpcMutexUniqueLock _l(mLock);
    return isDescriptorCachedLocked();
}

bool BpBinder::isDescriptorCachedLocked() const {
    return mDescriptorCache.c_str() != kDescriptorUninit.c_str();
}

@@ -404,9 +416,9 @@ status_t BpBinder::transact(

        if (data.dataSize() > binder::kLogTransactionsOverBytes) {
            RpcMutexUniqueLock _l(mLock);
            ALOGW("Large outgoing transaction of %zu bytes, interface descriptor %s, code %d, "
            ALOGW("Large outgoing transaction of %zu bytes, interface descriptor '%s', code %d, "
                  "flags %d was sent",
                  data.dataSize(), String8(mDescriptorCache).c_str(), code, flags);
                  data.dataSize(), BPBINDER_BEST_DESCRIPTOR_LOCKED, code, flags);
        }

        if (status == DEAD_OBJECT) mAlive = 0;
@@ -802,8 +814,8 @@ void BpBinder::onLastStrongRef(const void* /*id*/) {
    Vector<Obituary>* obits = mObituaries;
    if(obits != nullptr) {
        if (!obits->isEmpty()) {
            ALOGI("onLastStrongRef automatically unlinking death recipients: %s",
                  String8(mDescriptorCache).c_str());
            ALOGI("onLastStrongRef automatically unlinking death recipients for descriptor: '%s'",
                  BPBINDER_BEST_DESCRIPTOR_LOCKED);
        }

        if (ipc) ipc->clearDeathNotification(binderHandle(), this);
+1 −0
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ private:

    void reportOneDeath(const Obituary& obit);
    bool isDescriptorCached() const;
    bool isDescriptorCachedLocked() const;

    mutable RpcMutex mLock;
    volatile int32_t mAlive;