Commit graph

1975 commits

Author SHA1 Message Date
Elliott Hughes
34e560b9a1 Fix buffer overrun in adb wait-for-device.
Bug: http://b/27444063
Change-Id: I72339d7215aae28069484b9796d71fe0c53dff96
2016-03-10 17:59:17 -08:00
Prathmesh Prabhu
d387acc9b8 emulator: Use distinct serial names for simultaneous qemu pipes.
ADB local transport for the emulator based on qemu pipes uses a socket
transport. Before this CL, multiple connection requests accepted by the
qemu pipe device would result in ADB transport with the same serial.
The register function would fail as a result, and all subsequent
connections would fail.

Test:
while true; do adb kill-server; adb devices; done
Doesn't fail for > 10 minutes.

This CL replaces an earlier CL
(I0fdcf2694516151c5f8f8e1580648b940679c981) that was unsafe for real
devices.

BUG=27441661

Change-Id: I7d801b175f3bee10fc7e0ab1b12d5623984371b9
2016-03-10 09:26:49 -08:00
Prathmesh Prabhu
f7b6d9cea9 Merge "emulator: Use distinct serial names for simultaneous qemu pipes." into nyc-dev
am: 01d76eb1ec

* commit '01d76eb1ecb943db042eb6618087c0e22588e6b3':
  emulator: Use distinct serial names for simultaneous qemu pipes.
2016-03-10 17:16:46 +00:00
Prathmesh Prabhu
01d76eb1ec Merge "emulator: Use distinct serial names for simultaneous qemu pipes." into nyc-dev 2016-03-10 17:13:26 +00:00
Prathmesh Prabhu
251d46e68a emulator: Use distinct serial names for simultaneous qemu pipes.
ADB local transport for the emulator based on qemu pipes uses a socket
transport. Before this CL, multiple connection requests accepted by the
qemu pipe device would result in ADB transport with the same serial.
The register function would fail as a result, and all subsequent
connections would fail.

Test:
while true; do adb kill-server; adb devices; done
Doesn't fail for > 10 minutes.

This CL replaces an earlier CL
(I0fdcf2694516151c5f8f8e1580648b940679c981) that was unsafe for real
devices.

BUG=27441661

Change-Id: I7d801b175f3bee10fc7e0ab1b12d5623984371b9
2016-03-09 13:51:30 -08:00
Josh Gao
8238dd8499 adbd: fix spurious close of uninitialized fd.
forkpty only returns an fd on the master side; trying to keep track of
it on both sides is incorrect.

Bug: http://b/27504427
Change-Id: Ia4a454d8490c77738f9c3350a4236b3d99c8758b
(cherry picked from commit fcb063ce37)
2016-03-04 19:15:11 -08:00
Josh Gao
5767d0dd5a adb: wait for restore to complete before returning.
If we return before waiting for the other side to finish, it'll get sent
SIGHUP.

Bug: http://b/27414382
Change-Id: I93514d2242ed0d7aa93a6ec6836270dc0783506d
(cherry picked from commit d26abed750)
2016-03-04 19:15:11 -08:00
Josh Gao
06c73ae942 adb: wait for adbd to die and respawn in root/unroot.
Bug: http://b/19749057
Change-Id: I57dbc113803b6fd3016c1801410be0f4023245d9
(cherry picked from commit d26212207d)
2016-03-04 19:15:11 -08:00
Josh Gao
a9eb38d6a5 adb: make ScopedFd universally accessible and useful.
Change-Id: I707ffbd10958e7449b4c95dff48638480c746939
(cherry picked from commit f0d3b4fc11)
2016-03-04 19:15:11 -08:00
Josh Gao
3bb90a6acd Merge changes I93514d22,I57dbc113,I707ffbd1 am: 1cd680ce75
am: 6aafa03c60

* commit '6aafa03c606d06a5cb6549c1cc382a2038552256':
  adb: wait for restore to complete before returning.
  adb: wait for adbd to die and respawn in root/unroot.
  adb: make ScopedFd universally accessible and useful.
2016-03-05 03:10:45 +00:00
Josh Gao
f5b960538f Merge "adbd: fix spurious close of uninitialized fd." am: 3c608c7425
am: 97b9935fba

* commit '97b9935fba43cfa892ef4ae2792a68c276b6f128':
  adbd: fix spurious close of uninitialized fd.
2016-03-05 03:10:35 +00:00
Josh Gao
1cd680ce75 Merge changes I93514d22,I57dbc113,I707ffbd1
* changes:
  adb: wait for restore to complete before returning.
  adb: wait for adbd to die and respawn in root/unroot.
  adb: make ScopedFd universally accessible and useful.
2016-03-05 03:04:47 +00:00
Josh Gao
fcb063ce37 adbd: fix spurious close of uninitialized fd.
forkpty only returns an fd on the master side; trying to keep track of
it on both sides is incorrect.

Bug: http://b/27504427
Change-Id: Ia4a454d8490c77738f9c3350a4236b3d99c8758b
2016-03-04 18:08:18 -08:00
Josh Gao
d26abed750 adb: wait for restore to complete before returning.
If we return before waiting for the other side to finish, it'll get sent
SIGHUP.

Bug: http://b/27414382
Change-Id: I93514d2242ed0d7aa93a6ec6836270dc0783506d
2016-03-04 15:51:03 -08:00
Josh Gao
d26212207d adb: wait for adbd to die and respawn in root/unroot.
Bug: http://b/19749057
Change-Id: I57dbc113803b6fd3016c1801410be0f4023245d9
2016-03-04 15:48:39 -08:00
Josh Gao
f0d3b4fc11 adb: make ScopedFd universally accessible and useful.
Change-Id: I707ffbd10958e7449b4c95dff48638480c746939
2016-03-04 15:15:56 -08:00
Josh Gao
a996c2963a adb: clean up quotes in test_device.py.
Change-Id: I7fe7724578ad89a004665d1bbff0d5c02c34c35e
(cherry picked from commit 255c5c8077)
2016-03-03 15:46:51 -08:00
Josh Gao
379612b128 adb: mkdir the correct directory name when pulling.
The directory name should be based off of the local path, not the remote
path.

Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb
(cherry picked from commit 89ec3a8d0f)
2016-03-03 15:46:51 -08:00
Josh Gao
48bc0d7853 adb: cleanup file skipping logic.
Bug: http://b/26355212
Change-Id: Iafa250ce6c5ea8da9f5f00125165e5b67ef1013f
(cherry picked from commit a31ea55c55)
2016-03-03 15:46:51 -08:00
Josh Gao
74e0fe73c0 adb: symlinks to dirs count as dirs for pull destination.
This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.

Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
(cherry picked from commit 1e611a33d5)
2016-03-03 15:46:50 -08:00
David Pursell
802c54ebb7 adb: relax serial matching rules.
Currently targeting a device by serial requires matching the serial
number exactly. This CL relaxes the matching rules for local transports
to ignore protocol prefixes and make the port optional:
  [tcp:|udp:]<hostname>[:port]

The purpose of this is to allow a user to set ANDROID_SERIAL to
something like "tcp:100.100.100.100" and have it work for both fastboot
and adb (assuming the device comes up at 100.100.100.100 in both
modes).

This CL also adds some unit tests for the modified functions to make
sure they work as expected.

