Commit graph

1732 commits

Author SHA1 Message Date
Ying Wang
3905db7616 Merge "Also archive adb.exe/fastboot.exe when building win_sdk." am: f666ba41a7
am: aa88fa5837

* commit 'aa88fa58371930b9b7aef8d942f72d7b9a29c8a7':
  Also archive adb.exe/fastboot.exe when building win_sdk.
2016-03-01 19:50:46 +00:00
Ying Wang
71edfc8b9a Also archive adb.exe/fastboot.exe when building win_sdk.
On linux we archive both Linux and Windows binaries.

Bug: 27315911
Change-Id: I17d25cd1ea611a9c917f1e78b47f21a8959eea20
2016-02-29 19:27:06 -08:00
David Pursell
56b3731203 Merge "adb: use TCP keepalive." am: e663c163ac
am: 89d749dbfc

* commit '89d749dbfc6f9f1544e59de1c1157fc1eadc205e':
  adb: use TCP keepalive.
2016-02-29 17:46:23 +00:00
David Pursell
e663c163ac Merge "adb: use TCP keepalive." 2016-02-29 17:43:35 +00:00
Josh Gao
e561a8bc4f Merge "adb: fix directory creation logic." am: a887c4faca
am: 8564dc9085

* commit '8564dc9085b9a8cccf4021a441f76b3af364d3ca':
  adb: fix directory creation logic.
2016-02-27 01:57:21 +00:00
Josh Gao
a887c4faca Merge "adb: fix directory creation logic." 2016-02-27 01:54:16 +00:00
Josh Gao
71728ca300 adb: fix directory creation logic.
Previously, for `adb pull $remote $local`, we would do the equivalent of
mkdir -p on `dirname $local`. This patch changes the behavior to only
creating directories that are being pulled, like scp.

Bug: http://b/27362811
Change-Id: I79f975ee9f2d9bc9e8be6a7c4f2de6d7ae2d2d23
2016-02-26 14:50:24 -08:00
Josh Gao
d3ff759988 Merge "adb: fix mistaken use of PLOG." am: a692f431d6
am: 95891e5a70

* commit '95891e5a70f9b0aed6332e92f9a3204b3e5b3d58':
  adb: fix mistaken use of PLOG.
2016-02-25 22:34:32 +00:00
Josh Gao
443a52c298 adb: fix mistaken use of PLOG.
Change-Id: I60bfa3d8cf1572a877d6f0c9369d8f72f10e5aef
2016-02-25 14:14:02 -08:00
Alex Klyubin
73c6fd1af2 Merge "Only debuggable packages can be downgraded." into nyc-dev
am: 8a67c09e7d

* commit '8a67c09e7d630ccecf8eb17463511dde2f16b548':
  Only debuggable packages can be downgraded.
2016-02-25 20:29:49 +00:00
Alex Klyubin
8a67c09e7d Merge "Only debuggable packages can be downgraded." into nyc-dev 2016-02-25 20:26:54 +00:00
Josh Gao
2eaa41a6df adb: fix leak of framework_fd.
Move the fdevent for the framework authentication connection out of
atransport into its own static variable in adb_auth_client, since its
lifetime is completely unrelated to that of the USB connection.

Bug: http://b/27297963
Change-Id: Ie6180d0b59d133120c5755e239e76ab33ed3cc1d
(cherry picked from commit 9f48611554)
2016-02-25 11:01:59 -08:00
Josh Gao
b6117c4397 adb: bail out if wait_for_device fails in send_shell_command.
Bug: http://b/27166186
Change-Id: Ib7e9d7e6b909d67a3af94c3517a6a0b54cf17db7
(cherry picked from commit f56c39194f)
2016-02-25 11:01:38 -08:00
Josh Gao
63b8571dce Merge "adb: bail out if wait_for_device fails in send_shell_command." am: 4e5b292299
am: 2b7f69d0f1

* commit '2b7f69d0f1bdaa60d52e6841f2bda52506ab5ad2':
  adb: bail out if wait_for_device fails in send_shell_command.
