Commit graph

2296 commits

Author SHA1 Message Date
Josh Gao
d56eebd6c2 adb: kill adb_thread_{create, join, detach, exit}.
am: e1dacfc1b6

Change-Id: I5e0324b33d40f873d196946cee7591de0b7b949c
2017-04-14 20:08:04 +00:00
Josh Gao
32d7ede78b adb: don't try to resolve 'localhost'
am: 46de1d7f03

Change-Id: Ie419c5ddd80938760d7eaa3f50605c9874ca33d7
2017-04-14 20:07:56 +00:00
Josh Gao
e1dacfc1b6 adb: kill adb_thread_{create, join, detach, exit}.
We have std::thread now, so we can delete this cruft.

Test: python test_device.py
Test: adb_test
Test: wine adb_test.exe
Test: /data/nativetest/adbd_test/adbd_test
Change-Id: Ie1c1792547b20dec45e2a62ce6515fcb981c3ef8
2017-04-12 17:12:32 -07:00
Josh Gao
46de1d7f03 adb: don't try to resolve 'localhost'
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
2017-04-12 16:07:49 -07:00
Johan Toras Halseth
eca1b3bdcc Move adb backup/restore helptext to adb shell bu help.
Key/value support for adb backup was added in ag/1946677, and help text
for adb shell bu is added in ag/2088937. This CL points the user to this
helptext instead of keeping it here, since it can quickly get out of
sync.

BUG=36170696

Test: adb
Change-Id: Ic40679f421a32e60f292ad20b726a89bfff03349
2017-04-11 19:15:17 +01:00
Treehugger Robot
4b8087aeb2 Merge "adb: don't reset usb when connecting it." 2017-04-04 19:29:09 +00:00
Yabin Cui
5d002b8d6a adb: don't reset usb when connecting it.
Calling libusb_reset_device() resets the usb connection with device
on linux platform. It can interfere with other usb interfaces and only
works on linux.
Removing it only affects when adb server is killed while doing IO with
device, which will be solved in later patches.

Bug: http://b/32952319
Test: none
Change-Id: I19522435eadd938ff95d49cbae3bcaa5c8f6d184
2017-04-04 10:29:21 -07:00
Elliott Hughes
8aac990de2 Merge "Show install path in "adb --version" and "fastboot --version"."
am: d2d8b68f70

Change-Id: I3fac85f01f08c277bdc4ccc8ebbb22ddb9f3397f
2017-04-04 01:23:40 +00:00
Elliott Hughes
d2d8b68f70 Merge "Show install path in "adb --version" and "fastboot --version"." 2017-04-04 01:16:11 +00:00
Josh Gao
83b3c0817f Merge "Revert "adb: check our socketpair ends in our win32 emulation.""
am: c1314c8b13

Change-Id: I4eaca80573fc3b17ff312eae2e9e4598a0bcf55a
2017-03-30 23:56:45 +00:00
Elliott Hughes
1fd46dfa72 Show install path in "adb --version" and "fastboot --version".
Bug: http://b/36766455
Bug: http://b/34691048
Test: ran tests
Change-Id: I4b67ec54d41a281fe7a33c017d3cfbc8055e3b43
2017-03-30 15:10:24 -07:00
Josh Gao
3726a0195b Revert "adb: check our socketpair ends in our win32 emulation."
This reverts commit 5990191c4e.

Some Windows users are seeing mismatches between the two ends.

Bug: https://code.google.com/p/android/issues/detail?id=258400
Test: mma
Change-Id: Ie3a121a2754332608ff64b3b016adcb4258d41f3
2017-03-30 13:12:37 -07:00
Josh Gao
36699d3fb2 Merge "adb: allow symlinks to directories in directory_exists."
am: c10c31e8ba

Change-Id: I9480b98081f9db54955da19a4565c9a458781cdb
2017-03-24 18:43:23 +00:00
Josh Gao
ff468dce4c adb: allow symlinks to directories in directory_exists.
Bug: http://b/36516955
Test: python test_device.py
Change-Id: Ie81e87aac3b157182bde0955bdba23d48bfea873
2017-03-23 16:19:55 -07:00
Elliott Hughes
0cb8c69bf2 Merge "Switch "adb sideload" over to lseek/read."
am: c0ca39c41a