Bug: 27340240
Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
(cherry picked from commit 3f902aad5b)
2016-03-03 15:46:50 -08:00
Josh Gao
f22bc60fc9 adb: report progress for small files.
Bug: http://b/27407725
Change-Id: I7515144402a487fb3d4d403e2f5f82423c1b5ed6
(cherry picked from commit 9fd2f77dcc)
2016-03-03 15:46:50 -08:00
Ying Wang
f48503b4a0 Also archive adb.exe/fastboot.exe when building win_sdk.
On linux we archive both Linux and Windows binaries.

Bug: 27315911
Change-Id: I17d25cd1ea611a9c917f1e78b47f21a8959eea20
(cherry picked from commit 71edfc8b9a)
2016-03-03 15:46:50 -08:00
Josh Gao
a63b17f76c 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
(cherry picked from commit 71728ca300)
2016-03-03 15:46:50 -08:00
Josh Gao
d382d2bb51 adb: fix mistaken use of PLOG.
Change-Id: I60bfa3d8cf1572a877d6f0c9369d8f72f10e5aef
(cherry picked from commit 443a52c298)
2016-03-03 15:46:50 -08:00
Josh Gao
1f6ff07516 Merge changes I7fe77245,I75b089b8,Iafa250ce am: afa76a3028
am: 55592371dc

* commit '55592371dca3ccb25d516635b41bab73ed8b6059':
  adb: clean up quotes in test_device.py.
  adb: mkdir the correct directory name when pulling.
  adb: cleanup file skipping logic.
2016-03-03 23:45:58 +00:00
David Pursell
a76e5f035e 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
(cherry picked from commit bfd9503d1d)
2016-03-03 15:42:11 -08:00
Josh Gao
afa76a3028 Merge changes I7fe77245,I75b089b8,Iafa250ce
* changes:
  adb: clean up quotes in test_device.py.
  adb: mkdir the correct directory name when pulling.
  adb: cleanup file skipping logic.
2016-03-03 23:39:05 +00:00
Josh Gao
255c5c8077 adb: clean up quotes in test_device.py.
Change-Id: I7fe7724578ad89a004665d1bbff0d5c02c34c35e
2016-03-03 14:53:52 -08:00
Josh Gao
89ec3a8d0f adb: mkdir the correct directory name when pulling.
The directory name should be based off of the local path, not the remote
path.

Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb
2016-03-03 14:53:06 -08:00
Josh Gao
a31ea55c55 adb: cleanup file skipping logic.
Bug: http://b/26355212
Change-Id: Iafa250ce6c5ea8da9f5f00125165e5b67ef1013f
2016-03-03 14:40:03 -08:00
David Pursell
29f8993098 Merge "adb: relax serial matching rules." am: b4709c2cfd
am: a942881fdb

* commit 'a942881fdb8925373a8b8756301fa3a4d92cf174':
  adb: relax serial matching rules.
2016-03-03 16:57:44 +00:00
David Pursell
b4709c2cfd Merge "adb: relax serial matching rules." 2016-03-03 16:44:58 +00:00
Josh Gao
7f766bc87b Merge "adb: symlinks to dirs count as dirs for pull destination." am: 543093cb97
am: 3b198fd8bb

* commit '3b198fd8bbbbb783f07e3cbd7c78973e94119534':
  adb: symlinks to dirs count as dirs for pull destination.
2016-03-03 01:40:17 +00:00
Josh Gao
543093cb97 Merge "adb: symlinks to dirs count as dirs for pull destination." 2016-03-03 00:36:22 +00:00
Josh Gao
1e611a33d5 adb: symlinks to dirs count as dirs for pull destination.
This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.

Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
2016-03-02 15:29:02 -08:00
David Pursell
3f902aad5b adb: relax serial matching rules.
Currently targeting a device by serial requires matching the serial
number exactly. This CL relaxes the matching rules for local transports
to ignore protocol prefixes and make the port optional:
  [tcp:|udp:]<hostname>[:port]

The purpose of this is to allow a user to set ANDROID_SERIAL to
something like "tcp:100.100.100.100" and have it work for both fastboot
and adb (assuming the device comes up at 100.100.100.100 in both
modes).

This CL also adds some unit tests for the modified functions to make
sure they work as expected.

Bug: 27340240
Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
2016-03-02 12:54:58 -08:00
bohu
32e55d70c4 Merge "Emulator: fix adbd qemu pipe partial write" am: ae607e149b
am: 4cc3354fb7

* commit '4cc3354fb75363cc8107162f338bc3872c22550c':
  Emulator: fix adbd qemu pipe partial write
2016-03-02 01:55:44 +00:00
bohu
8ac1b044af Emulator: fix adbd qemu pipe partial write
It does happens that the adb_write only writes to the
qemu pipe partially which throws host side's adb backend
into confusion and crashes.

This CL replaces adb_write with WriteFdExactly;
adb_read with ReadFdExactly.

(cherry picked from commit f66c5938be)

Change-Id: I684f5df79b1e3f00b4b7a2452c2712a73c15973c
2016-03-01 17:39:31 -08:00
Bo Hu
ae607e149b Merge "Emulator: fix adbd qemu pipe partial write" 2016-03-02 01:35:33 +00:00
bohu
f66c5938be Emulator: fix adbd qemu pipe partial write
It does happens that the adb_write only writes to the
qemu pipe partially which throws host side's adb backend
into confusion and crashes.

This CL replaces adb_write with WriteFdExactly;
adb_read with ReadFdExactly.

Change-Id: I10424ad730c73516d16b0eb7318e8c9beea9b36b
2016-03-01 17:33:57 -08:00
Josh Gao
b012c1cb1f Merge "adb: report progress for small files." am: 4c87588fa2
am: d799184236

* commit 'd799184236e8a63310f21d1509e656f9322ee300':
  adb: report progress for small files.
2016-03-01 20:38:41 +00:00
Josh Gao
9fd2f77dcc adb: report progress for small files.
Bug: http://b/27407725
Change-Id: I7515144402a487fb3d4d403e2f5f82423c1b5ed6
2016-03-01 11:52:55 -08:00
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
Josh Gao
44b08c722d Merge changes I4a8aa840,I9708f2a3
* changes:
  adb: check for an error response from adbd between each write.
  adbd: restore the old error handling behavior.
2016-02-20 02:28:22 +00:00
Josh Gao
3f8e3b79c6 Merge changes I9757ab85,Idac80a24 am: 2e70b2d5d8
am: 0640b14df2

* commit '0640b14df292cf48fc3aaee2058908c88cfc0419':
  adb: change unsigned to uint32_t in sync struct definitions.
  adb: detect when the client disconnects in wait-for-device.
2016-02-20 02:17:00 +00:00
Josh Gao
2e70b2d5d8 Merge changes I9757ab85,Idac80a24
* changes:
  adb: change unsigned to uint32_t in sync struct definitions.
  adb: detect when the client disconnects in wait-for-device.
2016-02-20 02:11:07 +00:00
Josh Gao
afcdcd703e 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
2016-02-19 18:01:09 -08:00
Josh Gao
20a96c7d79 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
2016-02-19 18:01:09 -08:00
Josh Gao
8a907122f8 Merge changes I6541bb13,I486055bb,Id6ac1c54,I16cf7d44 am: 4a9084228a
am: 38d258ef70

