Commit graph

2974 commits

Author SHA1 Message Date
Julien Desprez
4306ad0096 Merge "Temporarily @ignore test_reconnect" am: 9bfa166ad9 am: 84d796dac4
am: b1687ed7e3

Change-Id: Ieec56ca6069294770c1d0303d466a2d67fbf9e2c
2019-02-25 15:28:52 -08:00
Julien Desprez
9bfa166ad9 Merge "Temporarily @ignore test_reconnect" 2019-02-21 18:16:21 +00:00
Josh Gao
7fff457b18 Merge "adb: update symlink timestamps." am: effcb96670 am: c8f34c7920
am: 11b95b8d93

Change-Id: Iea203261dd8d49023ae7b446ec9ebd0f75edec80
2019-02-20 18:52:09 -08:00
Josh Gao
effcb96670 Merge "adb: update symlink timestamps." 2019-02-21 02:31:03 +00:00
Josh Gao
7b1cb66a83 adb: update symlink timestamps.
Bug: http://b/120162375
Test: adb sync; adb shell touch -h -d 2008-01-0101:01:01 /system/bin/ls; adb sync; adb sync
Change-Id: Iedf54528b164913739c66c71d20006e484a4f5e4
2019-02-20 13:17:56 -08:00
Julien Desprez
fb4c13500f Temporarily @ignore test_reconnect
For the purpose of on-boarding all the other tests,
skip test_reconnect for now.

Test: atest -v adb_integration_test_adb
Bug: 123247844
Change-Id: I50269272adbfc3f946d71bae13677546566d541f
2019-02-20 09:42:49 -08:00
Josh Gao
3dd004fd00 Merge "adbd: log when exiting due to root/unroot/tcpip/usb." am: de3c3e8c76 am: 2eaddf6183
am: b78556b277

Change-Id: I6a6dd3807d24a450130efc8dfa63ce1c9b672e70
2019-02-20 04:22:32 -08:00
Josh Gao
24cfc7b5d5 Merge changes from topic "base_cmsg" am: 8954d0bc98 am: b1ca42ae28
am: 8f1cbd47fe

Change-Id: Iadf654700aac1a2892536c262f0fe6203c9beab1
2019-02-19 14:13:18 -08:00
Josh Gao
a80b64f2a0 adbd: log when exiting due to root/unroot/tcpip/usb.
Test: treehugger
Change-Id: Ibfbe4d512c6e126f2e6d311867316f033a4c9ab7
2019-02-19 13:12:59 -08:00
Josh Gao
8954d0bc98 Merge changes from topic "base_cmsg"
* changes:
  adb: switch to base::{Send,Receive}FileDescriptors.
  debuggerd: switch to base::{Send,Receive}FileDescriptors.
  base: add helpers for sending/receiving file descriptors.
2019-02-19 20:53:01 +00:00
Josh Gao
fb45030cad Merge "adbd: fallback to legacy USB implementation if needed." am: f80c326d2e am: dc50e92b71
am: 8b47738b0a

Change-Id: I3d8e50a4168232ae0367e7bcaf5ac670daa24e69
2019-02-16 20:30:03 -08:00
Josh Gao
f80c326d2e Merge "adbd: fallback to legacy USB implementation if needed." 2019-02-17 04:14:22 +00:00
Josh Gao
586a681dbf Merge "base: add ScopedLockAssertion." am: 3777d9cc10 am: 379b6f403f
am: f01d33b9e8

Change-Id: If81cf0d25621d6f733b39823d6b6dbc774a37150
2019-02-15 18:47:40 -08:00
Josh Gao
c0b831bb81 adbd: fallback to legacy USB implementation if needed.
Detect kernels that don't support AIO on functionfs endpoints and fall
back to the old legacy implementation.