Change-Id: Ia50ff02ed1e11f6bac3d5ef2e5d09c03fa6f216c
2017-03-23 21:21:34 +00:00
Elliott Hughes
c0ca39c41a Merge "Switch "adb sideload" over to lseek/read." 2017-03-23 21:06:51 +00:00
Elliott Hughes
ee1ac710cd Switch "adb sideload" over to lseek/read.
This made no difference to the time taken to sideload an AOSP marlin
update (1m24s), but does reduce the memory requirements to 64KiB.

Bug: https://code.google.com/p/android/issues/detail?id=258500
Bug: http://b/36046324
Test: "time adb sideload update.zip"
Change-Id: Ib0a4daeb5fe798a9bb9c9e0e5fbcff0ed46f20df
2017-03-22 14:34:16 -07:00
Felipe Leme
70fd64ec05 Merge "Don't display bugreport progress when it recedes."
am: 450c44052c

Change-Id: Ieff977589b4c41687727099868b548e0072469f8
2017-03-21 02:05:04 +00:00
Treehugger Robot
450c44052c Merge "Don't display bugreport progress when it recedes." 2017-03-21 01:58:12 +00:00
Josh Gao
f9d12f272e Merge "adb: switch the jdwp control socket to SOCK_SEQPACKET."
am: 249836158e

Change-Id: Ia42f80f778b2ba78d5d6181038b144c89530f772
2017-03-20 23:28:34 +00:00
Josh Gao
b2a7251c55 adb: switch the jdwp control socket to SOCK_SEQPACKET.
Switch the jdwp control socket to SOCK_SEQPACKET so we don't have to
worry about short reads for the PID.

Bug: http://b/36411868
Test: adb jdwp
Change-Id: I908b88e93b1e0ca2895eb8e777d8438a7bbfa92a
2017-03-20 13:37:13 -07:00
Josh Gao
7e5b10b18c Merge "adb: detect closed jdwp socket."
am: e1c4e04f82

Change-Id: Ife55285da64e0c12dac3cd8e8171126c3bb8b543
2017-03-20 20:04:38 +00:00
Felipe Leme
dedcbaad51 Don't display bugreport progress when it recedes.
Also fixed InvalidNumberArgs that broke when usage() was moved out from
bugreport.cpp.

Fixes: 26354314
Bug: 28054087
Test: m -j32 adb_test && ./out/host/linux-x86/nativetest64/adb_test/adb_test --gtest_filter=BugreportTest.*

Change-Id: I7be5ef7de0fb0d339dc80a2abc816e1c905deb22
2017-03-20 11:49:21 -07:00
Josh Gao
3fd78c922c adb: detect closed jdwp socket.
If a process opens a JDWP socket, but crashes before writing the full
PID, adbd will spin forever.

Bug: http://b/36411868
Test: none
Change-Id: I1811759e15c3d9c819685c5fc159a566bd4bc842
2017-03-20 11:11:19 -07:00
Tom Cherry
ef3017bdbd Merge "Remove extraneous .clang-format files"
am: 41c7bb5055

Change-Id: I5062d81a01cde71a9bbe7549f9e3c9198af955ae
2017-03-15 00:55:35 +00:00
Tom Cherry
5b4eb23cfd Remove extraneous .clang-format files
The .clang-format files in the base, debuggerd, adb, libprocinfo, and
fastboot subdirectories each differ slightly from the top level
.clang-format-2 and .clang-format-4, but not in a substantially
meaningful way, as the source files in those directories have not been
re-formatted with clang-format.  Therefore, let's reduce the
differences and use only the two top level clang-format files.

Secondly perform some small clean-up of the top level .clang-format
files.  AllowShortBlocksOnASingleLine is already false in the Google
style, so it can be removed.  AllowShortFunctionsOnASingleLine should
not change between the -2 and -4 versions, so leave it at the Google
default style in both, which is 'All'.