* commit '38d258ef7005d0ac336e8571d72c092df6d42606':
  adb: make fdevent_test, socket_test compile on Windows.
  adb: add fd exhaustion test, fix errno reporting in sysdeps_win32.
  adb: move win32 fd base to 2048, fix fd allocation.
  adb: don't emulate fdevent or socketpair on Windows.
2016-02-20 01:48:29 +00:00
Josh Gao
4a9084228a Merge changes I6541bb13,I486055bb,Id6ac1c54,I16cf7d44
* changes:
  adb: make fdevent_test, socket_test compile on Windows.
  adb: add fd exhaustion test, fix errno reporting in sysdeps_win32.
  adb: move win32 fd base to 2048, fix fd allocation.
  adb: don't emulate fdevent or socketpair on Windows.
2016-02-20 01:41:09 +00:00
Josh Gao
69469c4e9f adb: change unsigned to uint32_t in sync struct definitions.
Change-Id: I9757ab853cfad1a2e1393ef32bcab222ab84acef
2016-02-19 14:37:04 -08:00
Josh Gao
09855472f4 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
2016-02-19 14:35:48 -08:00
Josh Gao
022d447e9e 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
2016-02-19 11:24:51 -08:00
Josh Gao
6487e74a59 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
2016-02-19 11:24:51 -08:00
Josh Gao
b6232b96dd 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
2016-02-19 11:24:51 -08:00
Josh Gao
3777d2ecc0 adb: don't emulate fdevent or socketpair on Windows.
Change-Id: I16cf7d4427eb79f36db39e91f85402a268fa72f5
2016-02-19 11:24:51 -08:00
Josh Gao
cc5b2c737b Merge "adb: fix clang-format for access modifier dedent." am: d5126ddf71
am: 728da79e9c

* commit '728da79e9c973f02c97847ed49b81d0d3018484f':
  adb: fix clang-format for access modifier dedent.
2016-02-18 23:44:15 +00:00
Josh Gao
d5126ddf71 Merge "adb: fix clang-format for access modifier dedent." 2016-02-18 23:00:51 +00:00
Josh Gao
5da522ec45 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
2016-02-18 14:52:07 -08:00
Dimitry Ivanov
d362cc5da9 Merge "Add missing liblog dependency"
am: 8b68829c06

* commit '8b68829c06bf6acaae20d632d7f210c58692f73e':
  Add missing liblog dependency
2016-02-13 04:58:45 +00:00
Dimitry Ivanov
01f21da732 Add missing liblog dependency
Bug: http://b/27171986
Change-Id: Ia7f03c72de9a8e5d61896bde6b4b1af396376f54
2016-02-12 18:40:29 -08:00
Josh Gao
731b519cbf Merge "adb: sysdeps_win32: actually change ExitThread to _endthreadex."
am: 519f9aea43

* commit '519f9aea436b957371061544da380cebc2cafb96':
  adb: sysdeps_win32: actually change ExitThread to _endthreadex.
2016-02-13 00:13:23 +00:00
Josh Gao
1c98db1ab1 Merge "adb: make adb_thread_func_t return void, add adb_thread_exit."
am: 69c81c75df

* commit '69c81c75df2e196aea679d24464a68233dcb5393':
  adb: make adb_thread_func_t return void, add adb_thread_exit.
2016-02-13 00:12:50 +00:00
Josh Gao
d7b3749202 adb: sysdeps_win32: actually change ExitThread to _endthreadex.
Forgot to amend this into b5fea14e.

Change-Id: Id04e639eb87043901681db789d7a7925300fa867
2016-02-12 15:47:19 -08:00
Josh Gao
69c81c75df Merge "adb: make adb_thread_func_t return void, add adb_thread_exit." 2016-02-12 23:42:49 +00:00
Josh Gao
0a508d35e7 Merge "adb: mkdirs fixes"
am: 7fea044de9

* commit '7fea044de9c7c941360b7af5efff79d2e8e98e37':
  adb: mkdirs fixes
2016-02-12 23:29:59 +00:00
Josh Gao
b5fea14e13 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
2016-02-12 15:23:54 -08:00
Josh Gao
7fea044de9 Merge "adb: mkdirs fixes" 2016-02-12 23:18:36 +00:00
Josh Gao
2c54fa5460 Merge "adb: redact reference to secret internal time machine."
am: e8a974091a

* commit 'e8a974091ae5d8846d6f326f7430e84f90782d2e':
  adb: redact reference to secret internal time machine.
2016-02-12 19:58:39 +00:00
Josh Gao
6b42a2bfd5 adb: redact reference to secret internal time machine.
Change-Id: Ic6744cc7c858576d7e6172460b32902e007b6fd3
2016-02-12 11:33:53 -08:00
Josh Gao
90c9c6ce15 Merge "adb: sysdeps: add support for joining threads."
am: dda68c0fcf

* commit 'dda68c0fcfe4ced4ae410821c7681f02a2b9aff2':
  adb: sysdeps: add support for joining threads.
2016-02-11 01:32:05 +00:00
Josh Gao
dda68c0fcf Merge "adb: sysdeps: add support for joining threads." 2016-02-11 01:10:12 +00:00
Spencer Low
85c45bd5a1 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>
2016-02-10 15:03:50 -08:00
Josh Gao
3b3e10d046 adb: sysdeps: add support for joining threads.
Bug: http://b/27105824
Change-Id: I44e4edbb2a59565c35f1f3e6a6394ac258591f95
2016-02-10 14:22:58 -08:00
Josh Gao
b3a6e343fb Merge "adb: allow wine\'s output for sysdeps_win32 strerror test."
am: 76d3308dd2

* commit '76d3308dd27a73e7ec0617f8438d24d0165a2d01':
  adb: allow wine's output for sysdeps_win32 strerror test.
2016-02-10 21:50:33 +00:00
Josh Gao
76d3308dd2 Merge "adb: allow wine's output for sysdeps_win32 strerror test." 2016-02-10 21:39:31 +00:00
Josh Gao
22554c9167 adb: allow wine's output for sysdeps_win32 strerror test.
Change-Id: Ia5d04a2347df1bcd8c7efcc1da9cec9725007a58
2016-02-10 13:38:32 -08:00
Yabin Cui
617fe1eb6d Merge "adb: setsid() for adb host server."
am: 250f5956d6

* commit '250f5956d69c87ab573d4593951616997c3317c0':
  adb: setsid() for adb host server.
2016-02-10 06:22:58 +00:00
Yabin Cui
6bf323b97a 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
2016-02-09 16:15:56 -08:00
Josh Gao
13aba88488 Merge "adb: make ctrl-c when spawning a daemon not kill the daemon."
am: b2803b5060

* commit 'b2803b5060b3a790277bf17a97651c30102a183a':
  adb: make ctrl-c when spawning a daemon not kill the daemon.
2016-02-09 01:13:46 +00:00
Josh Gao
cba3b1888e Merge "adb: fix mkdirs test."
am: 1a34944cde

* commit '1a34944cde5c8241bb74cde992d09f9115d5b53a':
  adb: fix mkdirs test.