Test: treehugger
Change-Id: Ice28dcd40c9730ac2dd5e468d065b41c0e076146
2019-02-15 11:43:49 -08:00
Josh Gao
8e0af5f1b5 adb: switch to base::{Send,Receive}FileDescriptors.
Test: test_device.py
Test: adb abb package list packages
Change-Id: I080dc8620d77b0e6144c895fd2a0cbf7b8063c53
2019-02-13 13:21:54 -08:00
Josh Gao
982f7bd345 base: add ScopedLockAssertion.
This is a useful helper for anyone that's using thread safety
annotations alongside std::condition_variable, extract it from adb and
move it to libbase.

Test: mma
Change-Id: Ic51e2f2a0e6a16628034b29d8ff32bf2155afccd
2019-02-12 16:32:35 -08:00
Josh Gao
ec30852d8d Merge "adb: "support" O_CLOEXEC in adb_open on Windows." am: 9c4fda6cd2 am: c1f4e167b6
am: e90e12de63

Change-Id: Ie2952b103020716afebadfaa13ecd593ed671117
2019-02-07 23:11:42 -08:00
Treehugger Robot
9c4fda6cd2 Merge "adb: "support" O_CLOEXEC in adb_open on Windows." 2019-02-08 06:56:47 +00:00
Josh Gao
cefb432500 Merge "adb: hopefully deflake test_adb.py." am: 151499e47e am: ad68f429ca
am: 001adec269

Change-Id: Ifb02659531eae0b7aaadb3b54bb8d02e33b2295c
2019-02-07 22:02:57 -08:00
Josh Gao
aa95aa063f adb: hopefully deflake test_adb.py.
The reconnection test is spuriously failing on test infrastructure for
unclear reasons, which might be due to a race between the connection
attempt and the first command we send. Insert a sleep to hopefully
reduce the flakiness.

