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

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

Merge "libbinder: build Trusty files on Android" am: cb05b913 am: 6917437b...

Merge "libbinder: build Trusty files on Android" am: cb05b913 am: 6917437b am: 0504c545 am: 2449db95 am: 76beafd0

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



Change-Id: Ia67748b30951850ba5ffc300188422a7f6471c60
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5ecbb0d9 76beafd0
Loading
Loading
Loading
Loading
+83 −20
Original line number Diff line number Diff line
@@ -71,15 +71,9 @@ filegroup {
}

cc_defaults {
    name: "libbinder_defaults",
    name: "libbinder_common_defaults",
    host_supported: true,

    // TODO(b/31559095): get headers from bionic on host
    include_dirs: [
        "bionic/libc/kernel/android/uapi/",
        "bionic/libc/kernel/uapi/",
    ],

    srcs: [
        "Binder.cpp",
        "BpBinder.cpp",
@@ -87,19 +81,45 @@ cc_defaults {
        "FdTrigger.cpp",
        "IInterface.cpp",
        "IResultReceiver.cpp",
        "OS.cpp",
        "Parcel.cpp",
        "ParcelFileDescriptor.cpp",
        "RpcSession.cpp",
        "RpcServer.cpp",
        "RpcState.cpp",
        "RpcTransportRaw.cpp",
        "Stability.cpp",
        "Status.cpp",
        "TextOutput.cpp",
        "Utils.cpp",
    ],

    shared_libs: [
        "libcutils",
        "libutils",
    ],

    static_libs: [
        "libbase",
    ],

    header_libs: [
        "libbinder_headers",
    ],
}

cc_defaults {
    name: "libbinder_android_defaults",

    // TODO(b/31559095): get headers from bionic on host
    include_dirs: [
        "bionic/libc/kernel/android/uapi/",
        "bionic/libc/kernel/uapi/",
    ],

    srcs: [
        "OS.cpp",
        "RpcTransportRaw.cpp",
    ],

    target: {
        host: {
            srcs: [
@@ -133,16 +153,9 @@ cc_defaults {

    shared_libs: [
        "liblog",
        "libcutils",
        "libutils",
    ],

    static_libs: [
        "libbase",
    ],

    header_libs: [
        "libbinder_headers",
        "libandroid_runtime_vm_headers",
    ],

@@ -177,6 +190,48 @@ cc_defaults {
    ],
}

cc_library_shared {
    name: "libbinder_on_trusty_mock",
    defaults: ["libbinder_common_defaults"],

    srcs: [
        // Trusty-specific files
        "trusty/logging.cpp",
        "trusty/OS.cpp",
        "trusty/RpcServerTrusty.cpp",
        "trusty/RpcTransportTipcTrusty.cpp",
        "trusty/TrustyStatus.cpp",
        "trusty/socket.cpp",
    ],

    cflags: [
        "-DBINDER_RPC_SINGLE_THREADED",
        // Trusty libbinder uses vendor stability for its binders
        "-D__ANDROID_VNDK__",
        "-U__ANDROID__",
        "-D__TRUSTY__",
        "-DTRUSTY_USERSPACE",
        // Flags from the Trusty build system
        "-Werror",
        "-Wsign-compare",
        "-Wno-unused-function",
        "-Wno-unused-label",
        "-fno-common",
        "-fno-omit-frame-pointer",
        "-fno-threadsafe-statics",
    ],
    rtti: false,

    local_include_dirs: [
        "trusty/include",
        "trusty/include_mock",
    ],

    visibility: [
        ":__subpackages__",
    ],
}

cc_defaults {
    name: "libbinder_kernel_defaults",
    srcs: [
@@ -208,7 +263,8 @@ cc_defaults {
cc_library {
    name: "libbinder",
    defaults: [
        "libbinder_defaults",
        "libbinder_common_defaults",
        "libbinder_android_defaults",
        "libbinder_kernel_defaults",
    ],

@@ -264,7 +320,10 @@ cc_library {

cc_library_static {
    name: "libbinder_rpc_no_kernel",
    defaults: ["libbinder_defaults"],
    defaults: [
        "libbinder_common_defaults",
        "libbinder_android_defaults",
    ],
    visibility: [
        ":__subpackages__",
    ],
@@ -273,7 +332,8 @@ cc_library_static {
cc_library_static {
    name: "libbinder_rpc_single_threaded",
    defaults: [
        "libbinder_defaults",
        "libbinder_common_defaults",
        "libbinder_android_defaults",
        "libbinder_kernel_defaults",
    ],
    cflags: [
@@ -286,7 +346,10 @@ cc_library_static {

cc_library_static {
    name: "libbinder_rpc_single_threaded_no_kernel",
    defaults: ["libbinder_defaults"],
    defaults: [
        "libbinder_common_defaults",
        "libbinder_android_defaults",
    ],
    cflags: [
        "-DBINDER_RPC_SINGLE_THREADED",
    ],
+5 −0
Original line number Diff line number Diff line
@@ -341,6 +341,11 @@ cc_test {
        "binderRpcTest_shared_defaults",
        "libbinder_tls_shared_deps",
    ],

    // Add the Trusty mock library as a fake dependency so it gets built
    required: [
        "libbinder_on_trusty_mock",
    ],
}

cc_test {
+2 −2
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ using android::base::Result;

namespace android {

Result<void> setNonBlocking(android::base::borrowed_fd fd) {
Result<void> setNonBlocking(android::base::borrowed_fd /*fd*/) {
    // Trusty IPC syscalls are all non-blocking by default.
    return {};
}
@@ -43,7 +43,7 @@ status_t getRandomBytes(uint8_t* data, size_t size) {
#endif // TRUSTY_USERSPACE
}

status_t dupFileDescriptor(int oldFd, int* newFd) {
status_t dupFileDescriptor(int /*oldFd*/, int* /*newFd*/) {
    // TODO: implement separately
    return INVALID_OPERATION;
}
+3 −2
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ int RpcServerTrusty::handleConnect(const tipc_port* port, handle_t chan, const u
    return rc;
}

int RpcServerTrusty::handleMessage(const tipc_port* port, handle_t chan, void* ctx) {
int RpcServerTrusty::handleMessage(const tipc_port* /*port*/, handle_t /*chan*/, void* ctx) {
    auto* channelContext = reinterpret_cast<ChannelContext*>(ctx);
    LOG_ALWAYS_FATAL_IF(channelContext == nullptr,
                        "bad state: message received on uninitialized channel");
@@ -144,7 +144,8 @@ int RpcServerTrusty::handleMessage(const tipc_port* port, handle_t chan, void* c
    return NO_ERROR;
}

void RpcServerTrusty::handleDisconnect(const tipc_port* port, handle_t chan, void* ctx) {}
void RpcServerTrusty::handleDisconnect(const tipc_port* /*port*/, handle_t /*chan*/,
                                       void* /*ctx*/) {}

void RpcServerTrusty::handleChannelCleanup(void* ctx) {
    auto* channelContext = reinterpret_cast<ChannelContext*>(ctx);
+7 −6
Original line number Diff line number Diff line
@@ -45,9 +45,9 @@ public:
    }

    status_t interruptableWriteFully(
            FdTrigger* fdTrigger, iovec* iovs, int niovs,
            const std::optional<android::base::function_ref<status_t()>>& altPoll,
            const std::vector<std::variant<base::unique_fd, base::borrowed_fd>>* ancillaryFds)
            FdTrigger* /*fdTrigger*/, iovec* iovs, int niovs,
            const std::optional<android::base::function_ref<status_t()>>& /*altPoll*/,
            const std::vector<std::variant<base::unique_fd, base::borrowed_fd>>* /*ancillaryFds*/)
            override {
        if (niovs < 0) {
            return BAD_VALUE;
@@ -95,9 +95,10 @@ public:
    }

    status_t interruptableReadFully(
            FdTrigger* fdTrigger, iovec* iovs, int niovs,
            const std::optional<android::base::function_ref<status_t()>>& altPoll,
            std::vector<std::variant<base::unique_fd, base::borrowed_fd>>* ancillaryFds) override {
            FdTrigger* /*fdTrigger*/, iovec* iovs, int niovs,
            const std::optional<android::base::function_ref<status_t()>>& /*altPoll*/,
            std::vector<std::variant<base::unique_fd, base::borrowed_fd>>* /*ancillaryFds*/)
            override {
        if (niovs < 0) {
            return BAD_VALUE;
        }
Loading