2016-02-09 01:10:04 +00:00
Josh Gao
b2803b5060 Merge "adb: make ctrl-c when spawning a daemon not kill the daemon." 2016-02-09 01:05:18 +00:00
Josh Gao
b72b3f8c92 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
2016-02-08 16:59:10 -08:00
Josh Gao
1172b2ec71 adb: fix mkdirs test.
The behavior of mkdirs was changed a while ago, without updating the
test.

Change-Id: I2aaa73818933b281e911c42a14e3c843d8bd972a
2016-02-08 11:22:50 -08:00
Josh Gao
3a45f945c7 Merge "adb: don\'t append a slash to a path that already ends with one." am: aae1eb2c4f
am: 4b09d2f084

* commit '4b09d2f084dfe2df3314a10c59090be2c97b9a9e':
  adb: don't append a slash to a path that already ends with one.
2016-02-04 02:35:31 +00:00
Elliott Hughes
2b012f2059 Merge "adb: win32: fix start-server to properly display UTF-8 on the console" am: 1617dd4fe9
am: 89df186cda

* commit '89df186cdab8eb21c7610de9a8348b6f050543d7':
  adb: win32: fix start-server to properly display UTF-8 on the console
2016-02-04 02:35:25 +00:00
Josh Gao
d8e0108418 Merge "adb: report subprocess creation errors to the client." am: 7aa7a81eb1
am: 046bf3b212

* commit '046bf3b212e9a01c3f2671c208ae3bfc8fdcd62b':
  adb: report subprocess creation errors to the client.
2016-02-04 02:35:12 +00:00
Josh Gao
6832ddbc98 Merge "adb: fix mistaken uses of SendFail in file_sync_service.cpp." am: 2d2185ee09
am: f2610942ef

* commit 'f2610942efca1857c377df4f427ffaa3eefe65e8':
  adb: fix mistaken uses of SendFail in file_sync_service.cpp.
2016-02-04 02:35:06 +00:00
Josh Gao
aae1eb2c4f Merge "adb: don't append a slash to a path that already ends with one." 2016-02-04 00:36:32 +00:00
Spencer Low
53a0a99fe8 adb: win32: fix start-server to properly display UTF-8 on the console
fwrite() is a macro that maps to adb_fwrite(), which can write UTF-8 to
the console. Use it to write the output that comes from the subprocess
adb server.

To do this, dup the stdout/stderr file descriptor and make a duplicate
FILE* stream, in binary mode (since we're reading raw bytes from the
subprocess), and unbuffered.

Change-Id: I480761bae0bd576dc9e03fa4d31266f4e49635ed
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2016-02-03 16:24:37 -08:00
Josh Gao
323899b6d3 adb: don't append a slash to a path that already ends with one.
Bug: http://b/26964908
Change-Id: I1fbd752fd97f5414a306b46f7bfce3373362f8b3
2016-02-03 16:24:13 -08:00
Josh Gao
4323507a7e adb: report subprocess creation errors to the client.
Bug: http://b/26589627
Change-Id: I38e7a33ea8274f0eb47dc0ed87fcbca08a0ab22a
2016-02-03 15:52:07 -08:00
Josh Gao
6ad06b9ea9 adb: fix mistaken uses of SendFail in file_sync_service.cpp.
SendFail and SendSyncFail are similarly named, and have the same
prototype. Use `#pragma GCC poison` to prevent use of SendFail in
file_sync_service.cpp, and fix the places where it was used
accidentally.

Change-Id: I6b9a7e565b76dfab10f8ae38f889d046ad80a403
2016-02-03 23:50:32 +00:00
David Pursell
fc04da8540 Merge "adb: win32: handle incomplete UTF-8 in console output, other fixes" am: 85c65dab42
am: 8467ab758c

* commit '8467ab758ccc99391dddfc875377052d89f46697':
  adb: win32: handle incomplete UTF-8 in console output, other fixes
2016-02-01 20:57:04 +00:00
David Pursell
85c65dab42 Merge "adb: win32: handle incomplete UTF-8 in console output, other fixes" 2016-02-01 20:49:25 +00:00
David Pursell
488275b8f6 Merge "base: add SystemErrorCodeToString() function." am: 79d8f07a6f
am: cbb5d714d7

* commit 'cbb5d714d79dbc785a90fd17082227321cee9d92':
  base: add SystemErrorCodeToString() function.
2016-02-01 20:45:39 +00:00
David Pursell
79d8f07a6f Merge "base: add SystemErrorCodeToString() function." 2016-02-01 20:39:09 +00:00
David Pursell
5f787ed2b3 base: add SystemErrorCodeToString() function.
Pulls the Windows error string generation out of adb into libbase so
that it can be used by fastboot as well. Also makes a Unix equivalent
that just wraps strerror() so that upcoming fastboot error reporting
code can be platform-independent.

The intent here is just to provide a portable way to report an error to
the user. More general cross-platform error handling is out of scope.

Bug: http://b/26236380
Change-Id: I5a784a844775949562d069bb41dcb0ebd13a32bc
2016-02-01 12:18:26 -08:00
Josh Gao
da870abcf4 Merge changes I93287b87,I30a3eb0b am: d18aea9974
am: 831bd4f043

* commit '831bd4f0436a81c5ebf9ec4417948b8195cb01d6':
  adb: add nullability specifiers to adb_client.h.
  adb: add adb_get_feature_set.
2016-02-01 18:54:04 +00:00
Josh Gao
d18aea9974 Merge changes I93287b87,I30a3eb0b
* changes:
  adb: add nullability specifiers to adb_client.h.
  adb: add adb_get_feature_set.
2016-02-01 18:48:13 +00:00
Josh Gao
a166e71e21 adb: add nullability specifiers to adb_client.h.
Change-Id: I93287b876cb06d871b4330d2733ef6f43c58fbbf
2016-01-31 19:22:04 -08:00
Josh Gao
f3f6a1d0d4 adb: add adb_get_feature_set.
Extract a feature set getter function from commandline.cpp.

Change-Id: I30a3eb0b060a88379e29be16264637816e378978
2016-01-31 19:12:26 -08:00
David Pursell
7fd384bf77 Merge "adb: fix subprocess termination for legacy shell." am: a9352202dd
am: 4c0a6a1677

* commit '4c0a6a16772700146c4edb894af46f90138e9170':
  adb: fix subprocess termination for legacy shell.
2016-01-29 22:20:40 +00:00
David Pursell
a9352202dd Merge "adb: fix subprocess termination for legacy shell." 2016-01-29 22:14:46 +00:00
Josh Gao
f74da513c8 Merge "adb: SIGWINCH support for Windows" am: c1eb5ba0fb
am: 41b04cf896

* commit '41b04cf89677836dba14903226df5c7a3d39adcd':
  adb: SIGWINCH support for Windows
2016-01-29 22:08:22 +00:00
Spencer Low
2e02dc630f adb: SIGWINCH support for Windows
- Introduces unix_read_interruptible() which is like unix_read() except
  that it can return EINTR.

- The big idea is that the Windows ReadConsoleInput() API will return an
  event on window resize and then we return EINTR from
  unix_read_interruptible() just like Unix.

- Only handles horizontal resize since Windows doesn't seem to give an
  event for vertical resize when no special screen buffer is used. This
  should be sufficient for the primary use case of adb on Windows
  (people are not running vi in the first place).

