Commit graph

213 commits

Author SHA1 Message Date
Josh Gao
9c869b58a8 adb: allow use of arbitrary socket specs for command socket.
Bug: http://b/30445394
Change-Id: I474ede35ec3c56ad86da503c9703f83ef5e80862
2016-09-01 15:49:06 -07:00
Josh Gao
924d35a8d5 adb: extract the adb-specific unique_fd out into its own header.
Some POSIX-only files would like to use functions declared in
adb_utils.h without being forced to use the sysdeps stuff for open,
close, etc. Extract the adb-specific unique_fd into its own header so
those files can use adb_utils.h alongside the real unique_fd.

Change-Id: I10344ef26b7e72fce46bf7e3033f89aa54bd6118
Test: mm
2016-09-01 15:49:06 -07:00
Felipe Leme
b3239728bb DO NOT MERGE: Deprecated 'adb bugreport' with flat files.
Starting on Android N, zipped bugreports contain more information than
flat-file, text bugreports. On N, calls to 'adb bugreport' would still
generate a flat-file bugreport, but with a warning.

With this change, 'adb bugreport' will generate a zipped bugreport in
the current directory, using the bugreport name provided by the
device. Similarly, calling 'adb bugreport dir' will generate a bugreport
with a device-provided name, but in such directory.

BUG: 30451114
BUG: 29448020

Change-Id: Ibc8920dd44a5f62feb15bf3fefdcb0bdbf389a90
(cherry picked from commit 307951e124)
(cherry picked from commit f8d9e4eb00)
2016-08-30 13:06:33 -07:00
Felipe Leme
0d4f0508c0 DO NOT MERGE: Refactored functions that copy sdout and stderr to strings to use a callback.
BUG: 28609499

Change-Id: I04aea346e18678ea00797f7f659480edba4436c2
(cherry picked from commit 07ac8554b4)
(cherry picked from commit d18854218e)
2016-08-30 13:06:26 -07:00
Felipe Leme
698e065e14 DO NOT MERGE: Split bugreport() into its own file and added unit tests.
bugreport() will be soon refactored to track progress, which will
require more comprehensive unit tests.

As such, it's better to move it to its own files, which in turn also
requires moving send_shell_command() and usage() to commandline.h.

Fixes: 30100363
Bug: 30268737

Change-Id: I3cdf114a0b5547293320042ff0749a60886440b0
(cherry picked from commit 78e0963e4b)
(cherry picked from commit 218e1ff759)
2016-08-30 13:06:23 -07:00
Todd Kennedy
248722e7eb DO NOT MERGE: use 'cmd' command for install-multiple
adb install-multiple makes a minimum of 3 calls to the 'pm' command. This
causes at least 3 separate "pm" processes to be spun up. Instead, use the
'cmd' command which runs in the existing system_server process.

Bug: 27483932
Change-Id: Ia1bed405c3d7e675a1a56ff82c692aaa94388a5c
(cherry picked from commit 4838ae1ab5)
2016-08-30 13:06:12 -07:00
Christopher Tate
c42f1bb3e9 DO NOT MERGE: Ensure the target sees a proper EOD marker during restore
Malformed or corrupt archives may be missing their in-band EOD
content, so make sure that the target sees one regardless rather
than continuing to block on read, expecting in-band signaling.

Bug 28056941

Change-Id: Ic39966d3448787a8c511783d39172032ed9589c3
(cherry picked from commit 2bcdda8e5d)
2016-08-30 13:06:05 -07:00
Chih-Hung Hsieh
4c4fa90462 Merge \"Fix clang-tidy performance warnings in syste/core.\"
am: 4efbce14b5

Change-Id: I84f6b0134fae6e9f40710f243f4825e3f31fa15f
2016-08-01 20:23:10 +00:00
Chih-Hung Hsieh
8f7b9e3d39 Fix clang-tidy performance warnings in syste/core.
* Use const reference type for parameters to avoid unnecessary copy.
* Suppress warning of not using faster overloaded string find function.

