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

Commit 765d2435 authored by Steven Moreland's avatar Steven Moreland Committed by Android (Google) Code Review
Browse files

Merge changes I187ae2ad,I8fbb2954 into main

* changes:
  libbinder: better BpBinder descriptor logs
  libbinder: include flags in large transaction logs
parents ab9189c8 58087cd4
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -411,8 +411,9 @@ status_t BBinder::transact(
    if (reply != nullptr) {
    if (reply != nullptr) {
        reply->setDataPosition(0);
        reply->setDataPosition(0);
        if (reply->dataSize() > binder::kLogTransactionsOverBytes) {
        if (reply->dataSize() > binder::kLogTransactionsOverBytes) {
            ALOGW("Large reply transaction of %zu bytes, interface descriptor %s, code %d",
            ALOGW("Large reply transaction of %zu bytes, interface descriptor %s, code %d, flags "
                  reply->dataSize(), String8(getInterfaceDescriptor()).c_str(), code);
                  "%d",
                  reply->dataSize(), String8(getInterfaceDescriptor()).c_str(), code, flags);
        }
        }
    }
    }


+17 −5
Original line number Original line 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 {
bool BpBinder::isDescriptorCached() const {
    RpcMutexUniqueLock _l(mLock);
    RpcMutexUniqueLock _l(mLock);
    return isDescriptorCachedLocked();
}

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


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


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


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


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


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


    mutable RpcMutex mLock;
    mutable RpcMutex mLock;
    volatile int32_t mAlive;
    volatile int32_t mAlive;