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

Commit 89acde19 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder: RPC more nodiscard w/ fix" am: 5f414cf3 am: 0f702b52 am:...

Merge "libbinder: RPC more nodiscard w/ fix" am: 5f414cf3 am: 0f702b52 am: e4a5d768 am: 95237b85

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1870033

Change-Id: Ibea9432d647ea175a7b9f81c44a9190626c40289
parents 6ad4b43e 95237b85
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -688,6 +688,7 @@ status_t RpcSession::addOutgoingConnection(std::unique_ptr<RpcTransport> rpcTran

    status_t status = OK;
    if (init) {
        status =
                mRpcBinderState->sendConnectionInit(connection, sp<RpcSession>::fromExisting(this));
    }

+11 −10
Original line number Diff line number Diff line
@@ -60,20 +60,21 @@ public:
    RpcState();
    ~RpcState();

    status_t readNewSessionResponse(const sp<RpcSession::RpcConnection>& connection,
    [[nodiscard]] status_t readNewSessionResponse(const sp<RpcSession::RpcConnection>& connection,
                                                  const sp<RpcSession>& session, uint32_t* version);
    status_t sendConnectionInit(const sp<RpcSession::RpcConnection>& connection,
    [[nodiscard]] status_t sendConnectionInit(const sp<RpcSession::RpcConnection>& connection,
                                              const sp<RpcSession>& session);
    status_t readConnectionInit(const sp<RpcSession::RpcConnection>& connection,
    [[nodiscard]] status_t readConnectionInit(const sp<RpcSession::RpcConnection>& connection,
                                              const sp<RpcSession>& session);

    // TODO(b/182940634): combine some special transactions into one "getServerInfo" call?
    sp<IBinder> getRootObject(const sp<RpcSession::RpcConnection>& connection,
                              const sp<RpcSession>& session);
    status_t getMaxThreads(const sp<RpcSession::RpcConnection>& connection,
    [[nodiscard]] status_t getMaxThreads(const sp<RpcSession::RpcConnection>& connection,
                                         const sp<RpcSession>& session, size_t* maxThreadsOut);
    status_t getSessionId(const sp<RpcSession::RpcConnection>& connection,
                          const sp<RpcSession>& session, std::vector<uint8_t>* sessionIdOut);
    [[nodiscard]] status_t getSessionId(const sp<RpcSession::RpcConnection>& connection,
                                        const sp<RpcSession>& session,
                                        std::vector<uint8_t>* sessionIdOut);

    [[nodiscard]] status_t transact(const sp<RpcSession::RpcConnection>& connection,
                                    const sp<IBinder>& address, uint32_t code, const Parcel& data,
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ private:

    static void establishConnection(sp<RpcServer>&& server, base::unique_fd clientFd,
                                    const sockaddr_storage addr, socklen_t addrLen);
    status_t setupSocketServer(const RpcSocketAddress& address);
    [[nodiscard]] status_t setupSocketServer(const RpcSocketAddress& address);

    const std::unique_ptr<RpcTransportCtx> mCtx;
    size_t mMaxThreads = 1;
+5 −5
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public:
     * Query the other side of the session for the maximum number of threads
     * it supports (maximum number of concurrent non-nested synchronous transactions)
     */
    status_t getRemoteMaxThreads(size_t* maxThreads);
    [[nodiscard]] status_t getRemoteMaxThreads(size_t* maxThreads);

    /**
     * See RpcTransportCtx::getCertificate
@@ -216,7 +216,7 @@ private:
        bool allowNested = false;
    };

    status_t readId();
    [[nodiscard]] status_t readId();

    // A thread joining a server must always call these functions in order, and
    // cleanup is only programmed once into join. These are in separate
@@ -258,7 +258,7 @@ private:
            std::unique_ptr<RpcTransport> rpcTransport);
    [[nodiscard]] bool removeIncomingConnection(const sp<RpcConnection>& connection);

    status_t initShutdownTrigger();
    [[nodiscard]] status_t initShutdownTrigger();

    enum class ConnectionUse {
        CLIENT,
@@ -269,7 +269,7 @@ private:
    // Object representing exclusive access to a connection.
    class ExclusiveConnection {
    public:
        static status_t find(const sp<RpcSession>& session, ConnectionUse use,
        [[nodiscard]] static status_t find(const sp<RpcSession>& session, ConnectionUse use,
                                           ExclusiveConnection* connection);

        ~ExclusiveConnection();
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public:
    // - SSL_CTX_use_certificate
    // - SSL_CTX_set*_chain
    // - SSL_CTX_add0_chain_cert
    virtual status_t configure(SSL_CTX* ctx) = 0;
    [[nodiscard]] virtual status_t configure(SSL_CTX* ctx) = 0;
};

} // namespace android