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

Commit 3db22269 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "minadbd_static_libadbd" into rvc-dev

* changes:
  Statically link libadbd into minadbd.
  adb: temporarily kill adb_benchmark.
  Move adbd's legacy USB implementation to fastboot.
parents ab4a2621 36fb6756
Loading
Loading
Loading
Loading
+60 −84
Original line number Diff line number Diff line
@@ -114,6 +114,44 @@ cc_defaults {
    },
}

cc_defaults {
    name: "libadbd_binary_dependencies",
    static_libs: [
        "libadb_crypto",
        "libadb_pairing_connection",
        "libadb_tls_connection",
        "libadbd",
        "libadbd_core",
        "libadbconnection_server",
        "libasyncio",
        "libbrotli",
        "libcutils_sockets",
        "libdiagnose_usb",
        "libmdnssd",
        "libbase",

        "libadb_protos",
    ],

    shared_libs: [
        "libadbd_auth",
        "libadbd_fs",
        "libcrypto",
        "libcrypto_utils",
        "liblog",
        "libselinux",
    ],

    target: {
        recovery: {
            exclude_static_libs: [
                "libadb_pairing_auth",
                "libadb_pairing_connection",
            ],
        },
    },
}

// libadb
// =========================================================
// These files are compiled for both the host and the device.
@@ -133,7 +171,6 @@ libadb_srcs = [
    "transport.cpp",
    "transport_fd.cpp",
    "transport_local.cpp",
    "transport_usb.cpp",
    "types.cpp",
]

@@ -169,6 +206,7 @@ cc_library_host_static {
        "client/usb_libusb.cpp",
        "client/usb_dispatch.cpp",
        "client/transport_mdns.cpp",
        "client/transport_usb.cpp",
        "client/pairing/pairing_client.cpp",
    ],

@@ -246,39 +284,6 @@ cc_test_host {
    },
}

cc_benchmark {
    name: "adb_benchmark",
    defaults: ["adb_defaults"],

    srcs: ["transport_benchmark.cpp"],
    target: {
        android: {
            static_libs: [
                "libadbd",
            ],
        },
        host: {
            static_libs: [
                "libadb_host",
            ],
        },
    },

    static_libs: [
        "libadb_crypto_static",
        "libadb_tls_connection_static",
        "libadbd_auth",
        "libbase",
        "libcutils",
        "libcrypto_utils",
        "libcrypto_static",
        "libdiagnose_usb",
        "liblog",
        "libssl",
        "libusb",
    ],
}