Bug: http://b/123247844
Test: ./test_adb.py (but it didn't fail for me in the first place)
Change-Id: Ic36924c16bae424accfec700af4623794fd1f123
2019-02-07 17:53:29 -08:00
Josh Gao
4b019a5f25 adb: "support" O_CLOEXEC in adb_open on Windows.
Previously, we were rejecting the flag and failing with EINVAL. File
handles aren't inherited by default, so just ignore the flag.

Bug: http://b/123753498
Test: adb install --streaming foo.apk
Change-Id: I17401fcdd58024956d47a5c4c0c57b06831d9817
2019-02-07 14:23:39 -08:00
Josh Gao
e3a16ff9df Merge changes I1abd671f,I9ae61465 am: 0220ca7d09 am: 3839ff3bf9
am: e6c5224c7c

Change-Id: Ib2f76aeb430b487fd3a379fb3c9ccd91c7c5e31b
2019-02-01 14:10:10 -08:00
Josh Gao
74b7ec72f8 adb: don't close sockets before hitting EOF.
Reimplement commit ffc11d3cf3 using
fdevent. The previous attempt was reverted because we were blindly
continuing when revents & POLLIN == 0, which ignored POLLHUP/POLLERR,
leading to spinloops when the opposite end of the file descriptor was
shutdown when we had no data left to read.

This patch reimplements the functionality implemented by that commit
using fdevent, which gets us detection of spin loops for free.

Bug: http://b/74616284
Test: ./test_device.py
Change-Id: I1abd671fef4c29e99dad968aa66bb754ca382578
2019-01-31 23:36:41 -08:00
Josh Gao
1a90118bbb adb: implement fdevent_set_timeout.
Test: adb_test
Change-Id: I9ae61465617b6a2fe0a1c161ad88c4feae49ec80
2019-01-31 23:36:41 -08:00
Josh Gao
41b2e6f282 Merge changes If8747ba1,Id1943ebd am: 69ba5179f4 am: a2e6417840
am: b890b1acd2

Change-Id: I6f82b8a5e5d2a3bccb75ae0cb8f5ad94884ff9cf
2019-01-31 13:52:33 -08:00
Josh Gao
69ba5179f4 Merge changes If8747ba1,Id1943ebd
* changes:
  adb: improve network_connect error messages.
  adbd: fix TCP bind address.
2019-01-31 21:19:45 +00:00
Tom Cherry
5f174d3649 Merge "Add android::fs_mgr namespace for new Fstab code" am: 54ea49ba05 am: 0bc62d5680
am: 0dec9106c3

Change-Id: I7fd5d3927dde907a7dbf8ad47325c3a9c5819d0d
2019-01-31 12:23:54 -08:00
Tom Cherry
54ea49ba05 Merge "Add android::fs_mgr namespace for new Fstab code" 2019-01-31 19:35:54 +00:00
Josh Gao
4a7704cd76 Merge changes Ief3dbf8e,Ib06e6f65 am: ee0e63f71d am: 12ac0c75ac
am: f4a35a0ec6

Change-Id: I74478f32beb3cc5014f90740f3a8838f67b7cd6b
2019-01-31 01:29:29 -08:00
Josh Gao
ee0e63f71d Merge changes Ief3dbf8e,Ib06e6f65
* changes:
  adb: add fdevent callback that passes the fdevent.
  base: don't overwrite errno in unique_fd::~unique_fd.
2019-01-31 09:09:12 +00:00
Jiyong Park
7b9a913497 Merge changes from topic "move_bionic_to_apex3" am: a15f385821 am: 90b7095cf5
am: 7ce93d2d0d

Change-Id: I670493883a18e604bb3cbc80979c76d0a725c0ef
2019-01-30 21:30:28 -08:00
Treehugger Robot
a15f385821 Merge changes from topic "move_bionic_to_apex3"
* changes:
  Handle adb sync with Bionic under /bionic
  Proper mount namespace configuration for bionic
2019-01-31 04:46:49 +00:00
Tom Cherry
a3530e6366 Add android::fs_mgr namespace for new Fstab code
Should have been done a while ago, but better late than never.

Test: treehugger
Change-Id: I0ea6e8d459cd3f3b3ce2d00a7a6a9786d52c52dd
2019-01-30 20:20:05 -08:00
Josh Gao
c162c713ef adb: add fdevent callback that passes the fdevent.
This is useful for when we don't want to actually store the fdevent
into a separate struct to be able to destroy it, but instead want to
destroy it immediately from the callback.

Test: adb_test
Change-Id: Ief3dbf8ea6a6bd72dc7e73f9ab9b7429e48fc181
2019-01-30 15:18:56 -08:00
Josh Gao
64e597a62f adb: improve network_connect error messages.
Test: manual
Change-Id: If8747ba1951d3c87561fbd3fb4968821243b2ee2
2019-01-30 14:54:10 -08:00
Josh Gao
eb0875db65 adbd: fix TCP bind address.
The switch to socket_spec_listen broke adbd over TCP, because
socket_spec_listen only listens on localhost.

Bug: http://b/123592649
Test: manual
Change-Id: Id1943ebd7f0059db05ad756fe96189c60ebde337
2019-01-30 14:49:20 -08:00
Dario Freni
a7be4fd34f Merge "Fix: Propagate cmd args to multi-package sessions." am: 2dc8b4cec8 am: f5a2df770b
am: e03d955c62

Change-Id: I4409db1d4dd0eb6223c00532e0469303a7f6afe4
2019-01-30 14:08:35 -08:00
Dario Freni
a2f3f9558f Fix: Propagate cmd args to multi-package sessions.
Test: adb install-multi-package --staged file1.apk file2.apk. Verified
that --staged is propagated.
Bug: 118865310
Change-Id: I59cd5c49b4a60ab7bf7481732cd3bd3205820d7a
2019-01-30 16:40:02 +00:00
Jiyong Park
7c7189c469 Handle adb sync with Bionic under /bionic
Background:
We now have two sets of Bionic: the bootstrap Bionic which is at
/system/{lib|bin}/bootstrap for early processes and the default Bionic
which is from the runtime APEX for all the others. In order to give the
same path for Bionic to both categories of processes, the init prepares
two mount namespaces and bind-mount appropriate Bionic files onto the
common mount points under /bionic. For example,
/system/bin/bootstrap/linker is bind-mounted to /bionic/bin/linker for
the early processes. Likewise, /apex/com.android.runtime/bin/linker is
bind-mounted to the same path for rest of the processes.

In addition, in order not to propagate mount events in one mount
namespace to the other namespace, /bionic itself is created as a mount
namespace (via self bind-mount) and its propagation type is set to
private.

Changes required:
This however requires some adjustments to adb sync and remount
mechanism.

For remounting, /bionic path should also be re-mounted for RW, because
it is a RO mount in the beginning. This remounting is done only for the
system-as-root devices where entire / can be re-mounted as RW.

For synching, the sync thread creates a temporary mount namespace where
there is no bind-mount. This ensures that a path that the thread handles
is pointing to the correct file that is expected from the client side.

In addition, push operation to /bionic path is done without unlinking.
This is required because the mount points under /bionic are gone in the
current mount namespace but are still active in other mount namespaces.
If unlinked, the existing mounts on the path are all silently removed.
In order to prevent the unwanted situation, the moint points are not
unlinked but truncated to 0. This however is not a significant problem
because the files that serve as mount points do not carry any
useful information (i.e. the content is meaningless).

Bug: 879416
Test: adb sync
adb push <random_file> /bionic/bin/linker64
adb push <random_file> /system/bin/bootstrap/bin/linker64
system/core/fs_mgr/tests/adb-remount-test.sh
Change-Id: Id87dc9ee7ec5c43d06b54969b55e2cb394329317
2019-01-30 19:18:22 +09:00
Josh Gao
71b815f797 Merge "adb: turn off fastdeploy." am: 82f0e7dad8 am: 90aadf880d
am: a3de92be6c

Change-Id: I260480c896f890f67818b85a5916a1a9057a33bf
2019-01-29 16:42:58 -08:00
Josh Gao
82f0e7dad8 Merge "adb: turn off fastdeploy." 2019-01-29 23:50:07 +00:00
Josh Gao
287e442dc4 adb: turn off fastdeploy.
The PDK doesn't have frameworks/base, so having a dependency from adb to
a library in there breaks the build. #ifdef out fastdeploy until we
figure out what we're going to do here, to unbreak the PDK build.

Bug: http://b/118782743
Test: treehugger
Change-Id: I638cf09e5013935e112c7a57dae0e7e94e1a4680
2019-01-29 11:21:15 -08:00
Tom Cherry
ab66380469 Merge "Remove the rest of users of the old style fstab" am: 286684f835 am: 9eaed18adb
am: cd12736426

Change-Id: I86c21f222595ba43068c20edd95582c66b1d4d15
2019-01-29 00:50:04 -08:00
Greg Kaiser
7beedaf0a5 Merge "adb: Fix incorrect logging statement" am: 32aaba6dcf am: d13559092c
am: c5ba3e1014

Change-Id: If4e5a98de613f84d14b74b7307865ec42f217d3d
2019-01-28 22:18:26 -08:00
Treehugger Robot
286684f835 Merge "Remove the rest of users of the old style fstab" 2019-01-29 00:29:09 +00:00
Tom Cherry
b688d917cd Remove the rest of users of the old style fstab
And deprecate one more old style function that is not used after this
change.

Test: boot, disable and enable verity
Change-Id: Id509f479850120352b4ea4dc3b6c40f6e8e2e53e
2019-01-28 12:34:33 -08:00
Greg Kaiser
fdb9800fcc adb: Fix incorrect logging statement
We were logging "fd.get()" after we had already done a
"std::move(fd)".  That won't log the value we were hoping for.
We instead cache the file descriptor value in a local int prior
to the move(), and log that.

Test: TreeHugger
Change-Id: I715874ac63329280ffb55881fb2590fb31dc2457
2019-01-28 06:17:44 -08:00
Cody Schuffelen
6dbf6a491c Merge "Add native vsock support to ADB." am: d290bb7ed8 am: 8435ddc499
am: 00a8d2693f

Change-Id: I5fc12d468a710dcca271ba1f03b6a939675b1cb2
2019-01-25 21:45:32 -08:00
Treehugger Robot
d290bb7ed8 Merge "Add native vsock support to ADB." 2019-01-26 05:25:28 +00:00
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