platform_system_core/adb
Cody Schuffelen a05b64d432 Add native vsock support to ADB.
vsock is a socket address family for communicating into and out of
virtual machines. Addresses have a port and CID. The CID is unique to
each virtual machine on the computer. The VM host always has CID 2.
http://man7.org/linux/man-pages/man7/vsock.7.html

Inside the android guest, the adb daemon hosts a vsock server with
VMADDR_CID_ANY, automatically using the guest CID. The adb server
can now connect to addresses of the form vsock:cid:port, where the CID
must be specified and the port defaults to 5555.

This is a significant speed improvement for ADB connections in
Cuttlefish, with 150-200 MB/s for `adb push` and 100-150 MB/s for
`adb pull`. It also allows removing some proxying steps from Cuttlefish,
simplifying the full connection path, and removes a dependency on the
unstable ivshmem protocol.

Commands tested against a Cuttlefish VM with CID 3:
adb connect vsock:3:5555
adb -s vsock:3:5555 shell
adb disconnect vsock:3:5555

Supporting "adb disconnect" and "adb -s" required modifying some of the
parts that parse addresses / serials.

push/pull trials with native adb vsock support in cuttlefish:

100m: 1 file pushed. 297.6 MB/s (104857600 bytes in 0.336s)
100m: 1 file pushed. 270.3 MB/s (104857600 bytes in 0.370s)
100m: 1 file pushed. 271.7 MB/s (104857600 bytes in 0.368s)
100m: 1 file pushed. 250.5 MB/s (104857600 bytes in 0.399s)
100m: 1 file pushed. 277.1 MB/s (104857600 bytes in 0.361s)
100m: 1 file pushed. 263.5 MB/s (104857600 bytes in 0.379s)
100m: 1 file pushed. 242.6 MB/s (104857600 bytes in 0.412s)
100m: 1 file pushed. 271.8 MB/s (104857600 bytes in 0.368s)
100m: 1 file pushed. 267.1 MB/s (104857600 bytes in 0.374s)

/data/local/tmp/100m: 1 file pulled. 212.8 MB/s (104857600 bytes in 0.470s)
/data/local/tmp/100m: 1 file pulled. 236.7 MB/s (104857600 bytes in 0.423s)
/data/local/tmp/100m: 1 file pulled. 201.2 MB/s (104857600 bytes in 0.497s)
/data/local/tmp/100m: 1 file pulled. 255.6 MB/s (104857600 bytes in 0.391s)
/data/local/tmp/100m: 1 file pulled. 199.6 MB/s (104857600 bytes in 0.501s)
/data/local/tmp/100m: 1 file pulled. 214.6 MB/s (104857600 bytes in 0.466s)
/data/local/tmp/100m: 1 file pulled. 254.2 MB/s (104857600 bytes in 0.393s)
/data/local/tmp/100m: 1 file pulled. 212.5 MB/s (104857600 bytes in 0.471s)
/data/local/tmp/100m: 1 file pulled. 218.9 MB/s (104857600 bytes in 0.457s)
/data/local/tmp/100m: 1 file pulled. 223.6 MB/s (104857600 bytes in 0.447s)