Bug: 30407689
Bug: 30411878
Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee
Test: build with WITH_TIDY=1
Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
2016-08-01 11:55:42 -07:00
Josh Gao
ba7aea829b Merge \"adb: make adb root not wait-for-device.\"
am: 81e59ca5a7

Change-Id: I231ad44c7b6293256f33eb3fd617b4e5da728ca1
2016-06-16 22:41:08 +00:00
Treehugger Robot
81e59ca5a7 Merge "adb: make adb root not wait-for-device." 2016-06-16 22:26:41 +00:00
Josh Gao
05824734ac adb: make adb root not wait-for-device.
`adb root` would hang for devices connected over TCP/IP, because they
never come back. Unfortunately, there doesn't seem to be an easy way to
find out what we're talking to, so replace it with a long sleep for now.

Bug: http://b/27836058
Change-Id: Icd6e6bf817ca9e2124c2961665c37b2f31f7ef29
2016-06-16 14:02:01 -07:00
Elliott Hughes
c63439ae7f Merge \"Better diagnostics from \"adb sideload\".\"
am: edd401e24e

Change-Id: I36b23f7533bbd4d6d9d9e171c297155846734a63
2016-06-15 23:29:30 +00:00
Elliott Hughes
14415142c9 Better diagnostics from "adb sideload".
Well, slightly less bad diagnostics, anyway.

Change-Id: Idf5612f7dcb9bdbd7252163889e2612ba197426d
2016-06-15 15:09:47 -07:00
Elliott Hughes
e691def5df Merge \\"Fix the sense of a test in \\"adb sideload\\".\\" am: 62cc17de8c
am: e9dfa4f753

Change-Id: If5dbbcaa7452b17b3e383daf7bbfc037108c10a3
2016-06-13 23:41:24 +00:00
Elliott Hughes
356fd364ad Fix the sense of a test in "adb sideload".
Change-Id: I516a2ad2d74d9322ff9eb2e4cd3c3829e5cbda99
2016-06-13 15:01:13 -07:00
Felipe Leme
e1d64b4eaf Merge \"Redirect bugreport stderr to host\'s stderr.\" into nyc-dev
am: 6d349051ce

Change-Id: I7ed56de80ff6ac698fb62820f24fca940d7c0905
2016-06-08 23:41:22 +00:00
Felipe Leme
d1dd125bc2 Redirect bugreport stderr to host's stderr.
Change-Id: I46f474f0b0d5cacdc4b129eab1bb0a7f52ccece0
Fixes: 29161586
2016-06-08 11:09:34 -07:00
Elliott Hughes
500c7e5bc7 Merge "Kill load_file." am: b42e4a6b63
am: 198a727891

* commit '198a727891aef33469d82b263fc222e4f4335b1b':
  Kill load_file.

Change-Id: I81d715153b8b882ace9deb073abfc4dde5535811
2016-05-28 00:30:31 +00:00
Elliott Hughes
e8b663fec3 Kill load_file.
Change-Id: I6c332f7d8e94d513605295b3d4d32c4e1cf878dc
2016-05-27 16:14:02 -07:00
Josh Gao
1209092769 Merge "adb: add track-jdwp and track-devices commands." am: f8f40a1e2e
am: 32045567be

* commit '32045567be1f5af449dfa16173f16b70ae34e85b':
  adb: add track-jdwp and track-devices commands.

Change-Id: I60e9899b403fa68e3037aed3a4bce498c66c6c7d
2016-05-17 23:06:15 +00:00
Josh Gao
b463baf610 adb: add track-jdwp and track-devices commands.
Expose these to the command line client to make it easier to poke
around.

Bug: http://b/28347842
Change-Id: Ia939b3a41eb8201365d50cd2996b83d884e42b64
2016-05-14 18:35:44 -07:00
David Pursell
1e57ab6f7b Merge "adb: support forwarding TCP port 0." am: cb90562bcf
am: 5aaffac37e

* commit '5aaffac37e2b2b32e645c0c03c96a88a3133b3ae':
  adb: support forwarding TCP port 0.

