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

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

Merge "libbinder: add makeDefaultRpcTransportCtxFactory" am: 3966e43e am:...

Merge "libbinder: add makeDefaultRpcTransportCtxFactory" am: 3966e43e am: ab41025a am: 8aafbe09 am: e0d4ae4f

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



Change-Id: I27cfa8896e3e304d594d18d346f9c9e60c60da5f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 29beb2d7 e0d4ae4f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "OS.h"

#include <android-base/file.h>
#include <binder/RpcTransportRaw.h>
#include <string.h>

using android::base::ErrnoError;
@@ -58,4 +59,8 @@ status_t dupFileDescriptor(int oldFd, int* newFd) {
    return OK;
}

std::unique_ptr<RpcTransportCtxFactory> makeDefaultRpcTransportCtxFactory() {
    return RpcTransportCtxFactoryRaw::make();
}

} // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <android-base/result.h>
#include <android-base/unique_fd.h>
#include <binder/RpcTransport.h>
#include <utils/Errors.h>

namespace android {
@@ -30,4 +31,6 @@ status_t getRandomBytes(uint8_t* data, size_t size);

status_t dupFileDescriptor(int oldFd, int* newFd);

std::unique_ptr<RpcTransportCtxFactory> makeDefaultRpcTransportCtxFactory();

} // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ RpcServer::~RpcServer() {
sp<RpcServer> RpcServer::make(std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory) {
    // Default is without TLS.
    if (rpcTransportCtxFactory == nullptr)
        rpcTransportCtxFactory = RpcTransportCtxFactoryRaw::make();
        rpcTransportCtxFactory = makeDefaultRpcTransportCtxFactory();
    auto ctx = rpcTransportCtxFactory->newServerCtx();
    if (ctx == nullptr) return nullptr;
    return sp<RpcServer>::make(std::move(ctx));
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ RpcSession::~RpcSession() {

sp<RpcSession> RpcSession::make() {
    // Default is without TLS.
    return make(RpcTransportCtxFactoryRaw::make());
    return make(makeDefaultRpcTransportCtxFactory());
}

sp<RpcSession> RpcSession::make(std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory) {
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <lib/rand/rand.h>
#endif

#include <binder/RpcTransportTipcTrusty.h>

#include "../OS.h"

using android::base::Result;
@@ -46,4 +48,8 @@ status_t dupFileDescriptor(int oldFd, int* newFd) {
    return INVALID_OPERATION;
}

std::unique_ptr<RpcTransportCtxFactory> makeDefaultRpcTransportCtxFactory() {
    return RpcTransportCtxFactoryTipcTrusty::make();
}

} // namespace android