Commit graph

2284 commits

Author SHA1 Message Date
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
Josh Gao
f2f0b31850 adb: turn on libusb by default.
Bug: http://b/31321337
Test: python test_device.py
Change-Id: Idb2ff1108331bf505feeeb943b6be7bb78124618
2017-03-02 13:23:56 -08:00
Bo Hu
8c35491151 Merge "DO NOT MERGE ANYWHERE Qemu-pipe: refactor qemu_pipe.h into libqemu_pipe" 2017-03-02 18:03:30 +00:00
bohu
294d44be33 DO NOT MERGE ANYWHERE Qemu-pipe: refactor qemu_pipe.h into libqemu_pipe
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
2017-03-01 16:33:44 -08:00
Colin Cross
58021d15c9 Move adb_dirname and adb_basename to libbase
adb already provides an implementation of dirname and basename that
take and produce std::strings, move it into libbase so it can be
used in the implementation of GetExecutableDirectory.

Test: out/host/linux-x86/nativetest64/adb_test/adb_test
Test: out/host/linux-x86/nativetest64/libbase_test/libbase_test
Test: adb shell /data/nativetest64/libbase_test/libbase_test64
Change-Id: Ideb1627607b14562121316d4ed27fa6fb0930684
2017-02-27 18:18:31 -08:00
Josh Gao
87eb0fc3d0 Merge "Revert "adb: remove win32 dependency on libwinpthread-1.dll."" 2017-02-24 21:02:25 +00:00
Sandeep Patil
f134fe07b8 adb: early-mount: fix verity toggle through adb for early mount
verity toggle through adb failed to work for early mount due to fstab
entries being moved into kernel/dt. This change fixes that by using the
new fs_mgr_read_fstab_default() api that will make sure all fstab
entries (from dt as well as from /fstab.{ro.hardware}) are combined
before returning the fstab object.

b/27805372

Test: early mount /system and /vendor on angler.
- test adb disable-verity && adb root to ensure rebooted instance
doesn't have 'partition.system.verified' property set. i.e. verity is
indeed disabled.

- test adb enable-verity && adb root to ensure rebooted instance does
have 'partition.system.verified' property set, i.e. verity is enabled.
also verified by trying to do 'adb remount' which correctly warns about
verity

Change-Id: Iffdcc0a0b959a65c326219bd4e9e41cba9ec7c88
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-23 16:48:52 -08:00
Josh Gao
3d4d973e82 Revert "adb: remove win32 dependency on libwinpthread-1.dll."
This reverts commit c2e984eec8.

Move the change to build/make, so that other win32 binaries get this as
well.
2017-02-23 13:16:52 -08:00
Josh Gao
5d1756ceb5 adb: add adb host-features, report libusb status.
Add a 'host-features' command to get the features of the currently
running host adb server. Abuse it to report libusb status.

Bug: http://b/34983123
Test: adb host-features; adb kill-server; ADB_LIBUSB=1 adb start-server; adb host-features
Change-Id: I0e8d503a2dbdff9002ebb6ce8a298498a9421422
2017-02-22 18:19:21 -08:00
Treehugger Robot
1d73abb443 Merge "adb: remove win32 dependency on libwinpthread-1.dll." 2017-02-22 02:06:40 +00:00
Josh Gao
c2e984eec8 adb: remove win32 dependency on libwinpthread-1.dll.
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
2017-02-21 15:30:11 -08:00
Jerry Zhang
f3fb7de3c8 adb: set max_rw to USB_FFS_BULK_SIZE explicitly
Sometimes when endpoint_alloc returns ENODEV,
max_rw will end up being a value that is too
big.

Bug: 35634401
Test: push/pull files
Change-Id: Iaa81a3311b1855e2a835562cdf7a46ff4399feb1
2017-02-21 14:37:07 -08:00
Elliott Hughes
9eb551868b adbd's children should have SIGPIPE set to SIG_DFL.
POSIX lets you choose whether or not SIGPIPE disposition is inherited,
and Linux chose "yes". Work around that.

Bug: http://b/35209888
Test: "ps -A | head" without the toybox workaround
Change-Id: I6b5afa3d87eb2af04b24c6c37fa338ab60ad2336
2017-02-17 11:14:33 -08:00