diff --git a/adb/Android.bp b/adb/Android.bp index 19e921f8c..8779c0ab2 100644 --- a/adb/Android.bp +++ b/adb/Android.bp @@ -165,7 +165,6 @@ libadb_srcs = [ "adb_unique_fd.cpp", "adb_utils.cpp", "fdevent/fdevent.cpp", - "fdevent/fdevent_poll.cpp", "services.cpp", "sockets.cpp", "socket_spec.cpp", @@ -176,6 +175,17 @@ libadb_srcs = [ "types.cpp", ] +libadb_darwin_srcs = [ + "fdevent/fdevent_poll.cpp", +] + +libadb_windows_srcs = [ + "fdevent/fdevent_poll.cpp", + "sysdeps_win32.cpp", + "sysdeps/win32/errno.cpp", + "sysdeps/win32/stat.cpp", +] + libadb_posix_srcs = [ "sysdeps_unix.cpp", "sysdeps/posix/network.cpp", @@ -219,7 +229,7 @@ cc_library_host_static { srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs, }, darwin: { - srcs: ["client/usb_osx.cpp"], + srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs, }, not_windows: { srcs: libadb_posix_srcs, @@ -228,10 +238,7 @@ cc_library_host_static { enabled: true, srcs: [ "client/usb_windows.cpp", - "sysdeps_win32.cpp", - "sysdeps/win32/errno.cpp", - "sysdeps/win32/stat.cpp", - ], + ] + libadb_windows_srcs, shared_libs: ["AdbWinApi"], }, }, diff --git a/adb/adb_trace.cpp b/adb/adb_trace.cpp index cea24fe2f..c579dde92 100644 --- a/adb/adb_trace.cpp +++ b/adb/adb_trace.cpp @@ -89,18 +89,13 @@ void start_device_log(void) { int adb_trace_mask; -std::string get_trace_setting_from_env() { +std::string get_trace_setting() { +#if ADB_HOST const char* setting = getenv("ADB_TRACE"); if (setting == nullptr) { setting = ""; } - - return std::string(setting); -} - -std::string get_trace_setting() { -#if ADB_HOST - return get_trace_setting_from_env(); + return setting; #else return android::base::GetProperty("persist.adb.trace_mask", ""); #endif diff --git a/adb/fdevent/fdevent.cpp b/adb/fdevent/fdevent.cpp index fd550200f..70cb9b3a6 100644 --- a/adb/fdevent/fdevent.cpp +++ b/adb/fdevent/fdevent.cpp @@ -27,7 +27,10 @@ #include "adb_utils.h" #include "fdevent.h" #include "fdevent_epoll.h" + +#if !defined(__linux__) #include "fdevent_poll.h" +#endif using namespace std::chrono_literals; using std::chrono::duration_cast;