2016-02-25 18:48:30 +00:00
Josh Gao
e0ed0f0608 Merge "adb: fix leak of framework_fd." am: 77dc40f2fa
am: 2ea5bf7b55

* commit '2ea5bf7b551799468a1f5378a2f82412db81a4c2':
  adb: fix leak of framework_fd.
2016-02-25 18:48:22 +00:00
Josh Gao
4e5b292299 Merge "adb: bail out if wait_for_device fails in send_shell_command." 2016-02-25 18:43:42 +00:00
Josh Gao
77dc40f2fa Merge "adb: fix leak of framework_fd." 2016-02-25 18:43:34 +00:00
Josh Gao
9f48611554 adb: fix leak of framework_fd.
Move the fdevent for the framework authentication connection out of
atransport into its own static variable in adb_auth_client, since its
lifetime is completely unrelated to that of the USB connection.

Bug: http://b/27297963
Change-Id: Ie6180d0b59d133120c5755e239e76ab33ed3cc1d
2016-02-24 17:56:12 -08:00
Alex Klyubin
85ed97518c Only debuggable packages can be downgraded.
This reflects the change in PackageManager service:
frameworks/base commit 921dd754ab49df0cd580ff96503f7616c4c85f4a.

Bug: 27327503
Change-Id: Ifcc7268cd271640417b8cfc9db81ea954b491cb1
2016-02-24 16:07:47 -08:00
Josh Gao
f56c39194f adb: bail out if wait_for_device fails in send_shell_command.
Bug: http://b/27166186
Change-Id: Ib7e9d7e6b909d67a3af94c3517a6a0b54cf17db7
2016-02-24 15:22:14 -08:00
Jorge Lucangeli Obes
48a1b15db1 Merge "adbd: Remove explicit capability bounding set code." am: d458730b64
am: c41b28b8bc

* commit 'c41b28b8bc03526b6ec6ec19a6d6a26ffb493a5b':
  adbd: Remove explicit capability bounding set code.
2016-02-24 22:28:25 +00:00
Jorge Lucangeli Obes
d458730b64 Merge "adbd: Remove explicit capability bounding set code." 2016-02-24 22:13:09 +00:00
Dan Willemsen
ed1d7aeee4 Remove duplicate fdevent.cpp entry
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
(cherry picked from commit 582c8fe1d4)
2016-02-24 12:14:48 -08:00
Dan Willemsen
eafc2fdc7d Merge "Remove duplicate fdevent.cpp entry" am: 978cda5cc6
am: 1fa1791a04

* commit '1fa1791a04f03e9d3a58e599233051b94cfa08a3':
  Remove duplicate fdevent.cpp entry
2016-02-24 00:19:47 +00:00
Dan Willemsen
582c8fe1d4 Remove duplicate fdevent.cpp entry
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
2016-02-23 14:28:20 -08:00
Jorge Lucangeli Obes
4d186ad964 adbd: Remove explicit capability bounding set code.
Minijail supports dropping capabilities from the bounding set.
Use that code instead.

This cleans up one small loose end in the work started with
https://android-review.googlesource.com/#/c/187775/

Final diff: fewer lines, more unit-tested code.
"""
$ git diff --stat 52cf4fa6aa3e8d13f61b1 adb/daemon/main.cpp
 adb/daemon/main.cpp | 56
 1 file changed, 27 insertions(+), 29 deletions(-)
"""

Bug: 27314096
Change-Id: I238975920b85fae376522eb26f5ad6d9fee0762a
2016-02-23 13:39:11 -08:00
David Pursell
bfd9503d1d adb: use TCP keepalive.
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
2016-02-23 09:11:18 -08:00
Josh Gao
fa3e0bc67f adb: sysdeps_test: improve smoke test.
Make sure that adb_poll sets revents for all of the structs passed in.
Also, zero initialize all of the adb_pollfd structs in the tests.

