Misconfigured systems can have localhost pointing to an address that
isn't 127.0.0.1 or ::1.
adb is the only caller of the libcutils socket_loopback functions, so
move them into adb and switch the implementations over to using
INADDR_LOOPBACK and in6addr_loopback, instead of resolving 'localhost'
when connecting.
Bug: http://b/37282612
Test: `killall adb; adb shell`
Test: `killall adb; ip addr del 127.0.0.1/8 dev lo; adb shell`
Change-Id: I01c1885f1d9757ad0f7b353dd04b4d1f057741c8
We have to disable IPv6 to get this going, but nobody was yet using
IPv6, so that should be fine for now.
Test: Verified mDNS discovery on a MacBook
Bug: 31042497
(cherry picked from 9ae65de087171072f3890a81b074ae27db319508)
Change-Id: I628f0a1e9c4784db42fa56f5faf2904b6e1cf548
Test: Verified ADB over mDNS on a Windows machine
Bug: 30482671
(cherry picked from 9fdd77101f49d03ff29342e12e23edf241f68522)
Change-Id: If955ca304db71a5b08c5a9654f1e27ab74af9af8
Test: Was able to discover a raspberry pi.
Bug: 28074466
(cherry picked from e292cd16760321fccc99c8c261cb92fa4b6462ab)
Change-Id: Id9571576457a4a0a078e48a274a4e8eac78bfe2b
We now request mdnsd from adb and register a service of type _adb._tcp
for clients to connect to.
Test: Verified service appears in avahi-browse
Bug: 28074466
(cherry picked from 379ac414e4d9f53388d903913022a55695292775)
Change-Id: Ie871b9c8b40e86063cc1e68e8f3e4290ead2d279
Traditionally, qemu_pipe has both the declaration and implentation of each
function in one header file--qemu_pipe.h, and it is getting incovenient to
maintain.
This CL separates the implementation of functions from the header file,
and makes qemu_pipe a static library for other modules to link to.
Note that the interface and implementation of qemu_pipe are kept unchanged,
and future CLs will enhance the implementation to make it more reliable and
more compatible with old and new API levels.
Following projects are affected by this refactoring, and they are modified
accordingly:
device/generic/goldfish
device/generic/goldfish-opengl
hardware/ril/reference-ril
Change-Id: I541ecbf0cc7eadeef9d4e37ffd9ca7bfcc5c94c0
Explicitly link against the static libwinpthread.a to avoid a
dependency on the dll.
Also, make the tests link against libbase statically.
Bug: http://b/31665213
Test: wine adb.exe
Test: wine adb_test.exe
Change-Id: Ifd41afcb1756a4b9b6db12e102b4db502e73d846
Add a libusb-based implementation alongside the existing native
implementations, controlled by the ADB_LIBUSB environment variable.
Windows will need more work for the usb driver.
Bug: http://b/31321337
Test: python test_device.py on linux/darwin, with ADB_LIBUSB=0 and 1
Change-Id: Ib68fb2c6c05475eae3ff4cc19f55802a6f489bb7
Break adbd's USB initialization code into its own static library to
allow it to be used by benchmark code that pretends to be adbd.
Bug: http://b/31289465
Test: adb shell works on bullhead
Change-Id: I0ac7d78a4f7aef59bd6d14fc5cf1ed870e1f3a9d
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.
Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
We used to write the command file (/cache/recovery/command) to trigger
the sideload mode. A/B devices don't support that (may not have /cache
paritition). This CL switches to using libbootloader_message which
writes the command to BCB (bootloader control block) instead.
Test: "adb root && adb reboot sideload" reboots sailfish into recovery
sideload mode.
Change-Id: I158fd7cbcfa9a5d0609f1f684a2d03675217628f
This reverts commit afa4b5d6eb.
Add functions to translate errno to and from the linux asm-generic
values, since mips has different values.
Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I1a122235f3e793ed10b3bf3ad293388015134150
Extend the file sync protocol to support calling regular stat (instead
of lstat), return error codes, and provide the entire stat struct.
Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I841123debc380f86194a19e91c97d85160112144
All of the functions in adb_auth.cpp were used in only one of
adb/adbd. Split up them up into adb_auth_host.cpp and adbd_auth.cpp
respectively.
Bug: http://b/29273531
Test: built and flashed bullhead, adb still works
Change-Id: Ib610c5157522634cc273511175152f1306cc52a7
Since commit 8ad80763e4 has removed
'#include "ext4_sb.h"', there's no more reference to ext4_utils headers.
Test: `mmma system/core/adb`
Change-Id: I7ca1a6e91f1e0de84238c2a7facbebe9600a3d87
We'd long had two copies of this stuff, so rather than rewrite both
Linux versions to use android::base::Readlink, let's kill the duplication
too...
Bug: http://b/30988271
Change-Id: I4de58a94a22a4b1faf969a6fc70ca1560a4d5121
adb calls bugreportz to generate a bugreport; initially, bugreportz
would only report the final status of the operation (OK or FAIL), but
now it sends intermediate PROGRESS lines reporting its progress (in the
form of current/max).
Similarly, the initial implementation of 'adb bugreport <zip_file>'
would print an initial 'please wait' message and wait for the full
stdout before parsing the result, but now it uses a new callback class
to handle the stdout as it is generated by bugreportz.
BUG: 28609499
Change-Id: I6644fc39a686279e1635f946a47f3847b547d1c1
(cherry picked from commit cd42d658b2)
(cherry picked from commit 97b73a0daf)
bugreport() will be soon refactored to track progress, which will
require more comprehensive unit tests.
As such, it's better to move it to its own files, which in turn also
requires moving send_shell_command() and usage() to commandline.h.
Fixes: 30100363
Bug: 30268737
Change-Id: I3cdf114a0b5547293320042ff0749a60886440b0
(cherry picked from commit 78e0963e4b)
(cherry picked from commit 218e1ff759)
Move the logic for string socket specification out to separate
functions to facilitate using arbitrary sockets for the adb command
socket.
Bug: http://b/30445394
Change-Id: Icd8fdb853272edc029fb3a0f5b18e941dc8ef52c
Test: adb_test, adbd_test, test_device.py
stat on Windows fails with ENOENT when passed a path with a trailing
slash or backslash, regardless of whether the target is actually a
directory. Emulate the correct POSIX behavior by stripping trailing
path separators and then checking if the target is a directory if
successful.
Bug: http://b/30481559
Bug: https://code.google.com/p/android/issues/detail?id=214633
Change-Id: I1d398d19a9bce1ecb3fdc4aabc31aa98c82c3f93
Test: Relevant adb_tests pass on Linux and Windows 10.
This CL adds support to forward or reverse TCP port 0 to allow the
system to automatically select an open port. The resolved port number
will be printed to stdout:
$ adb forward tcp:0 tcp:8000
12345
$ adb reverse tcp:0 tcp:9000
23456
This allows testing to be more robust by not hardcoding TCP ports which
may already be in use.
Forwarding port 0 is a host-only change and will work with any device,
but reversing port 0 requires the device to be updated with a new adbd
binary.
This CL also does a little bit of cleanup such as moving the alistener
class out of adb.h, and adds some error checking and additional tests.
Bug: 28051746
Test: python -m unittest discover
Test: adb_test
Test: `adb forward` and `adb reverse` with tcp:0
Change-Id: Icaa87346685b403ab5da7f0e6aa186aa091da572
Fixes the following warnings:
build/core/binary.mk:894: warning: overriding commands for target
`out/target/product/bullhead/obj/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: ignoring old commands for target
`out/target/product/bullhead/obj/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: overriding commands for target
`out/target/product/bullhead/obj_arm/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: ignoring old commands for target
`out/target/product/bullhead/obj_arm/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
Change-Id: Id4b13574e568284cefbc3a763d40843e73ddbd3d
Currently adb only realizes a TCP transport has gone away when it tries
to send a packet, which caused problems in particular for `adb reboot`
since no packets are sent, leading to the client hanging until Ctrl+C.
This CL turns on TCP keepalive packets to send 1 packet every second,
allowing up to 10 failures before disconnecting. Using built-in TCP
functionality turns out to be much cleaner in this case than trying to
implement our own keepalive packets at the application layer, and
should be more lightweight since it's all done in the TCP stack.
Bug: http://b/23093474
Change-Id: Ifb41cbb85b9752a9f394e1eed3c6ac4da47a4e4d
Switch pthread_* to use the adb_thread_* abstractions to allow the fdevent
and socket tests to compile on Win32.
Bug: http://b/27105824
Change-Id: I6541bb1398780b999837e701837d7f86a5eee8ca