diff options
| author | 2023-12-07 00:08:19 +0000 | |
|---|---|---|
| committer | 2023-12-07 00:08:19 +0000 | |
| commit | 2ab80ddd6a68db7fd0900730bc866f168736ddfc (patch) | |
| tree | 7ec83f89c6973831bcafc624f015116706d2f17d | |
| parent | 43571dd2ef971a05272e3101928836517004fc85 (diff) | |
| parent | be685c0eb9290ca71aa8396e13e1bf396a64ce3f (diff) | |
Merge "Trusty: no need to use libbase, libutils nor libcutils" into main
| -rw-r--r-- | libs/binder/Android.bp | 3 | ||||
| -rw-r--r-- | libs/binder/tests/binderRpcTestServiceTrusty.cpp | 6 | ||||
| -rw-r--r-- | libs/binder/trusty/RpcServerTrusty.cpp | 12 | ||||
| -rw-r--r-- | libs/binder/trusty/include/binder/RpcServerTrusty.h | 3 | ||||
| -rw-r--r-- | libs/binder/trusty/kernel/rules.mk | 29 | ||||
| -rw-r--r-- | libs/binder/trusty/rules.mk | 29 |
6 files changed, 41 insertions, 41 deletions
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp index 654b62f8e5..90c9ff838d 100644 --- a/libs/binder/Android.bp +++ b/libs/binder/Android.bp @@ -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__", diff --git a/libs/binder/tests/binderRpcTestServiceTrusty.cpp b/libs/binder/tests/binderRpcTestServiceTrusty.cpp index aaca8d091a..8346b3691e 100644 --- a/libs/binder/tests/binderRpcTestServiceTrusty.cpp +++ b/libs/binder/tests/binderRpcTestServiceTrusty.cpp @@ -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; diff --git a/libs/binder/trusty/RpcServerTrusty.cpp b/libs/binder/trusty/RpcServerTrusty.cpp index 0872b9014c..1f857a0edb 100644 --- a/libs/binder/trusty/RpcServerTrusty.cpp +++ b/libs/binder/trusty/RpcServerTrusty.cpp @@ -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; } diff --git a/libs/binder/trusty/include/binder/RpcServerTrusty.h b/libs/binder/trusty/include/binder/RpcServerTrusty.h index 7382a303fe..f35d6c2252 100644 --- a/libs/binder/trusty/include/binder/RpcServerTrusty.h +++ b/libs/binder/trusty/include/binder/RpcServerTrusty.h @@ -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); diff --git a/libs/binder/trusty/kernel/rules.mk b/libs/binder/trusty/kernel/rules.mk index 65fe6f5829..2a13eadda3 100644 --- a/libs/binder/trusty/kernel/rules.mk +++ b/libs/binder/trusty/kernel/rules.mk @@ -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 += \ diff --git a/libs/binder/trusty/rules.mk b/libs/binder/trusty/rules.mk index b05464f28b..e2b386d710 100644 --- a/libs/binder/trusty/rules.mk +++ b/libs/binder/trusty/rules.mk @@ -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 := \ @@ -43,24 +43,20 @@ MODULE_SRCS := \ $(LIBBINDER_DIR)/Status.cpp \ $(LIBBINDER_DIR)/Utils.cpp \ $(LIBBINDER_DIR)/file.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_EXPORT_INCLUDES += \ $(LOCAL_DIR)/include \ $(LIBBINDER_DIR)/include \ $(LIBBASE_DIR)/include \ - $(LIBCUTILS_DIR)/include \ - $(LIBUTILS_DIR)/include \ + $(LIBUTILS_BINDER_DIR)/include \ $(FMTLIB_DIR)/include \ # The android/binder_to_string.h header is shared between libbinder and @@ -71,6 +67,9 @@ MODULE_EXPORT_INCLUDES += \ MODULE_EXPORT_COMPILEFLAGS += \ -DBINDER_RPC_SINGLE_THREADED \ -DBINDER_ENABLE_LIBLOG_ASSERT \ + -DBINDER_DISABLE_NATIVE_HANDLE \ + -DBINDER_DISABLE_BLOB \ + -DBINDER_NO_LIBBASE \ -D__ANDROID_VNDK__ \ # libbinder has some deprecated declarations that we want to produce warnings |