cc_binary_host {
    name: "adb",

@@ -381,10 +386,6 @@ cc_library_static {
        "daemon/adb_wifi.cpp",
    ],

    local_include_dirs: [
        "daemon/include",
    ],

    generated_headers: ["platform_tools_version"],

    static_libs: [
@@ -402,6 +403,7 @@ cc_library_static {
        "libbase",
        "libcrypto",
        "libcrypto_utils",
        "libcutils_sockets",
        "liblog",
    ],

@@ -414,12 +416,6 @@ cc_library_static {
                "daemon/transport_qemu.cpp",
                "daemon/usb.cpp",
                "daemon/usb_ffs.cpp",
                "daemon/usb_legacy.cpp",
            ]
        },
        linux_glibc: {
            srcs: [
                "daemon/usb_dummy.cpp",
            ]
        },
        recovery: {
@@ -461,13 +457,15 @@ cc_library {
        "libadb_pairing_connection",
        "libadb_protos",
        "libadb_tls_connection",
        "libadbd_auth",
        "libadbd_fs",
        "libasyncio",
        "libbase",
        "libcrypto",
        "libcrypto_utils",
        "libcutils_sockets",

        // APEX dependencies.
        "libadbd_auth",
        "libadbd_fs",
        "libcrypto",
        "liblog",
    ],

@@ -507,25 +505,21 @@ cc_library {
    // libminadbd wants both, as it's used to build native tests.
    compile_multilib: "both",

    // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
    whole_static_libs: [
        "libadbconnection_server",
        "libadbd_core",
    ],

    shared_libs: [
        "libadb_crypto",
        "libadb_pairing_connection",
        "libadb_tls_connection",
        "libadbd_auth",
        "libadbd_fs",
        "libadbd_services",
        "libasyncio",
        "libbase",
        "libcrypto",
        "libcrypto_utils",
        "liblog",
        "libselinux",

        // APEX dependencies on the system image.
        "libadbd_auth",
        "libadbd_fs",
        "libadbd_services",
    ],

    target: {
@@ -538,20 +532,22 @@ cc_library {
    },

    static_libs: [
        "libadbd_core",
        "libbrotli",
        "libcutils_sockets",
        "libdiagnose_usb",
        "libmdnssd",
    ],

    export_include_dirs: [
        "daemon/include",
    visibility: [
        "//bootable/recovery/minadbd",
        "//system/core/adb",
    ],
}

cc_binary {
    name: "adbd",
    defaults: ["adbd_defaults", "host_adbd_supported"],
    defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
    stl: "libc++_static",
    recovery_available: true,

@@ -569,31 +565,17 @@ cc_binary {
    },

    static_libs: [
        "libadb_crypto",
        "libadb_tls_connection",
        "libadbconnection_server",
        "libadbd",
        "libadbd_services",
        "libasyncio",
        "libbase",
        "libbrotli",
        "libcap",
        "libcrypto_utils",
        "libcutils_sockets",
        "libdiagnose_usb",
        "libmdnssd",
        "libminijail",
        "libssl",
    ],

    shared_libs: [
        "libadb_pairing_connection",
        "libadb_protos",
        "libadbd_auth",
        "libadbd_fs",
        "libcrypto",
        "liblog",
        "libselinux",
    ],

    target: {
@@ -665,8 +647,7 @@ cc_binary {
cc_test {
    name: "adbd_test",

    defaults: ["adbd_defaults"],
    stl: "libc++_static",
    defaults: ["adbd_defaults", "libadbd_binary_dependencies"],

    recovery_available: false,
    srcs: libadb_test_srcs + [
@@ -677,21 +658,16 @@ cc_test {
        "shell_service_protocol_test.cpp",
    ],

    shared_libs: [
        "liblog",
    ],

    static_libs: [
        "libadbd",
        "libadbd_auth",
        "libadb_crypto_static",
        "libadb_pairing_connection_static",
        "libadb_tls_connection_static",
        "libbase",
        "libcrypto_utils",
        "libcrypto_static",
        "libcutils_sockets",
        "libdiagnose_usb",
        "liblog",
        "libusb",
        "libmdnssd",
        "libselinux",
    ],
    test_suites: ["device-tests", "mts"],
    require_root: true,
+4 −0
Original line number Diff line number Diff line
@@ -66,6 +66,10 @@ using namespace std::chrono_literals;
#include "daemon/logging.h"
#endif

#if ADB_HOST
#include "client/usb.h"
#endif

std::string adb_version() {
    // Don't change the format of this --- it's parsed by ddmlib.
    return android::base::StringPrintf(
+1 −2
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
#include "fdevent/fdevent.h"
#include "socket.h"
#include "types.h"
#include "usb.h"

constexpr size_t MAX_PAYLOAD_V1 = 4 * 1024;
constexpr size_t MAX_PAYLOAD = 1024 * 1024;
@@ -139,7 +138,6 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply

/* initialize a transport object's func pointers and state */
int init_socket_transport(atransport* t, unique_fd s, int port, int local);
void init_usb_transport(atransport* t, usb_handle* usb);

std::string getEmulatorSerialString(int console_port);
#if ADB_HOST
@@ -252,4 +250,5 @@ void update_transport_status();
// Wait until device scan has completed and every transport is ready, or a timeout elapses.
void adb_wait_for_device_initialization();

void usb_init();
#endif
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "adb_listeners.h"
#include "adb_utils.h"
#include "adb_wifi.h"
#include "client/usb.h"
#include "commandline.h"
#include "sysdeps/chrono.h"
#include "transport.h"
+6 −2
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

#define TRACE_TAG TRANSPORT

#include "sysdeps.h"

#include "client/usb.h"

#include <memory>

#include "sysdeps.h"
@@ -135,8 +139,8 @@ static int remote_read(apacket* p, usb_handle* usb) {
        }

        p->payload.resize(p->msg.data_length);
        if (usb_read(usb, &p->payload[0], p->payload.size())
                != static_cast<int>(p->payload.size())) {
        if (usb_read(usb, &p->payload[0], p->payload.size()) !=
            static_cast<int>(p->payload.size())) {
            PLOG(ERROR) << "remote usb: terminated (data)";
            return -1;
        }
Loading