Change-Id: I2e7bd29de76a87b80e71ce00ed2da4666f3cbb56
2016-05-13 15:21:04 +00:00
David Pursell
eaae97e127 adb: support forwarding TCP port 0.
This CL adds support to forward or reverse TCP port 0 to allow the
system to automatically select an open port. The resolved port number
will be printed to stdout:
  $ adb forward tcp:0 tcp:8000
  12345
  $ adb reverse tcp:0 tcp:9000
  23456
This allows testing to be more robust by not hardcoding TCP ports which
may already be in use.

Forwarding port 0 is a host-only change and will work with any device,
but reversing port 0 requires the device to be updated with a new adbd
binary.

This CL also does a little bit of cleanup such as moving the alistener
class out of adb.h, and adds some error checking and additional tests.

Bug: 28051746
Test: python -m unittest discover
Test: adb_test
Test: `adb forward` and `adb reverse` with tcp:0
Change-Id: Icaa87346685b403ab5da7f0e6aa186aa091da572
2016-05-09 16:55:10 -07:00
Felipe Leme
6993211d38 Merge "Display warning about bugreport delay." into nyc-dev
am: f99193b7aa

* commit 'f99193b7aa8eedb0f5be448c6df6d2688c1bfb2e':
  Display warning about bugreport delay.

Change-Id: I19de3a7c8e98127322a4f8454d87e4be39c2d071
2016-05-05 03:05:22 +00:00
Felipe Leme
42e45c7068 Display warning about bugreport delay.
BUG: 28569299
Change-Id: Ide6109fd24737cbaf6296ef7326127e85d6420cb
2016-05-04 16:20:25 -07:00
Felipe Leme
d4611a9680 Automatically add a .zip to adb bugreport file when missing.
am: 644a36c209

* commit '644a36c20942029ece43ea9fbeb6163d4b706c56':
  Automatically add a .zip to adb bugreport file when missing.

Change-Id: I081fbac07cba3c7e3cbfc263ed71ee4832224d9b
2016-05-03 21:34:13 +00:00
Felipe Leme
644a36c209 Automatically add a .zip to adb bugreport file when missing.
BUG: 27653204
Change-Id: Ib322f1f9eeedd8e78c9a51a845a20c462442a0fe
2016-05-03 10:21:22 -07:00
Zach Riggle
f9f0b5f413 Merge "Fix NULL deref on exec-in with insufficient arguments" am: 245e4dbfd4
am: a0690543da

* commit 'a0690543dac2792508caef09e9e97804b31fea24':
  Fix NULL deref on exec-in with insufficient arguments

Change-Id: Ic5e62d01fecc77aace676bf6cdf4218f93806860
2016-04-22 15:53:55 +00:00
Zach Riggle
ccafc79de7 Fix NULL deref on exec-in with insufficient arguments
(cherry-pick of 566a28169b84836fddd5ae96db9b147237ea054f.)

Bug: 28152091
Change-Id: Ib59e3bf7f26974aa09d2e6a0e1d9281d7ce25511
2016-04-22 08:08:01 -07:00
TreeHugger Robot
a9e818f463 Merge changes Ia4a2ff77,I970806e3,I47daa338 into nyc-dev
* changes:
  adb: increase the FD table size on Win32.
  adb: bump the server version to 36.
  adb: add reconnect command.
2016-04-19 00:51:22 +00:00
Yabin Cui
03468c8c50 adb: add reconnect command.
Add reconnect command for debugging. `reconnect` kicks a transport
from the host side, `reconnect device` kicks a transport from
the device side. They can be used to produce transport errors.

Bug: 25935458

Change-Id: I47daa338796b561941e7aba44a51a6dd117d1e98
(cherry picked from commit 1f4ec19e49)
2016-04-18 15:46:25 -07:00
Yabin Cui
1a3ce9b3a6 Merge "adb: add reconnect command." am: 643bc36
am: 1dd696a

* commit '1dd696a52687106d9926374d18895a911cc6fd28':
  adb: add reconnect command.