Change-Id: Id8d1710b559834c8098f2d7fbecedf2d0ade4b88
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2016-01-28 23:01:56 -08:00
Spencer Low
a30b79a2d9 adb: win32: handle incomplete UTF-8 in console output, other fixes
Previously, the various adb_printf, adb_fwrite, etc. functions did not
correctly handle the case of the passed buffer ending with an incomplete
UTF-8 sequence. This is fixed by buffering up incomplete UTF-8 sequences
in g_console_output_buffer (protected by the mutex
g_console_output_buffer) and outputting it later once the full sequence
is available.

A unittest for the main worker function, ParseCompleteUTF8(), was added
to adb_test.

Other fixes:

- Fix the return value of number-of-chars written to be number of UTF-8
  bytes instead of number of UTF-16 characters.

- Don't overwrite errno in success cases of various adb_printf, etc.
  functions. This might be excessive, but might be useful in the case
  when these functions are used for debugging/tracing.

- Add missing UTF-8 stdio functions that aren't currently used by adb,
  but might be in the future: vprintf, putc, putchar, puts.

- stdin_raw_init: If we can't get the console handle, don't call
  SetConsoleMode(). Not a big deal, but this will prevent erroneous
  trace output.

Change-Id: I8730e8af92882c42b884ad921b39a17b54465085
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2016-01-28 16:31:28 -08:00
Rubin Xu
8c43666958 Merge "ADB security logging" am: 8dfe21eaad
am: e37103a375

* commit 'e37103a375de00d0300b49d2af3550db663f2f2e':
  ADB security logging
2016-01-28 20:07:13 +00:00
Rubin Xu
8dfe21eaad Merge "ADB security logging" 2016-01-28 19:50:58 +00:00
David Pursell
57dd5ae1e3 adb: fix subprocess termination for legacy shell.
http://r.android.com/166419 changed `adb shell` behavior to not
allocate a remote PTY for non-interactive commands, but adbd relied on
having a PTY to properly terminate the subprocess.

One impact of this is that when using older versions of adb or passing
the -x flag, `adb screenrecord` wasn't properly terminating and closing
out the video file.

This CL restores the old behavior for legacy shell connections: always
use a PTY, but put it in raw mode if the client is doing local PTY
input/output processing itself.

Bug: http://b/26742824
Change-Id: I9ee630c0ff0d2d6a0db367387af7123deea79676
2016-01-27 17:13:41 -08:00
David Pursell
aa8af387d3 Merge "adb: fix GetFeatureSet() to indicate failure." am: 921b8e19ee
am: ff81cd2727

* commit 'ff81cd2727a8abbbad7754ffdbea5783120769e7':
  adb: fix GetFeatureSet() to indicate failure.
2016-01-22 18:47:05 +00:00
David Pursell
b5a43c4590 Merge "base: add network address parsing function from adb." am: 7fc87c9bc2
am: cee5418fe4

* commit 'cee5418fe413ce966b20ed4e6f9c6de45629dece':
  base: add network address parsing function from adb.
2016-01-22 18:46:59 +00:00
David Pursell
0aacbbe9f3 adb: fix GetFeatureSet() to indicate failure.
Previously GetFeatureSet() on an invalid target would just return an
empty feature set, leading to some invalid assumptions, e.g. if there
isn't exactly one device connected this happens:

$ adb shell -t
error: target doesn't support PTY args -Tt

This CL adds a success/failure return value to GetFeatureSet(), and
also adds an option to print errors to stderr since that's the most
common behavior.

This will cause a slight difference in behavior for install/uninstall.
Previously they would block until the device was available, now they
print an error and quit immediately, which seems to be the more common
behavior for adb functions.

Bug: http://b/26387641
Change-Id: I0ea6ffaec922e04b9946e84f05c3870e5b549fde
2016-01-22 08:49:15 -08:00
David Pursell
706955ff0d base: add network address parsing function from adb.
This CL moves the network address parsing function from adb to libbase
so that it can be used by fastboot as well as adb.

libbase seemed like the right choice because:
  1. It already has some parsing functions (parseint)
  2. The net address parsing function uses the libbase string
     functions so we have a libbase dependency anyway.

The parsing function has been modified slightly to make the canonical
address optional, and debug logging on success has been removed.

For adb the only functional difference is that parsing a network
address will no longer print the result to the debug log, which seemed
unnecessary.

Bug: http://b/26236380
Change-Id: Ife6df02937225fc66de87884d3572d79c092c522
2016-01-21 20:03:33 -08:00
Rubin Xu
d61a25c172 ADB security logging
Log adb shell, pull and push operations to the security log.

Bug: 22860162
Change-Id: I5d24e9d51040ae05a41d9fcb079e84351a217bd3
2016-01-21 15:57:02 +00:00
Josh Gao
870c10cd4f Merge "adbd: use pty to determine whether a session is interactive." am: 7e923fb3c5
am: 43568a558d

* commit '43568a558d8ce9a27d47e7be1d840440ba8e7649':
  adbd: use pty to determine whether a session is interactive.
2016-01-21 00:04:34 +00:00
Josh Gao
b5028e46b0 adbd: use pty to determine whether a session is interactive.
Bug: http://b/26236990
Change-Id: I8baa4009a2fbe9a4c93f6ef5350ce61161b7237d
2016-01-20 15:32:56 -08:00
Josh Gao
6176298929 Merge "adbd: don\'t leave zombies when subprocess creation fails." am: fb494eb40d
am: da0678946c

* commit 'da0678946c771f0cae418f866cbb9d2f0b2a4276':
  adbd: don't leave zombies when subprocess creation fails.
2016-01-20 20:54:13 +00:00
Josh Gao
c65fae9ef5 adbd: don't leave zombies when subprocess creation fails.
Bug: http://b/26660675
Change-Id: I8e65d51af73f409c30be47575f76bc6b0f227c54
2016-01-20 11:40:31 -08:00
Josh Gao
3ed4d4d47b Merge "adb: tag fatal, fatal_errno with printf attribute." am: 7db2cb67be
am: a05fbcff42

* commit 'a05fbcff42427e9f8597391157942d81aba8fd36':
  adb: tag fatal, fatal_errno with printf attribute.
2016-01-15 23:58:19 +00:00
Josh Gao
c93cf8a75e Merge "Increase the maximum shell command length to 4096ish." am: 3472410eac
am: 2783126cab

* commit '2783126cab5ca2a1aae5779c988a84abff97cb19':
  Increase the maximum shell command length to 4096ish.
2016-01-15 23:58:13 +00:00
Dan Albert
2dd90a20a0 Merge "Fix a couple sign-comparison warnings." am: 422359aad4
am: b2d312749e

* commit 'b2d312749efe6b46dc0faf67f72d3a4b40434934':
  Fix a couple sign-comparison warnings.
2016-01-15 23:58:08 +00:00
Josh Gao
7db2cb67be Merge "adb: tag fatal, fatal_errno with printf attribute." 2016-01-15 23:51:05 +00:00
Josh Gao
56e9bb9bd6 adb: tag fatal, fatal_errno with printf attribute.
Also, fix bugs that this uncovered. In particular, the sysdeps_win32
FATAL macro would only print __FUNCTION__.