Change-Id: Ia639679a7e6f77483655f1552e89081c4673aa87
(cherry picked from commit 2275f7da73)
2016-02-22 15:57:09 -08:00
Josh Gao
da8119596f adb: check for an error response from adbd between each write.
When sending a file, do a 0-timeout poll to check to see if an error has
occurred, so that we can immediately report failure.

Bug: http://b/26816782
Change-Id: I4a8aa8408a36940bfda7b0ecfa5d13755f4aa14d
(cherry picked from commit afcdcd703e)
2016-02-22 15:57:09 -08:00
Josh Gao
4d74811cd4 adbd: restore the old error handling behavior.
Restore the previous file sync error handling behavior of reporting
failure, and then consuming packets from the other end until receiving a
DONE packet.

Bug: http://b/26816782
Change-Id: I9708f2a36c072547e191fa0b6b42dffc31f8a2f2
(cherry picked from commit 20a96c7d79)
2016-02-22 15:57:09 -08:00
Josh Gao
8d68591c46 adb: change unsigned to uint32_t in sync struct definitions.
Change-Id: I9757ab853cfad1a2e1393ef32bcab222ab84acef
(cherry picked from commit 69469c4e9f)
2016-02-22 15:57:09 -08:00
Josh Gao
cd2039e484 adb: detect when the client disconnects in wait-for-device.
Avoid leaking a thread and its associated resources when a user cancels
wait-for-device.

Bug: http://b/26966721
Bug: https://code.google.com/p/android/issues/detail?id=199088
Change-Id: Idac80a24e9739ddd24e500fe14826a78f350c018
(cherry picked from commit 09855472f4)
2016-02-22 15:57:08 -08:00
Josh Gao
b582fa3bd8 adb: make fdevent_test, socket_test compile on Windows.
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
(cherry picked from commit 022d447e9e)
2016-02-22 15:57:08 -08:00
Josh Gao
c1d252bec2 adb: add fd exhaustion test, fix errno reporting in sysdeps_win32.
Add a test for FD exhaustion, and fix cases where we weren't properly
setting errno.

Change-Id: I486055bb9ead31089ce76b210c11de9e973f3256
(cherry picked from commit 6487e74a59)
2016-02-22 15:57:08 -08:00
Josh Gao
8443fd994a adb: move win32 fd base to 2048, fix fd allocation.
Windows has a maximum fd limit of 2048, so we can avoid collision with
real file descriptors by starting from there. Also, fds would be
previously be allocated by a linear walk from the last allocated FD,
instead of the lowest available FD, as required by POSIX. Keep track of
the lowest available file descriptor to make things feel more familiar.

Change-Id: Id6ac1c54f4f7964a6cdfa8d3f4f96262e4881964
(cherry picked from commit b6232b96dd)
2016-02-22 15:57:08 -08:00
Josh Gao
addab3d84d adb: don't emulate fdevent or socketpair on Windows.
Change-Id: I16cf7d4427eb79f36db39e91f85402a268fa72f5
(cherry picked from commit 3777d2ecc0)
2016-02-22 15:57:08 -08:00
Josh Gao
0b57ef735a adb: fix clang-format for access modifier dedent.
It was previously -1 (the default from Google style, since it uses 2
space indentation), instead of -2.

Change-Id: I1865505ce17a2cc13b85de58bda55c3b1dfcf08c
(cherry picked from commit 5da522ec45)
2016-02-22 15:57:08 -08:00
Dimitry Ivanov
8b642e42b4 Add missing liblog dependency
Bug: http://b/27171986
Change-Id: Ia7f03c72de9a8e5d61896bde6b4b1af396376f54
(cherry picked from commit 01f21da732)
2016-02-22 15:57:08 -08:00
Josh Gao
2674cd922e adb: sysdeps_win32: actually change ExitThread to _endthreadex.
Forgot to amend this into b5fea14e.

