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

Commit e3de832b authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by Automerger Merge Worker
Browse files

Merge "Trusty: no need to use libbase, libutils nor libcutils" into main am: 2ab80ddd

parents 7d658504 2ab80ddd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -223,6 +223,9 @@ cc_defaults {
    cflags: [
        "-DBINDER_RPC_SINGLE_THREADED",
        "-DBINDER_ENABLE_LIBLOG_ASSERT",
        "-DBINDER_DISABLE_NATIVE_HANDLE",
        "-DBINDER_DISABLE_BLOB",
        "-DBINDER_NO_LIBBASE",
        // Trusty libbinder uses vendor stability for its binders
        "-D__ANDROID_VNDK__",
        "-U__ANDROID__",
+2 −4
Original line number Diff line number Diff line
@@ -77,16 +77,14 @@ int main(void) {
        // Message size needs to be large enough to cover all messages sent by the
        // tests: SendAndGetResultBackBig sends two large strings.
        constexpr size_t max_msg_size = 4096;
        auto serverOrErr =
        auto server =
                RpcServerTrusty::make(hset, serverInfo.port->c_str(),
                                      std::shared_ptr<const RpcServerTrusty::PortAcl>(&port_acl),
                                      max_msg_size);
        if (!serverOrErr.ok()) {
            TLOGE("Failed to create RpcServer (%d)\n", serverOrErr.error());
        if (server == nullptr) {
            return EXIT_FAILURE;
        }

        auto server = std::move(*serverOrErr);
        serverInfo.server = server;
        if (!serverInfo.server->setProtocolVersion(serverVersion)) {
            return EXIT_FAILURE;
+7 −5
Original line number Diff line number Diff line
@@ -27,12 +27,11 @@
#include "../RpcState.h"
#include "TrustyStatus.h"

using android::base::unexpected;
using android::binder::unique_fd;

namespace android {

android::base::expected<sp<RpcServerTrusty>, int> RpcServerTrusty::make(
sp<RpcServerTrusty> RpcServerTrusty::make(
        tipc_hset* handleSet, std::string&& portName, std::shared_ptr<const PortAcl>&& portAcl,
        size_t msgMaxSize, std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory) {
    // Default is without TLS.
@@ -40,18 +39,21 @@ android::base::expected<sp<RpcServerTrusty>, int> RpcServerTrusty::make(
        rpcTransportCtxFactory = RpcTransportCtxFactoryTipcTrusty::make();
    auto ctx = rpcTransportCtxFactory->newServerCtx();
    if (ctx == nullptr) {
        return unexpected(ERR_NO_MEMORY);
        ALOGE("Failed to create RpcServerTrusty: can't create server context");
        return nullptr;
    }

    auto srv = sp<RpcServerTrusty>::make(std::move(ctx), std::move(portName), std::move(portAcl),
                                         msgMaxSize);
    if (srv == nullptr) {
        return unexpected(ERR_NO_MEMORY);
        ALOGE("Failed to create RpcServerTrusty: can't create server object");
        return nullptr;
    }

    int rc = tipc_add_service(handleSet, &srv->mTipcPort, 1, 0, &kTipcOps);
    if (rc != NO_ERROR) {
        return unexpected(rc);
        ALOGE("Failed to create RpcServerTrusty: can't add service: %d", rc);
        return nullptr;
    }
    return srv;
}
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

#pragma once

#include <android-base/expected.h>
#include <binder/IBinder.h>
#include <binder/RpcServer.h>
#include <binder/RpcSession.h>
@@ -53,7 +52,7 @@ public:
     * The caller is responsible for calling tipc_run_event_loop() to start
     * the TIPC event loop after creating one or more services here.
     */
    static android::base::expected<sp<RpcServerTrusty>, int> make(
    static sp<RpcServerTrusty> make(
            tipc_hset* handleSet, std::string&& portName, std::shared_ptr<const PortAcl>&& portAcl,
            size_t msgMaxSize,
            std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory = nullptr);
+14 −15
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)

LIBBINDER_DIR := frameworks/native/libs/binder
# TODO(b/302723053): remove libbase after aidl prebuilt gets updated to December release
LIBBASE_DIR := system/libbase
LIBCUTILS_DIR := system/core/libcutils
LIBUTILS_DIR := system/core/libutils
LIBUTILS_BINDER_DIR := system/core/libutils/binder
FMTLIB_DIR := external/fmtlib

MODULE_SRCS := \
@@ -35,17 +35,14 @@ MODULE_SRCS := \
	$(LIBBINDER_DIR)/Stability.cpp \
	$(LIBBINDER_DIR)/Status.cpp \
	$(LIBBINDER_DIR)/Utils.cpp \
	$(LIBBASE_DIR)/hex.cpp \
	$(LIBBASE_DIR)/stringprintf.cpp \
	$(LIBUTILS_DIR)/binder/Errors.cpp \
	$(LIBUTILS_DIR)/binder/RefBase.cpp \
	$(LIBUTILS_DIR)/binder/SharedBuffer.cpp \
	$(LIBUTILS_DIR)/binder/String16.cpp \
	$(LIBUTILS_DIR)/binder/String8.cpp \
	$(LIBUTILS_DIR)/binder/StrongPointer.cpp \
	$(LIBUTILS_DIR)/binder/Unicode.cpp \
	$(LIBUTILS_DIR)/binder/VectorImpl.cpp \
	$(LIBUTILS_DIR)/misc.cpp \
	$(LIBUTILS_BINDER_DIR)/Errors.cpp \
	$(LIBUTILS_BINDER_DIR)/RefBase.cpp \
	$(LIBUTILS_BINDER_DIR)/SharedBuffer.cpp \
	$(LIBUTILS_BINDER_DIR)/String16.cpp \
	$(LIBUTILS_BINDER_DIR)/String8.cpp \
	$(LIBUTILS_BINDER_DIR)/StrongPointer.cpp \
	$(LIBUTILS_BINDER_DIR)/Unicode.cpp \
	$(LIBUTILS_BINDER_DIR)/VectorImpl.cpp \

MODULE_DEFINES += \
	LK_DEBUGLEVEL_NO_ALIASES=1 \
@@ -59,8 +56,7 @@ GLOBAL_INCLUDES += \
	$(LIBBINDER_DIR)/include \
	$(LIBBINDER_DIR)/ndk/include_cpp \
	$(LIBBASE_DIR)/include \
	$(LIBCUTILS_DIR)/include \
	$(LIBUTILS_DIR)/include \
	$(LIBUTILS_BINDER_DIR)/include \
	$(FMTLIB_DIR)/include \

GLOBAL_COMPILEFLAGS += \
@@ -68,6 +64,9 @@ GLOBAL_COMPILEFLAGS += \
	-DBINDER_NO_KERNEL_IPC \
	-DBINDER_RPC_SINGLE_THREADED \
	-DBINDER_ENABLE_LIBLOG_ASSERT \
	-DBINDER_DISABLE_NATIVE_HANDLE \
	-DBINDER_DISABLE_BLOB \
	-DBINDER_NO_LIBBASE \
	-D__ANDROID_VNDK__ \

MODULE_DEPS += \
Loading