Bug: 121166534
Change-Id: I50f21fb5c9acafb8daa789df4e28c9e1bbbbf2ef
Test: adb connect/shell/disconnect
2019-01-25 17:55:06 -08:00
..
client Merge "Fix fastdeploy failure in Windows" 2019-01-23 20:52:01 +00:00
daemon Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
fastdeploy Disable dexpreopt for deployagent 2019-01-17 16:24:52 +00:00
sysdeps Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
.clang-format Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
adb.bash Adb and fastboot completion supports zsh users. 2018-07-17 14:19:35 +08:00
adb.cpp Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
adb.h Adding Android Binder Bridge (abb) utility launched from adbd. 2019-01-07 15:45:11 +00:00
adb_auth.h adb: stop using adbkey.pub. 2018-11-15 17:50:57 -08:00
adb_integration_test_adb.xml Add adb integration test to general-tests 2018-08-08 12:08:50 -07:00
adb_integration_test_device.xml Add adb_integration_test_device to general-tests 2018-10-12 13:48:14 -07:00
adb_io.cpp Adding Android Binder Bridge (abb) utility launched from adbd. 2019-01-07 15:45:11 +00:00
adb_io.h Adding Android Binder Bridge (abb) utility launched from adbd. 2019-01-07 15:45:11 +00:00
adb_io_test.cpp switch to using android-base/file.h instead of android-base/test_utils.h 2018-11-14 09:35:34 -08:00
adb_listeners.cpp adb: switch connect_to_remote to string_view. 2018-12-26 11:48:14 -08:00
adb_listeners.h adb: move all cleanup to a function with defined ordering. 2017-05-09 14:32:47 -07:00
adb_listeners_test.cpp adb: support forwarding TCP port 0. 2016-05-09 16:55:10 -07:00
adb_mdns.h Add mDNS device discovery for adb client 2017-03-07 14:45:51 -08:00
adb_trace.cpp adbd: compile for host. 2019-01-23 12:59:41 -08:00
adb_trace.h adb: don't spew to logcat when tracing is enabled. 2018-02-06 15:55:06 -08:00
adb_unique_fd.cpp adb: actually enable fdsan. 2018-08-06 18:50:10 -07:00
adb_unique_fd.h adb: actually enable fdsan. 2018-08-06 18:50:10 -07:00
adb_utils.cpp adb: Use a default _SC_GETPW_R_SIZE_MAX size 2018-10-24 15:23:55 -04:00
adb_utils.h adb: add stroll equivalent for string_view. 2018-12-26 11:48:14 -08:00
adb_utils_test.cpp adb: add stroll equivalent for string_view. 2018-12-26 11:48:14 -08:00
Android.bp adbd: compile for host. 2019-01-23 12:59:41 -08:00
benchmark_device.py adb: improve benchmark script a bit. 2018-10-12 18:03:50 -07:00
bugreport_test.cpp Merge "Don't preserve file attributes when pulling bugreport file..." 2017-08-22 22:41:26 +00:00
fdevent.cpp Revert "Revert "adb: detect some spin loops and abort."" 2018-10-05 17:23:44 -07:00
fdevent.h adb: add fdevent_release. 2018-09-26 12:44:30 -07:00
fdevent_test.cpp Adapt to switch to libc++ for Windows 2018-09-21 10:46:25 -07:00
fdevent_test.h adb: set main thread in transport tests. 2018-10-19 15:38:10 -07:00
file_sync_protocol.h adb: split file_sync_service.h into client and daemon parts. 2018-07-25 18:08:32 -07:00
MODULE_LICENSE_APACHE2
NOTICE Revert "Revert "Revert "adb: append the libwinpthread COPYING to adb's NOTICE.""" 2018-11-29 23:14:02 +00:00
OVERVIEW.TXT adb: fix obsolete documentation. 2018-06-22 13:12:19 -07:00
OWNERS Add OWNERS. 2017-12-07 13:30:03 -08:00
protocol.txt adb: convert Connection to a nonblocking interface. 2018-03-05 13:00:28 -08:00
security_log_tags.h ADB security logging 2016-01-21 15:57:02 +00:00
services.cpp Combine tcp_connect and socket_spec_connect. 2019-01-17 15:58:41 -08:00
services.h adb: split daemon services out of service_to_fd. 2018-07-25 18:49:37 -07:00
SERVICES.TXT adb: fix obsolete documentation. 2018-06-22 13:12:19 -07:00
shell_protocol.h adb: split shell_service.h into client/daemon/protocol parts. 2018-07-25 18:08:44 -07:00
shell_service_protocol.cpp adb: split shell_service.h into client/daemon/protocol parts. 2018-07-25 18:08:44 -07:00
shell_service_protocol_test.cpp adb: split shell_service.h into client/daemon/protocol parts. 2018-07-25 18:08:44 -07:00
socket.h adb: switch connect_to_remote to string_view. 2018-12-26 11:48:14 -08:00
socket_spec.cpp Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
socket_spec.h Combine tcp_connect and socket_spec_connect. 2019-01-17 15:58:41 -08:00
socket_spec_test.cpp Combine tcp_connect and socket_spec_connect. 2019-01-17 15:58:41 -08:00
socket_test.cpp adb: switch skip_host_serial to string_view. 2018-12-26 11:48:14 -08:00
sockets.cpp Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
sockets.dia
SYNC.TXT Fix typos in ADB documentation 2017-11-30 10:57:51 -08:00
sysdeps.h adb: switch unix_open to string_view. 2018-12-21 01:43:31 -08:00
sysdeps_test.cpp adb: fix FdeventTest.invalid_fd on Windows. 2018-03-29 14:24:03 -07:00
sysdeps_unix.cpp adb: use TCP keepalive. 2016-03-03 15:42:11 -08:00
sysdeps_win32.cpp Merge "adb: win32: improve console output on Windows 10" 2019-01-23 03:59:27 +00:00
sysdeps_win32_test.cpp switch to using android-base/file.h instead of android-base/test_utils.h 2018-11-14 09:35:34 -08:00
test_adb.py test_adb.py: silence ResourceWarning. 2018-10-16 11:00:39 -07:00
test_device.py Add feature flag for b/110953234 fix. 2018-10-23 18:28:46 +00:00
trace.sh adb: add script to trace adbd. 2016-12-13 14:31:17 -08:00
transport.cpp Adding new feature to adb "abb". 2019-01-18 21:45:02 +00:00
transport.h Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
transport_benchmark.cpp Revert "adb: make benchmarks build on the host." 2018-11-13 11:28:29 -08:00
transport_fd.cpp adb: fix NonblockingFdConnection's behavior with large writes. 2018-11-12 20:54:39 -08:00
transport_local.cpp Add native vsock support to ADB. 2019-01-25 17:55:06 -08:00
transport_test.cpp adb: set main thread in transport tests. 2018-10-19 15:38:10 -07:00
transport_usb.cpp adb: remove incorrect use of RTTI. 2018-12-12 12:54:03 -08:00
types.h adb: fix zero-initialization in Block. 2018-11-12 20:54:39 -08:00
types_test.cpp Adapt to switch to libc++ for Windows 2018-09-21 10:46:25 -07:00
usb.h adb: get libusb compiling on Windows. 2017-12-08 13:11:15 -08:00