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

Commit 5d3b685a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Binder: migrate off libbase macros" into main am: 6da313b7

parents 3c6c8a3b 6da313b7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -21,10 +21,11 @@

#include <poll.h>

#include <android-base/macros.h>
#include <android-base/scopeguard.h>

#include "RpcState.h"
#include "Utils.h"

namespace android {

std::unique_ptr<FdTrigger> FdTrigger::make() {
@@ -77,7 +78,7 @@ status_t FdTrigger::triggerablePoll(const android::RpcTransportFd& transportFd,
    auto pollingStateGuard =
            android::base::make_scope_guard([&]() { transportFd.setPollingState(false); });

    int ret = TEMP_FAILURE_RETRY(poll(pfd, arraysize(pfd), -1));
    int ret = TEMP_FAILURE_RETRY(poll(pfd, countof(pfd), -1));
    if (ret < 0) {
        return -errno;
    }
+6 −5
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <binder/BpBinder.h>
#include <binder/TextOutput.h>

#include <android-base/macros.h>
#include <cutils/sched_policy.h>
#include <utils/CallStack.h>
#include <utils/Log.h>
@@ -395,7 +394,9 @@ void IPCThreadState::restoreGetCallingSpGuard(const SpGuard* guard) {
}

void IPCThreadState::checkContextIsBinderForUse(const char* use) const {
    if (LIKELY(mServingStackPointerGuard == nullptr)) return;
    if (mServingStackPointerGuard == nullptr) [[likely]] {
        return;
    }

    if (!mServingStackPointer || mServingStackPointerGuard->address < mServingStackPointer) {
        LOG_ALWAYS_FATAL("In context %s, %s does not make sense (binder sp: %p, guard: %p).",
@@ -832,7 +833,7 @@ status_t IPCThreadState::transact(int32_t handle,
    }

    if ((flags & TF_ONE_WAY) == 0) {
        if (UNLIKELY(mCallRestriction != ProcessState::CallRestriction::NONE)) {
        if (mCallRestriction != ProcessState::CallRestriction::NONE) [[unlikely]] {
            if (mCallRestriction == ProcessState::CallRestriction::ERROR_IF_NOT_ONEWAY) {
                ALOGE("Process making non-oneway call (code: %u) but is restricted.", code);
                CallStack::logStack("non-oneway call", CallStack::getCurrent(10).get(),
+3 −2
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@

#include <string_view>

#include <android-base/macros.h>
#include <android-base/scopeguard.h>
#include <binder/BpBinder.h>
#include <binder/Parcel.h>
@@ -411,7 +410,9 @@ public:
    }

private:
    DISALLOW_COPY_AND_ASSIGN(JavaThreadAttacher);
    JavaThreadAttacher(const JavaThreadAttacher&) = delete;
    void operator=(const JavaThreadAttacher&) = delete;

    bool mAttached = false;

    static JavaVM* getJavaVM() {
+4 −5
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@

#include "RpcState.h"

#include <android-base/macros.h>
#include <android-base/scopeguard.h>
#include <binder/BpBinder.h>
#include <binder/IPCThreadState.h>
@@ -601,7 +600,7 @@ status_t RpcState::transactAddress(const sp<RpcSession::RpcConnection>& connecti
            objectTableSpan.toIovec(),
    };
    if (status_t status = rpcSend(
                connection, session, "transaction", iovs, arraysize(iovs),
                connection, session, "transaction", iovs, countof(iovs),
                [&] {
                    if (waitUs > kWaitLogUs) {
                        ALOGE("Cannot send command, trying to process pending refcounts. Waiting "
@@ -690,7 +689,7 @@ status_t RpcState::waitForReply(const sp<RpcSession::RpcConnection>& connection,
            {&rpcReply, rpcReplyWireSize},
            {data.data(), data.size()},
    };
    if (status_t status = rpcRec(connection, session, "reply body", iovs, arraysize(iovs), nullptr);
    if (status_t status = rpcRec(connection, session, "reply body", iovs, countof(iovs), nullptr);
        status != OK)
        return status;

@@ -760,7 +759,7 @@ status_t RpcState::sendDecStrongToTarget(const sp<RpcSession::RpcConnection>& co
            .bodySize = sizeof(RpcDecStrong),
    };
    iovec iovs[]{{&cmd, sizeof(cmd)}, {&body, sizeof(body)}};
    return rpcSend(connection, session, "dec ref", iovs, arraysize(iovs), std::nullopt);
    return rpcSend(connection, session, "dec ref", iovs, countof(iovs), std::nullopt);
}

status_t RpcState::getAndExecuteCommand(const sp<RpcSession::RpcConnection>& connection,
@@ -1143,7 +1142,7 @@ processTransactInternalTailCall:
            {const_cast<uint8_t*>(reply.data()), reply.dataSize()},
            objectTableSpan.toIovec(),
    };
    return rpcSend(connection, session, "reply", iovs, arraysize(iovs), std::nullopt,
    return rpcSend(connection, session, "reply", iovs, countof(iovs), std::nullopt,
                   rpcFields->mFds.get());
}

+2 −1
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ public:
    [[nodiscard]] const std::optional<unsigned int>& hostPort() const { return mPort; }

private:
    DISALLOW_COPY_AND_ASSIGN(AdbForwarder);
    AdbForwarder(const AdbForwarder&) = delete;
    void operator=(const AdbForwarder&) = delete;
    explicit AdbForwarder(unsigned int port) : mPort(port) {}
    std::optional<unsigned int> mPort;
};
Loading