The diff stats for these changes are:

./base/
Old:
640 insertions(+), 531 deletions(-)
New:
563 insertions(+), 808 deletions(-)

./debuggerd/
Old:
910 insertions(+), 886 deletions(-)
New:
991 insertions(+), 1023 deletions(-)

./adb/
Old:
2623 insertions(+), 2886 deletions(-)
New:
2655 insertions(+), 3103 deletions(-)

./libprocinfo/
Old:
2 insertions(+), 1 deletion(-)
New:
4 insertions(+), 18 deletions(-)

./fastboot/
Old:
618 insertions(+), 743 deletions(-)
New:
726 insertions(+), 882 deletions(-)

./init/
Old:
1755 insertions(+), 1866 deletions(-)
New:
1715 insertions(+), 1952 deletions(-)

Test: Above clang-format stats
Change-Id: I3f7b8ab0660c8394c5008ba95ea15e70dd22b55b
2017-03-14 14:06:31 -07:00
Bowgo Tsai
4ba84b2dd2 Merge "adb: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()"
am: eca92a5a6f

Change-Id: I192ac96673a3c7e8b4f81c7b27fd761d445556ee
2017-03-11 03:54:23 +00:00
Treehugger Robot
eca92a5a6f Merge "adb: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()" 2017-03-11 03:48:49 +00:00
Bowgo Tsai
66ee277353 adb: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()
The original default /fstab.{ro.hardware} might be moved to
/vendor/etc/. or /odm/etc/. Use the new API to get the default
fstab instead of using the hard-coded /fstab.{ro.hardware}.

Bug: 35811655
Test: boot marlin with /vendor/etc/fstab.marlin, then run 'adb remount'
Change-Id: I927209ce3c5bea45c01ed631a7c4c320fe728c00
2017-03-11 09:37:56 +08:00
Josh Gao
b0e8bbfc99 Merge "adb: properly erase destroyed jdwp_trackers."
am: e02eba8fd2

Change-Id: Ia87892fecebc64198b70acf089aa7eac3652175e
2017-03-10 21:00:23 +00:00
Treehugger Robot
e02eba8fd2 Merge "adb: properly erase destroyed jdwp_trackers." 2017-03-10 20:54:51 +00:00
Josh Gao
6def9bd67c adb: properly erase destroyed jdwp_trackers.
std::remove_if moves to-be-removed elements to the end of the vector
and returns an iterator that must be .erased.

Bug: http://b/35772578
Test: mma
Change-Id: Idfe8520e176204ac5ce000c30704873a3ffe6c9c
2017-03-10 11:24:37 -08:00
Casey Dahlin
1b35c3f471 Merge changes from topic 'adb-mdnsd'
am: f4f95496ce

Change-Id: I1749f913b8c5cca64880d3eec3009f850bc9141e
2017-03-10 01:16:46 +00:00
Casey Dahlin
bd2c93fab0 Enable mDNS on Darwin
am: 304150a521

Change-Id: Id0d77614fc3bf580c2879b9ad801c77dcbfc7752
2017-03-10 01:16:31 +00:00
Casey Dahlin
cef0c7cf7d Don't include mDNS support on platforms other than Linux
am: d6c8091e9f

Change-Id: Ife0b6e08098c05288c3ea63e9063e5116335716a
2017-03-10 01:16:18 +00:00
Casey Dahlin
b298855764 Add mDNS device discovery for adb client
am: 13a269ea24

Change-Id: Ib5f80b3ccc9db7c6fe6f5c989e82083d734ce4df
2017-03-10 01:16:05 +00:00
Casey Dahlin
f18d33c2c6 adb: Set a hostname for mDNS
am: 1fe3cae67e

Change-Id: Iea8700ec13502e58774968cd7383255f769fa105
2017-03-10 01:15:49 +00:00
Casey Dahlin
cc9c92fa95 Make ADBD announce its presence over mDNS
am: 6cd5e0b4ef