Change-Id: I6307ec9749edec21b4fee192e135a86ec445c84b
2016-01-15 15:25:31 -08:00
Josh Gao
3472410eac Merge "Increase the maximum shell command length to 4096ish." 2016-01-15 23:06:37 +00:00
Josh Gao
7e6683ce40 Increase the maximum shell command length to 4096ish.
The actual maximum length will depend on the version of the shell
protocol being used, and any additional parameters being passed through
(e.g. TERM=xterm-256color). This should be able to be raised to 64K for
devices with commit 3d2904c (L-MR1 and above), but that'll require some
plumbing.

Bug: http://b/20467103
Change-Id: Idf0c46af5b18b854110aba58df13a53297d2475f
2016-01-15 15:02:19 -08:00
Dan Albert
bac7bb5c16 Fix a couple sign-comparison warnings.
Bug: http://b/26523949
Change-Id: Id33146b5544147945fee3f14f7f72f39bae449f6
2016-01-15 12:18:14 -08:00
Jorge Lucangeli Obes
c76e2a8dad Merge "adbd: Depend only on libminijail." am: 6fe9930722
am: 3cdfb3b0aa

* commit '3cdfb3b0aa6ae36663fb80a628ceda388da95cd6':
  adbd: Depend only on libminijail.
2016-01-09 00:17:58 +00:00
Elliott Hughes
81a70ac08e Merge "Improve dumb terminal support (emacs is dumb)." am: 46798ecd17
am: ec97cb8b50

* commit 'ec97cb8b509f06e658cfa2a2fb86e0fbe8e28e25':
  Improve dumb terminal support (emacs is dumb).
2016-01-09 00:13:09 +00:00
Jorge Lucangeli Obes
6fe9930722 Merge "adbd: Depend only on libminijail." 2016-01-08 23:59:32 +00:00
Elliott Hughes
d68ad69d1d Improve dumb terminal support (emacs is dumb).
Bug: http://b/26444032
Change-Id: Iaff4b09b613fd30ab7c4c73e096da34f37e0de07
2016-01-08 15:47:07 -08:00
Jorge Lucangeli Obes
4fc0c3d92a Merge "adbd: Remove check for set_supplementary_gids." am: fd3c12d224
am: 7356218161

* commit '7356218161220848920d5e117d304d442b79f44f':
  adbd: Remove check for set_supplementary_gids.
2016-01-08 23:06:21 +00:00
Jorge Lucangeli Obes
218eb7c820 adbd: Depend only on libminijail.
With https://android-review.googlesource.com/#/c/195460,
adbd can depend only on libminijail, without having to include its
dependencies.

Bug: 26099611
Change-Id: I2312d8584dda88b4a4619d3100d0983fa2833ba5
2016-01-08 13:33:01 -08:00
Jorge Lucangeli Obes
fd79a5d9c1 adbd: Remove check for set_supplementary_gids.
With https://android-review.googlesource.com/#/c/195400, Minijail will
check for this failure so there's no need to do it here, which allows
to simplify the code.

Bug: 26099611
Change-Id: I7c876fdcab874ed403f82bdd5a4048c0f1e5db58
2016-01-08 10:56:20 -08:00
Josh Gao
62d65862a4 Merge "WA: Fix adb wait-for-device command" am: bf867cac7e
am: 4da27b1014

* commit '4da27b101499c59eb85e9650a97a7b2f980a2dee':
  WA: Fix adb wait-for-device command
2016-01-07 01:27:03 +00:00
Leo Sartre
94e0776eb8 WA: Fix adb wait-for-device command
Without -s argument, adb wait-for-device will make a call to
acquire_one_transport() with sinfo->serial.c_str() == "".
Waiting for acquire_one_transport() to be reworked to use std::string
rather than const char * for serial, work around this by passing NULL
when sinfo->serial is not initialized in host_service_to_socket().

Change-Id: Ifef53e0e82850364f5029ee36560376f2a4a5104
Signed-off-by: Leo Sartre <leox.sartre@intel.com>
2016-01-05 12:13:24 +01:00
Dan Willemsen
2b787e2b78 Merge "Limit adb_test to first multilib" am: 3fb7d97689
am: 03e6f710bc

* commit '03e6f710bc5263cbaf53149dac1d7f775a9ab051':
  Limit adb_test to first multilib
2015-12-22 22:20:42 +00:00
Dan Willemsen
1e20e0aa1d Limit adb_test to first multilib
It uses libadb, which is also only compiled for the primary
architecture. BUILD_HOST_NATIVE_TEST is changing the default
LOCAL_MULTILIB to match BUILD_NATIVE_TEST.

Change-Id: Ia9c002e641125eb996a7f198af1f182d0d6171c6
2015-12-21 16:17:24 -08:00
Elliott Hughes
ee5910c3ee Merge "Give adb a proper progress bar." am: 0e6a23c7d5
am: 91c228f1ef

* commit '91c228f1ef6845535e7e490f0d938cf5e4271f11':
  Give adb a proper progress bar.
2015-12-19 09:20:36 -08:00
Elliott Hughes
a00e6ef1ff Give adb a proper progress bar.
This factors out the duplication in the single-file progress, and adds a
whole-sync progress percentage to the front of the line. A number that's
both more interesting and easier to read.

This also fixes the >100 percentage reporting for files of unknown size.

Bug: http://b/26189482
Change-Id: I51501ccef6ae1f52425db0eb0862d87e90947a6c
2015-12-18 14:43:31 -08:00
Elliott Hughes
f6e7622aea Merge "adb host: add device state in "adb wait-for-*"" am: 82509e7925
am: ba7a198c29

* commit 'ba7a198c2976baf9574dd01d7719ec0443caba47':
  adb host: add device state in "adb wait-for-*"
2015-12-18 18:40:17 +00:00
Josh Gao
3f165e8d5b Merge "adb: extract USB FFS read/write limit constants." am: 1ff73936a7
am: 67a6d861ce

* commit '67a6d861ce47b2d555a0e6d4288f3c3d35a9155b':
  adb: extract USB FFS read/write limit constants.
2015-12-18 18:39:54 +00:00
Elliott Hughes
c85c7e84cc Merge "Improve "adb install"\'s error message slightly." am: d361582dc0
am: 79abeb68f2

* commit '79abeb68f26c3ff9b99929fe15b25fd202225ffc':
  Improve "adb install"'s error message slightly.
2015-12-18 18:39:33 +00:00
Jorge Lucangeli Obes
135405fd20 Merge "adb: Use Minijail for privilege dropping." am: 297a8381b5
am: f733d6acad

* commit 'f733d6acad6582fb7d816ef65bbeecfd745af5ec':
  adb: Use Minijail for privilege dropping.
2015-12-18 01:52:10 +00:00
Tom Cherry
065c723db2 Merge "Use selinux_android_setcon() instead of setcon()" am: 64cc0825a6
am: 4692984e92

* commit '4692984e92de83299f4c03ec176c9a4b4dcb0292':
  Use selinux_android_setcon() instead of setcon()
2015-12-18 01:48:52 +00:00
Elliott Hughes
82509e7925 Merge "adb host: add device state in "adb wait-for-*"" 2015-12-17 22:44:15 +00:00
Josh Gao
1ff73936a7 Merge "adb: extract USB FFS read/write limit constants." 2015-12-17 22:29:12 +00:00
Josh Gao
ae72b5aa4b adb: extract USB FFS read/write limit constants.
Change-Id: I5e9fb7959a1c4744cb8d53ece4634138239d4e49
2015-12-17 14:28:24 -08:00
Elliott Hughes
d361582dc0 Merge "Improve "adb install"'s error message slightly." 2015-12-17 22:17:38 +00:00
Elliott Hughes
fe01885c9b Improve "adb install"'s error message slightly.
We still don't really have a clue what went wrong, but "Failed to write"
made it sound like we did.