Change-Id: Id04e639eb87043901681db789d7a7925300fa867
(cherry picked from commit d7b3749202)
2016-02-22 15:57:08 -08:00
Josh Gao
d9db09c315 adb: make adb_thread_func_t return void, add adb_thread_exit.
Windows restricts the return value of threads to 32-bits, even on 64-bit
platforms. Since we don't actually return meaningful values from thread,
resolve this inconsistency with POSIX by making adb's thread abstraction
only take void functions.

Change-Id: I5c23b4432314f13bf16d606fd5e6b6b7b6ef98b5
(cherry picked from commit b5fea14e13)
2016-02-22 15:57:08 -08:00
Josh Gao
7e76c89544 adb: redact reference to secret internal time machine.
Change-Id: Ic6744cc7c858576d7e6172460b32902e007b6fd3
(cherry picked from commit 6b42a2bfd5)
2016-02-22 15:57:08 -08:00
Spencer Low
a1071c6924 adb: mkdirs fixes
Fix pathological case where the directory to be created can't be created
because there is already a file there. This was previously returning
success because the wrong var was passed to directory_exists().

Fix test to exercise this situation. Also clarify tests.

Change-Id: I0dc0f14084e0eda4e1498874d4ab2a6445d322ac
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
(cherry picked from commit 85c45bd5a1)
2016-02-22 15:57:08 -08:00
Josh Gao
d302a15a60 adb: sysdeps: add support for joining threads.
Bug: http://b/27105824
Change-Id: I44e4edbb2a59565c35f1f3e6a6394ac258591f95
(cherry picked from commit 3b3e10d046)
2016-02-22 15:57:08 -08:00
Josh Gao
32a2b60c4e adb: allow wine's output for sysdeps_win32 strerror test.
Change-Id: Ia5d04a2347df1bcd8c7efcc1da9cec9725007a58
(cherry picked from commit 22554c9167)
2016-02-22 15:57:08 -08:00
Yabin Cui
65f7080c66 adb: setsid() for adb host server.
To create a daemon for adb host server, we should call setsid()
for the daemon process. However, previously we call setsid() for
the adb client process, which results in nothing but EPERM error.

Bug: 26982628
Change-Id: I2763ae3d5a243706927d7ef6af5095138c0ce2d8
(cherry picked from commit 6bf323b97a)
2016-02-22 15:57:08 -08:00
Josh Gao
9ad736a637 adb: make ctrl-c when spawning a daemon not kill the daemon.
Previously, using ctrl-c in a command that needs to spawn a daemon
because one isn't already available would kill the daemon along with the
foreground process.

Bug: http://b/26982628
Change-Id: I7fefc531c3e4895423e7b466322b5426d01dc9ef
(cherry picked from commit b72b3f8c92)
2016-02-22 15:57:08 -08:00
Josh Gao
db262ffa62 adb: fix mkdirs test.
The behavior of mkdirs was changed a while ago, without updating the
test.

Change-Id: I2aaa73818933b281e911c42a14e3c843d8bd972a
(cherry picked from commit 1172b2ec71)
2016-02-22 15:57:07 -08:00
Josh Gao
3b1c31c216 Merge "adb: sysdeps_test: improve smoke test." am: 0fc006685c
am: 2975a58f3c

* commit '2975a58f3c9ec1a76b9b3e975827d15b3e24eac3':
  adb: sysdeps_test: improve smoke test.
2016-02-20 02:46:11 +00:00
Josh Gao
2275f7da73 adb: sysdeps_test: improve smoke test.
Make sure that adb_poll sets revents for all of the structs passed in.
Also, zero initialize all of the adb_pollfd structs in the tests.

Change-Id: Ia639679a7e6f77483655f1552e89081c4673aa87
2016-02-19 18:36:09 -08:00
Josh Gao
98ab5c1dc8 Merge changes I4a8aa840,I9708f2a3 am: 44b08c722d
am: fe07481ff9

* commit 'fe07481ff944cde33e6546579f83755000453e63':
  adb: check for an error response from adbd between each write.
  adbd: restore the old error handling behavior.
2016-02-20 02:33:46 +00:00