Change-Id: Ida2f133f72087f291f2d34e968503ae81c3fbd50
2017-03-10 01:15:31 +00:00
Treehugger Robot
f4f95496ce Merge changes from topic 'adb-mdnsd'
* changes:
  Make ADB over mDNS work on Windows
  Enable mDNS on Darwin
  Don't include mDNS support on platforms other than Linux
  Add mDNS device discovery for adb client
  adb: Set a hostname for mDNS
  Make ADBD announce its presence over mDNS
2017-03-10 01:09:42 +00:00
Josh Gao
9d13bc2160 Merge "adb: append the libwinpthread COPYING to adb's NOTICE."
am: c1b3c8ef26

Change-Id: I4de6f83ea394635710b4e89cc1818233b6605eca
2017-03-09 07:48:01 +00:00
Josh Gao
d3bf1a8d7e adb: append the libwinpthread COPYING to adb's NOTICE.
We statically link libwinpthread into Windows binaries, but soong
currently can't specify notice files for toolchain_libraries. Add
libwinpthread's COPYING info directly to adb's as a hack.

Bug: http://b/36073965
Test: `make PRODUCT-sdk-win_sdk` + manual inspection of NOTICE.txt
Change-Id: I58d6be0ecf5626b67308f7e94128a2cd44dab161
2017-03-08 21:27:59 -08:00
Badhri Jagan Sridharan
a37bc179de Merge "adb: Do not signal gaget stack unless descriptors are written"
am: eab4c62e22

Change-Id: Ia04e413a6f3a0e3fcb1e8e52aa822accb808f1fb
2017-03-08 19:39:43 +00:00
Badhri Jagan Sridharan
43fd1a4ea7 adb: Do not signal gaget stack unless descriptors are written
While recovering from endpoint errors, the gadget stack was being
signalled even when desriptors were NOT being rewritten. Avoid this
as this might cause enumeration loops.

Bug: 36036550
Change-Id: Iff2b2fc8cded001ef3c77dc170dce3b96848970c
2017-03-07 19:20:54 -08:00
Casey Dahlin
304150a521 Enable mDNS on Darwin
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
2017-03-07 14:45:52 -08:00
Casey Dahlin
d6c8091e9f Don't include mDNS support on platforms other than Linux
Test: Shamu build now passes
Bug: None
(cherry picked from 122a7738606d854d6dc10fa361c1d7296cc9670a)

Change-Id: I650adf0bca96fb655163f5e9b27d9995ae448ec2
2017-03-07 14:45:52 -08:00
Casey Dahlin
2fe9b60475 Make ADB over mDNS work on Windows
Test: Verified ADB over mDNS on a Windows machine
Bug: 30482671
(cherry picked from 9fdd77101f49d03ff29342e12e23edf241f68522)

Change-Id: If955ca304db71a5b08c5a9654f1e27ab74af9af8
2017-03-07 14:45:52 -08:00
Casey Dahlin
13a269ea24 Add mDNS device discovery for adb client
Test: Was able to discover a raspberry pi.
Bug: 28074466
(cherry picked from e292cd16760321fccc99c8c261cb92fa4b6462ab)

Change-Id: Id9571576457a4a0a078e48a274a4e8eac78bfe2b
2017-03-07 14:45:51 -08:00
Casey Dahlin
1fe3cae67e adb: Set a hostname for mDNS
Now all devices won't appear as "Android." Should make it easier to
multiplex.

Test: Verified locally on a raspberry pi 3
Bug: 28887278
(cherry picked from 815b23319635d264ae0ce2c8c29a5776a57b8051)

Change-Id: Icfd0116477543af6a3049c14d818c1cff7fc3b93
2017-03-07 14:44:38 -08:00
Casey Dahlin
6cd5e0b4ef Make ADBD announce its presence over mDNS
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
2017-03-07 14:42:06 -08:00
Josh Gao
ef501512fa Merge "adb: turn on libusb by default."
am: 817b2f3b2c

Change-Id: Iaeefdcc45a5b96243b0b47822361d71c6e154b6e
2017-03-04 00:31:11 +00:00