Change-Id: Ic58b13202e2d8ea6b095f7046db9d0771d77ce65
2015-12-17 14:04:38 -08:00
Jorge Lucangeli Obes
683dc4817f adb: Use Minijail for privilege dropping.
By using Minijail we avoid writing the same priv-dropping code over
and over again. This also enables future hardening opportunities.
We're already using Minijail for priv-dropping on Brillo.

Minijail is unit- and integration-tested on the
Chrome OS CI infrastructure (pulling from the same repo, see
https://wmatrix.googleplex.com/security?tests=security_Minijail0).
Once CI comes to Android, it will be continuously tested there as well.

Both 'adb root' and 'adb unroot' still work.

Bug: 26099611
Change-Id: I52c456ea272d27bd6fbc71200f4fdd928a592158
2015-12-17 10:49:53 -08:00
Tom Cherry
64cc0825a6 Merge "Use selinux_android_setcon() instead of setcon()" 2015-12-17 17:54:05 +00:00
Leo Sartre
1fbc9dbd0f adb host: add device state in "adb wait-for-*"
The current implementation of the host commands "adb wait-for-*" allows
to specify only the transport layer (local, usb or any).
This patch allows the specification of the expected device state
(bootloader, recovery, device or sideload), this is usefull for
scripting purposes.

Use case:
$ adb reboot sideload-auto-reboot
$ adb wait-for-usb-sideload && adb sideload package.zip

Change-Id: I276a6be4d82f8b7901f74e1e5395b86d16548e8f
Signed-off-by: Leo Sartre <leox.sartre@intel.com>
2015-12-16 18:11:18 -08:00
Tom Cherry
38cd57a145 Use selinux_android_setcon() instead of setcon()
Bug 26114086

Change-Id: I02d20ee7a5f487fc73d7a33d50b0b8f1cd9ad3a4
2015-12-16 17:42:08 -08:00
Josh Gao
a61bd45f83 Merge "adb: split up reads longer than 16k." am: 56d7d4e85f
am: bf2c482b56

* commit 'bf2c482b5625d7f0722e85415221a02795cb72ca':
  adb: split up reads longer than 16k.
2015-12-16 14:20:33 -08:00
Josh Gao
0b19540dee adb: split up reads longer than 16k.
Reads from functionfs allocate contiguous buffers in the kernel, causing
long ones to sometimes fail because of memory fragmentation.

Bug: http://b/26206622
Change-Id: Id40753d6f29b37b5ca97c3e2fa3921f52b4242de
2015-12-16 11:40:38 -08:00
Elliott Hughes
0eb8f2942a Merge "More idiomatic cleanup of 9f75a035713d216469f1cabfe4a65f7864e2145a." am: a48dc55f32
am: 14f74dae87

* commit '14f74dae876482a2eb41e8a3802cc5b39224662a':
  More idiomatic cleanup of 9f75a03571.
2015-12-16 18:44:25 +00:00
Elliott Hughes
9e7893bf86 More idiomatic cleanup of 9f75a03571.
Change-Id: Id936946375d2be56ba10bf3aa5804f52cdbecc2d
2015-12-16 08:45:05 -08:00
Nick Kralevich
eba19367fe Merge "adbd: make a PR_CAPBSET_DROP error fatal." am: 57134adecb
am: 85ac05f480

* commit '85ac05f4805c3f12a923817ab4939f760ac460ca':
  adbd: make a PR_CAPBSET_DROP error fatal.
2015-12-16 02:01:33 +00:00
Nick Kralevich
9f75a03571 adbd: make a PR_CAPBSET_DROP error fatal.
Back in 080427e4e2, we said:

  If the kernel doesn't support file capabilities, we ignore
  a prctl(PR_CAPBSET_DROP) failure. In a future CL, this could
  become a fatal error.

Make it a fatal error. With SELinux support, all devices are
required to support file capabilities.

Change-Id: I0ce0c4cb9387c42e325cbf1a63c5d82e6aab530c
2015-12-15 16:54:53 -08:00
Elliott Hughes
2e83684537 Merge "Share the new adb USB diagnostic code with fastboot." am: efd8c3289e
am: 40f80e25d3

* commit '40f80e25d3f399ece26d5f1ac145921ccb7f5f80':
  Share the new adb USB diagnostic code with fastboot.
2015-12-14 12:47:44 -08:00
Elliott Hughes
1b708d368f Share the new adb USB diagnostic code with fastboot.
Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
2015-12-14 10:50:21 -08:00
Josh Gao
9b42cea202 Merge "adb: handle some edge cases with process environments." am: 80f3b0438d
am: 412f6aaead

* commit '412f6aaead3c414fe65e8a9ca129e3218d28f633':
  adb: handle some edge cases with process environments.
2015-12-13 13:15:34 -08:00
Josh Gao
80f3b0438d Merge "adb: handle some edge cases with process environments." 2015-12-12 00:43:38 +00:00
Josh Gao
e03c988748 adb: handle some edge cases with process environments.
Change-Id: I0c20e58e14ef756a8c45dd5ea85f7301157a3c8e
2015-12-11 15:58:32 -08:00
Josh Gao
25ec5c097a Merge "adb: don\'t use setenv after forking." am: 5e15568c07
am: 7b74dc83e6

* commit '7b74dc83e6e3c81f534f4422c14402ecd04b9015':
  adb: don't use setenv after forking.
2015-12-11 15:57:19 -08:00
Josh Gao
5e15568c07 Merge "adb: don't use setenv after forking." 2015-12-11 23:32:19 +00:00
Josh Gao
9b3fd67213 adb: don't use setenv after forking.
Previously, for `adb shell`, we were using setenv after forking to set
up the child's environment. This would occasionally deadlock in the
child, which would cause the main thread to deadlock waiting for the
child to complete. This patch constructs the environment before forking
and passes it to execle, eliminating the deadlock.

Bug: http://b/25847115
Change-Id: I720d472770564b1449819ddaab945a89844244a8
2015-12-11 15:10:12 -08:00
Josh Gao
c56e68f0eb Merge "adb: make pulling symlinks and devices work." am: c8e793685c
am: 8b99185552

* commit '8b99185552fd49e7902404352e0b5fda266263fd':
  adb: make pulling symlinks and devices work.
2015-12-11 14:18:54 -08:00
Josh Gao
c8e793685c Merge "adb: make pulling symlinks and devices work." 2015-12-11 21:04:25 +00:00
Josh Gao
f264224191 adb: make pulling symlinks and devices work.
Bug: http://b/25972989
Bug: http://b/26085751
Change-Id: I43842871522ea5f67a8c258dcb6ddafa8dd744c8
2015-12-11 12:51:38 -08:00
Mike Frysinger
7e4d906f2f Merge "adbd: refactor priv dropping logic" am: 6945e36060
am: e2d0403e1c

* commit 'e2d0403e1c6fc610e1536090e903ddced58a2015':
  adbd: refactor priv dropping logic
2015-12-11 10:58:00 -08:00
Mike Frysinger
6945e36060 Merge "adbd: refactor priv dropping logic" 2015-12-11 17:03:19 +00:00
Josh Gao
eaad29ed53 Merge "adb: shell: add -n flag to not read from stdin." am: aae38d9704
am: 5abed250dd

* commit '5abed250dd8a808271527c02a8c7758a863541fc':
  adb: shell: add -n flag to not read from stdin.
2015-12-10 15:43:31 -08:00
Nick Kralevich
d1de91b26c Merge "Revert "adb: Make HOME=/data/local/tmp"" am: ce4bbcfb08
am: a09565ad1d

* commit 'a09565ad1d4c552b6d1dc8be28cf674d2ec8b3ec':
  Revert "adb: Make HOME=/data/local/tmp"
2015-12-10 15:43:17 -08:00
Josh Gao
0f871e8257 Merge "adb: make the test_pull_dir test actually test something." am: f31aba9e8d
am: e0dcc75107

* commit 'e0dcc751072591e471a489e18d2d30abc045ffa4':
  adb: make the test_pull_dir test actually test something.
2015-12-10 15:42:48 -08:00
Josh Gao
12debfc4cb Merge "Move adb tests to system/core/adb." am: 4d0e10b24e
am: fe5c23b388

* commit 'fe5c23b388d1c4166558f4b3d3222f9015528afb':
  Move adb tests to system/core/adb.
2015-12-10 15:42:30 -08:00
Josh Gao
aae38d9704 Merge "adb: shell: add -n flag to not read from stdin." 2015-12-10 21:30:19 +00:00
Josh Gao
7d58607360 adb: shell: add -n flag to not read from stdin.
Shell scripts of the following form do not work properly with adb:
    echo "foo\nbar\nbaz" | {
        read FOO
        while [ "$FOO" != "" ]; do
            adb shell echo $FOO
            read FOO
        done
    }
The first run of adb shell will consume all of the contents of stdin,
causing the loop to immediately end. ssh solves this by providing a -n
flag that causes it to not read from stdin. This commit adds the same.

Bug: http://b/25817224
Change-Id: Id74ca62ef520bcf03678b50f4bf203916fd81038
2015-12-10 12:52:06 -08:00
Nick Kralevich
ce4bbcfb08 Merge "Revert "adb: Make HOME=/data/local/tmp"" 2015-12-10 20:48:08 +00:00
Nick Kralevich
b118762241 Revert "adb: Make HOME=/data/local/tmp"
During early boot, we may be mounting and unmounting /data.
Having the home directory for adb shell commands, such as
"adb shell logcat", on the /data directory prevents unmounting.

This reverts commit 173eb396c7.

Bug: 26132185
Change-Id: Ib7c2f9e696f52bf5bbb79223d90dd76791779587
2015-12-10 20:42:18 +00:00
Mike Frysinger
4120ebc635 adbd: refactor priv dropping logic
Makes the code a little cleaner.

Change-Id: I961b6fc8730c45d8fd4f9fd2981a6d6ab8f51fb6
2015-12-10 13:35:10 -05:00
Josh Gao
f31aba9e8d Merge "adb: make the test_pull_dir test actually test something." 2015-12-10 18:09:53 +00:00
Josh Gao
4d0e10b24e Merge "Move adb tests to system/core/adb." 2015-12-10 18:09:47 +00:00
Elliott Hughes
ffc39903c6 Merge "Simplify adb LinePrinter newline handling." am: 9fa5cefea4
am: ab31c07ce9

* commit 'ab31c07ce9a9d6df3483c326c42a50c63f737695':
  Simplify adb LinePrinter newline handling.
2015-12-09 18:53:19 -08:00
Elliott Hughes
77f539ab49 Simplify adb LinePrinter newline handling.
We had mostly-working hacks before, but it's time to just modify LinePrinter
to suit our needs. If we tell LinePrinter what kind of output we're giving
it, it can manage things automatically.

This fixes the minor bug where we'd sometimes have a blank line after an
error message.

Change-Id: I07ff52437f2402de311e237dd1b2dd338d9b668a
2015-12-09 18:42:41 -08:00
Josh Gao
ce8f2cdcd0 adb: make the test_pull_dir test actually test something.
Change-Id: I8b525377557528d5bc70c44d587891fad9f739bd
2015-12-09 14:41:33 -08:00
Josh Gao
191c154832 Move adb tests to system/core/adb.
Change-Id: If240f45817a46d1e055a8e5173ee7191b9d6c8ea
2015-12-09 11:26:11 -08:00
David Pursell
9046c23ed6 Merge "adb: add help text for USB permission errors." am: 663e949b2b am: e37325defc
am: 4542b62cca

* commit '4542b62ccafb749542bddaf0b442db554e7210e3':
  adb: add help text for USB permission errors.
2015-12-08 16:22:44 +00:00
David Pursell
663e949b2b Merge "adb: add help text for USB permission errors." 2015-12-08 16:12:22 +00:00
Nick Kralevich
e042ff867c Merge "adb: Make HOME=/data/local/tmp" am: 5358093225 am: 65ab87dd9b
am: b87df11678

* commit 'b87df11678c22d56d02c776f8f91031bf81a963d':
  adb: Make HOME=/data/local/tmp
2015-12-08 05:06:19 +00:00
Nick Kralevich
5358093225 Merge "adb: Make HOME=/data/local/tmp" 2015-12-08 04:56:05 +00:00
Erik Kline
79a3210eda Merge "Switch from using sockaddr to sockaddr_storage." am: 46b0b1c694 am: 4c1b3840f0
am: cbc6f68e32

* commit 'cbc6f68e320bd30d0cd7fbe73847deacbd54e073':
  Switch from using sockaddr to sockaddr_storage.
2015-12-08 04:54:05 +00:00
Erik Kline
46b0b1c694 Merge "Switch from using sockaddr to sockaddr_storage." 2015-12-08 01:41:38 +00:00
Nick Kralevich
173eb396c7 adb: Make HOME=/data/local/tmp
Make the home directory for adb shell be /data/local/tmp and
automatically change into that directory.

Change-Id: Ib5cc6e1ecdd31a37e986cf03836f7589ebd40868
2015-12-07 16:56:12 -08:00
Elliott Hughes
ef119a14b8 Merge "Track rename of base/ to android-base/." am: 912ed3d8ca am: e2a9563be1
am: 3608ee5e90

* commit '3608ee5e903689ea7c433587be664649689816e1':
  Track rename of base/ to android-base/.
2015-12-07 23:59:44 +00:00
Erik Kline
7e16cc15b5 Switch from using sockaddr to sockaddr_storage.
This is to ensure sufficient space is always available.

Change-Id: Ifa87b93ecdc90dcacbfb24446c872344da6703d3
2015-12-07 16:07:46 +09:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Josh Gao
02025afe2b Merge "adbd: split up writes longer than 16k." am: 1c6cd21c43 am: eb4426f2b4
am: 8e7bde369b

* commit '8e7bde369b8cdd8b65a3e91bf77d60c1c5ed308c':
  adbd: split up writes longer than 16k.
2015-12-03 23:02:51 +00:00
Josh Gao
1c6cd21c43 Merge "adbd: split up writes longer than 16k." 2015-12-03 22:50:11 +00:00