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

Commit 0e947189 authored by Tao Bao's avatar Tao Bao Committed by Gerrit Code Review
Browse files

Merge "adb: `adbd` uses shared libraries."

parents f502182a eca59ae8
Loading
Loading
Loading
Loading
+95 −28
Original line number Diff line number Diff line
@@ -277,47 +277,53 @@ cc_binary_host {
    },
}

// libadbd_core contains the common sources to build libadbd and libadbd_services.
cc_library_static {
    name: "libadbd",
    name: "libadbd_core",
    defaults: ["adb_defaults"],
    recovery_available: true,

    // libminadbd wants both, for some reason.
    // libminadbd wants both, as it's used to build native tests.
    compile_multilib: "both",

    srcs: libadb_srcs + libadb_posix_srcs + [
        "daemon/auth.cpp",
        "daemon/usb.cpp",
        "daemon/jdwp_service.cpp",
        "daemon/usb.cpp",
    ],

    local_include_dirs: [
        "daemon/include",
    ],

    static_libs: [
        "libasyncio",
        "libcrypto_utils",
        "libcrypto",
        "libdiagnose_usb",
        "libqemu_pipe",
        "libbase",
    ],

    export_include_dirs: [
        "daemon/include",
    shared_libs: [
        "libasyncio",
        "libbase",
        "libcrypto",
        "libcrypto_utils",
        "libcutils",
        "liblog",
    ],
}

cc_binary {
    name: "adbd",
cc_library {
    name: "libadbd_services",
    defaults: ["adb_defaults"],

    recovery_available: true,
    compile_multilib: "both",

    srcs: [
        "daemon/main.cpp",
        "daemon/mdns.cpp",
        "daemon/file_sync_service.cpp",
        "daemon/framebuffer_service.cpp",
        "daemon/mdns.cpp",
        "daemon/remount_service.cpp",
        "daemon/set_verity_enable_state_service.cpp",
        "daemon/services.cpp",
        "daemon/set_verity_enable_state_service.cpp",
        "daemon/shell_service.cpp",
        "shell_service_protocol.cpp",
    ],
@@ -327,31 +333,92 @@ cc_binary {
        "-Wno-deprecated-declarations",
    ],

    strip: {
        keep_symbols: true,
    },

    static_libs: [
        "libadbd",
        "libasyncio",
        "libadbd_core",
        "libavb_user",
        "libdiagnose_usb",
        "libqemu_pipe",

        // `daemon/shell_service.cpp` uses selinux_android_setcon(), which is not exposed by
        // libselinux.
        "libselinux",
    ],

    shared_libs: [
        "libasyncio",
        "libbase",
        "libbootloader_message",
        "libcrypto_utils",
        "libcrypto",
        "libdiagnose_usb",
        "libcrypto_utils",
        "libcutils",
        "libext4_utils",
        "libfec",
        "libfec_rs",
        "libfs_mgr",
        "liblog",
        "libext4_utils",
        "libmdnssd",
        "libminijail",
        "libselinux",
        "libsquashfs_utils",
        "libqemu_pipe",
    ],
}

cc_library {
    name: "libadbd",
    defaults: ["adb_defaults"],
    recovery_available: true,

    // Avoid getting duplicate symbol of android::build::GetBuildNumber().
    use_version_lib: false,

    // 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: [
        "libadbd_core",
    ],

    shared_libs: [
        "libadbd_services",
        "libasyncio",
        "libbase",
        "libcrypto",
        "libcrypto_utils",
        "libcutils",
        "liblog",
    ],

    export_include_dirs: [
        "daemon/include",
    ],
}

cc_binary {
    name: "adbd",
    defaults: ["adb_defaults"],
    recovery_available: true,

    srcs: [
        "daemon/main.cpp",
    ],

    cflags: [
        "-D_GNU_SOURCE",
        "-Wno-deprecated-declarations",
    ],

    strip: {
        keep_symbols: true,
    },

    shared_libs: [
        "libadbd",
        "libadbd_services",
        "libbase",
        "libcap",
        "libcrypto",
        "libcutils",
        "liblog",
        "libminijail",
        "libselinux",
    ],
}

+4 −4
Original line number Diff line number Diff line
@@ -453,10 +453,6 @@ static atransport* find_emulator_transport_by_adb_port_locked(int adb_port)
    return it->second;
}

std::string getEmulatorSerialString(int console_port) {
    return android::base::StringPrintf("emulator-%d", console_port);
}

atransport* find_emulator_transport_by_adb_port(int adb_port) {
    std::lock_guard<std::mutex> lock(local_transports_lock);
    return find_emulator_transport_by_adb_port_locked(adb_port);
@@ -467,6 +463,10 @@ atransport* find_emulator_transport_by_console_port(int console_port) {
}
#endif

std::string getEmulatorSerialString(int console_port) {
    return android::base::StringPrintf("emulator-%d", console_port);
}

int init_socket_transport(atransport* t, unique_fd fd, int adb_port, int local) {
    int fail = 0;