Change-Id: Ibfdfe1675a8d3627d4fb8eef3592b9b836dc4d19
2016-04-16 02:00:33 +00:00
Yabin Cui
643bc369ef Merge "adb: add reconnect command." 2016-04-16 01:50:54 +00:00
Treehugger Robot
1c8bf422d9 Merge changes Ibc8038b1,I1876ecd7,I57d70f8b am: 3e0eaa4
am: c35de74

* commit 'c35de74b2b9d017a74ca3da99f8c23aad033f0f5':
  adb: after `adb root`, wait for the device in any state.
  adb: add support for 'wait-for-any'.
  adb: make 'wait-for-{recovery,sideload,bootloader} work.

Change-Id: I153b8e88cea2b2e6d5916145bf1e1145c4721b14
2016-04-13 20:38:30 +00:00
Josh Gao
9ea7795d38 adb: after adb root, wait for the device in any state.
Otherwise, `adb root` while the device is in recovery will hang.

Bug: http://b/28168212
Change-Id: Ibc8038b1745139fb505e466c74c605b9df474c8c
(cherry picked from commit 48a348183f)
2016-04-13 13:13:20 -07:00
Josh Gao
5863fb61e1 adb: add support for 'wait-for-any'.
Allow waiting for a device in any state.

Bug: http://b/28168212
Change-Id: I1876ecd70089ca88f2da5de4182e13724ec50501
(cherry picked from commit 86441c31fe)
2016-04-13 13:13:17 -07:00
Josh Gao
3d8df3cb2a adb: make 'wait-for-{recovery,sideload,bootloader} work.
The help for wait-for-* documents this as working, but we only had a
special case for 'wait-for-device'. Make the others work as well.

Bug: http://b/28170823
Change-Id: I57d70f8b9a383947c4f761919bfbd8515a013520
(cherry picked from commit 08881e72f4)
2016-04-13 13:13:14 -07:00
Josh Gao
48a348183f adb: after adb root, wait for the device in any state.
Otherwise, `adb root` while the device is in recovery will hang.

Bug: http://b/28168212
Change-Id: Ibc8038b1745139fb505e466c74c605b9df474c8c
2016-04-13 12:28:04 -07:00
Josh Gao
86441c31fe adb: add support for 'wait-for-any'.
Allow waiting for a device in any state.

Bug: http://b/28168212
Change-Id: I1876ecd70089ca88f2da5de4182e13724ec50501
2016-04-13 12:28:04 -07:00
Josh Gao
08881e72f4 adb: make 'wait-for-{recovery,sideload,bootloader} work.
The help for wait-for-* documents this as working, but we only had a
special case for 'wait-for-device'. Make the others work as well.

Bug: http://b/28170823
Change-Id: I57d70f8b9a383947c4f761919bfbd8515a013520
2016-04-13 12:28:04 -07:00
Felipe Leme
44a42677cf Implements 'adb bugreport <ZIP_FILE>'.
Dumpstate now supports zipped bugreport, whose output is more complete
than the flat-file bugreports provided prior to N. As such, adb now has
a 'adb bugreport <ZIP_FILE>' name whose implementation:

- Calls the new bugreportz binary.
- Parses its output, which in case of success is the path of the .zip
  file.
- Pulls the device file and renames it according to the command-line
  argument.

BUG: 27653204

Change-Id: I7169fe157c77bbef1684d0cb4e43095d95ddf2b8
2016-04-13 09:21:23 -07:00
Yabin Cui
1f4ec19e49 adb: add reconnect command.
Add reconnect command for debugging. `reconnect` kicks a transport
from the host side, `reconnect device` kicks a transport from
the device side. They can be used to produce transport errors.

Bug: 25935458

Change-Id: I47daa338796b561941e7aba44a51a6dd117d1e98
2016-04-05 15:21:36 -07:00
Elliott Hughes
1ef5bf839e Fix buffer overrun in adb wait-for-device.
Bug: http://b/27444063

(cherry picked from commit 34e560b9a1)

Change-Id: Ic71cb2070f509d76fb4208dbab6711c5dd5e1f62
2016-03-11 08:55:01 -08:00
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
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
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
Alex Klyubin
8a67c09e7d Merge "Only debuggable packages can be downgraded." into nyc-dev 2016-02-25 20:26:54 +00:00