Commit graph

18431 commits

Author SHA1 Message Date
Elliott Hughes
2b7b3bd100 Merge "Fix fastboot to cope with hammerhead's implicit hex." 2015-11-03 16:54:01 +00:00
Elliott Hughes
2030bac88b Fix fastboot to cope with hammerhead's implicit hex.
Before:

  wiping userdata...
  Couldn't parse partition size '3321fa800'.
  wiping cache...
  Couldn't parse partition size '2bc00000'.

Groan. So much variation between bootloaders. I wish we had a reference
bootloader like ChromeOS does.

I've also removed a harmless warning:

  couldn't parse max-download-size ''

Change-Id: Ia1099d2f87000ebb96622ad9171819a1326fa249
2015-11-03 08:20:30 -08:00
Elliott Hughes
aff48cbb3f Merge "adb: fix adb reverse --no-rebind help text"
am: 4f23917299

* commit '4f2391729951ead5f0d15862bd19213962438776':
  adb: fix adb reverse --no-rebind help text
2015-11-03 02:44:13 +00:00
Elliott Hughes
4f23917299 Merge "adb: fix adb reverse --no-rebind help text" 2015-11-03 02:40:52 +00:00
Josh Gao
58ee99e454 Merge "adb: allow multiple args to push/pull."
am: fe54c96ab2

* commit 'fe54c96ab28a59a87c0c26ac4e6664826b4644ea':
  adb: allow multiple args to push/pull.
2015-11-03 02:27:39 +00:00
Josh Gao
fe54c96ab2 Merge "adb: allow multiple args to push/pull." 2015-11-03 02:22:08 +00:00
Spencer Low
587ea20f83 adb: fix adb reverse --no-rebind help text
There was a typo in the option.

Change-Id: I5c074a883a7b384663ed65cd8de0d891dc2b6606
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-02 17:34:49 -08:00
Josh Gao
9ea31c7285 Merge "adb: add SyncConnection::Printf."
am: e9af735de3

* commit 'e9af735de36eade81adc490635ee0076bdb6c79e':
  adb: add SyncConnection::Printf.
2015-11-03 01:33:54 +00:00
Josh Gao
e9af735de3 Merge "adb: add SyncConnection::Printf." 2015-11-03 01:31:52 +00:00
Josh Gao
cda6a2bd3e adb: C++ify local_build_list and remote_build_list.
Change-Id: I71586488869c4827c5bd7294faa7c0f433bb9fbc
2015-11-02 17:24:04 -08:00
Josh Gao
983c41c353 adb: add SyncConnection::Printf.
Replaces `sc.Print(android::base::StringPrintf(...)` with one call
to sc.Printf.

Change-Id: Ib7c98103dbca0b6a951f8e5a0f860ec6eacf6772
2015-11-02 17:21:43 -08:00
David Pursell
34e0d64719 Merge "adb: create unix_isatty() function."
am: d9ff9873df

* commit 'd9ff9873df4ef68c105bc84d8dbe098feaaa6c50':
  adb: create unix_isatty() function.
2015-11-03 00:48:56 +00:00
David Pursell
d9ff9873df Merge "adb: create unix_isatty() function." 2015-11-03 00:45:31 +00:00
David Pursell
c5b8ad88ce adb: create unix_isatty() function.
Our Windows code has several different ways it checks whether an FD is
a console or not, some of which aren't exactly correct as they may
treat character devices (e.g. NUL) as consoles.

This CL disallows using the builtin isatty() function and provides
unix_isatty() instead which correctly checks these corner cases.

Change-Id: I6d551c745dae691c7eb3446b585265d62c1e62fa
2015-11-02 16:44:34 -08:00
Elliott Hughes
d09dc85d63 Merge "Work around an angler bootloader bug."
am: 9eab787560

* commit '9eab7875602dec9910002f080df513077f56a2dd':
  Work around an angler bootloader bug.
2015-11-03 00:07:18 +00:00
Elliott Hughes
9eab787560 Merge "Work around an angler bootloader bug." 2015-11-03 00:03:40 +00:00
Elliott Hughes
77c0e66bef Work around an angler bootloader bug.
It's probably not the only device whose bootloader is similarly broken.
NVIDIA did a sufficiently good job with Nexus 9 that it's almost a bad
idea for me to do most of my development there...

Change-Id: I71436cc5c33023be077ca77f6dad5dbe75b11b09
2015-11-02 15:51:12 -08:00
Elliott Hughes
a2a6b0bfa9 Merge "Clarify and fix the intent of the partition-type checking code."
am: d0f45aa24c

* commit 'd0f45aa24c09c0802784263fe2dccd38e226e23a':
  Clarify and fix the intent of the partition-type checking code.
2015-11-02 23:47:39 +00:00
Elliott Hughes
d0f45aa24c Merge "Clarify and fix the intent of the partition-type checking code." 2015-11-02 23:45:55 +00:00
Elliott Hughes
5b51ac7a59 Merge "Set HOME, LOGNAME, SHELL, and USER from adbd."
am: 36d7af4cf6

* commit '36d7af4cf635816ecbcb9bd300f4c9d60cb012d4':
  Set HOME, LOGNAME, SHELL, and USER from adbd.
2015-11-02 22:09:09 +00:00
Elliott Hughes
8ab9a32323 Clarify and fix the intent of the partition-type checking code.
Change-Id: I202dab4ee91208b632bc2086d1e5c387a4c29edd
2015-11-02 14:05:57 -08:00
Elliott Hughes
36d7af4cf6 Merge "Set HOME, LOGNAME, SHELL, and USER from adbd." 2015-11-02 22:05:07 +00:00
Daniel Rosenberg
64ea814c31 Merge "rootdir: Allow board specific folders and symlinks in root directory"
am: 6e699df21e

* commit '6e699df21e1b08aa2e9eb18ef1c44788549ae8ed':
  rootdir: Allow board specific folders and symlinks in root directory
2015-11-02 21:58:22 +00:00
Daniel Rosenberg
6e699df21e Merge "rootdir: Allow board specific folders and symlinks in root directory" 2015-11-02 21:54:42 +00:00
Elliott Hughes
fbe4332e37 Set HOME, LOGNAME, SHELL, and USER from adbd.
Previously we've set these from /system/etc/mkshrc, which caused a behavioral
difference between interactive and non-interactive shells.

Bug: http://b/19635681
Change-Id: I4608c42dd3de821046220fdb1770ab3216b5d5eb
2015-11-02 13:53:39 -08:00
John Reck
bb12b91ae1 Merge "Teach sp<> how to std::move"
am: 518d043c86

* commit '518d043c8693835061b02ecbbee4b82fc61a776e':
  Teach sp<> how to std::move
2015-11-02 21:39:24 +00:00
Yabin Cui
7782bbdef3 Merge "adb: run reverse_service() in main thread."
am: 1060739bfe

* commit '1060739bfe26a6c0eb74e10a40787ed1d781e296':
  adb: run reverse_service() in main thread.
2015-11-02 21:39:18 +00:00
John Reck
518d043c86 Merge "Teach sp<> how to std::move" 2015-11-02 21:34:50 +00:00
Yabin Cui
1060739bfe Merge "adb: run reverse_service() in main thread." 2015-11-02 21:34:39 +00:00
Bertrand Simonnet
475baee4e2 Merge "metricsd: Report the model manifest id."
am: 605f2f024b

* commit '605f2f024bd2ec06f613fa25f0a0c55ccde92786':
  metricsd: Report the model manifest id.
2015-11-02 20:59:33 +00:00
Bertrand Simonnet
605f2f024b Merge "metricsd: Report the model manifest id." 2015-11-02 20:53:57 +00:00
Josh Gao
05786779f3 adb: allow multiple args to push/pull.
Bug: http://b/25324823
Change-Id: I369dd97adbe1d08e18e84af776ce8b1d61251835
2015-11-02 12:48:24 -08:00
Daniel Rosenberg
52b5915945 rootdir: Allow board specific folders and symlinks in root directory
Building without ramdisk requires a way to specify board specific
directoryies and symlinks in the root directory at build time.

Change-Id: I11301e98228bc4761f3aee177a546146651b9f25
(cherry picked from commit d7549c9a65cad886f672af41f5fca6f0bd0c12fa)
2015-11-02 12:47:46 -08:00
Casey Dahlin
1d22e94306 Merge "Make Join support string delimiters"
am: 46776e7423

* commit '46776e7423c9a4a7ed5f52def545feee4c31297c':
  Make Join support string delimiters
2015-11-02 20:34:59 +00:00
Casey Dahlin
46776e7423 Merge "Make Join support string delimiters" 2015-11-02 20:28:09 +00:00
Casey Dahlin
5345f1df0d Make Join support string delimiters
We've needed this several times in the past.

Change-Id: I7324e8083fe2ff1aa0bf392a8c124fc2f3bb26e2
Test: Full android build
Signed-off-by: Casey Dahlin <sadmac@google.com>
2015-11-02 11:04:34 -08:00
Josh Gao
dcaf6932fd Merge "adb: use correct _WIN32 macro."
am: 5c75b529f6

* commit '5c75b529f684b388c91c7e7d0b2c7fece376ac1d':
  adb: use correct _WIN32 macro.
2015-11-02 18:59:01 +00:00
Josh Gao
5c75b529f6 Merge "adb: use correct _WIN32 macro." 2015-11-02 18:55:09 +00:00
Yabin Cui
fbfa84045d adb: run reverse_service() in main thread.
reverse_service() calls handle_forward_request(), which calls
functions in fdevent.cpp. fdevent functions is only supposed
to be called in the main thread.
Add check in fdevent.cpp to make sure all operations come from
main thread.

Bug: 25355808
Change-Id: Iceb9273f3056acc0713eaafe086ac950ca80ff4f
2015-11-02 10:39:09 -08:00
Elliott Hughes
1de89478ac Merge "Fix ParseInt/ParseUint to handle explicit "0x" hex."
am: ddf5edacc2

* commit 'ddf5edacc24125730b537265f69a081b19606246':
  Fix ParseInt/ParseUint to handle explicit "0x" hex.
2015-11-02 18:30:59 +00:00
Elliott Hughes
ddf5edacc2 Merge "Fix ParseInt/ParseUint to handle explicit "0x" hex." 2015-11-02 18:26:59 +00:00
Elliott Hughes
3ab05869d8 Fix ParseInt/ParseUint to handle explicit "0x" hex.
Also improve fastboot error reporting around max-download-size.

Change-Id: Ic3aec9460de01e5264a2803a0a6be3706d73026b
2015-11-02 09:01:53 -08:00
Daniel Erat
839cadfc9b Merge "libcutils: Make /data/nativetest{,64}/* executable."
am: 00617fbe57

* commit '00617fbe57a6330537a51b81c2e346b934f40d9e':
  libcutils: Make /data/nativetest{,64}/* executable.
2015-11-02 17:01:47 +00:00
Daniel Erat
00617fbe57 Merge "libcutils: Make /data/nativetest{,64}/* executable." 2015-11-02 16:57:56 +00:00
Daniel Erat
5510c13991 libcutils: Make /data/nativetest{,64}/* executable.
Make test files under /data/nativetest{,64} 0750 root:shell
to avoid needing to manually chmod them.

Bug: 25340994
Change-Id: I174cc226195907c0effa99063a8aa0082f85722b
2015-11-02 09:45:04 -07:00
Josh Gao
4a1397264b adb: use correct _WIN32 macro.
Change-Id: I5af7957162ae7f8472a5a262434eaba84e64325a
2015-10-30 18:39:20 -07:00
Elliott Hughes
edb78620fb Merge "adb: fix adb client running out of sockets on Windows"
am: 1e2382a027

* commit '1e2382a0277eb36fb57a3a54202945556dfd234b':
  adb: fix adb client running out of sockets on Windows
2015-10-30 23:33:26 +00:00
Elliott Hughes
1e2382a027 Merge "adb: fix adb client running out of sockets on Windows" 2015-10-30 23:29:27 +00:00
Spencer Low
351ecd15b2 adb: fix adb client running out of sockets on Windows
Background
==========

On Windows, if you run "adb shell exit" in a loop in two windows,
eventually the adb client will be unable to connect to the adb server. I
think connect() is returning WSAEADDRINUSE: "Only one usage of each
socket address (protocol/network address/port) is normally permitted.
(10048)". The Windows System Event Log may also show Event 4227, Tcpip.
Netstat output is filled with:

  # for the adb server
  TCP    127.0.0.1:5037         127.0.0.1:65523        TIME_WAIT
  # for the adb client
  TCP    127.0.0.1:65523        127.0.0.1:5037         TIME_WAIT

The error probably means that the client is running out of free
address:port pairs.

The first netstat line is unavoidable, but the second line exists
because the adb client is not waiting for orderly/graceful shutdown of
the socket, and that is apparently required on Windows to get rid of the
second line. For more info, see
https://github.com/CompareAndSwap/SocketCloseTest .

This is exacerbated by the fact that "adb shell exit" makes 4 socket
connections to the adb server: 1) host:version, 2) host:features, 3)
host:version (again), 4) shell:exit. Also exacerbating is the fact that
the adb protocol is length-prefixed so the client typically does not
have to 'read() until zero' which effectively waits for orderly/graceful
shutdown.

The Fix
=======

Introduce a function, ReadOrderlyShutdown(), that should be called in
the adb client to wait for the server to close its socket, before
closing the client socket.

I reviewed all code where the adb client makes a connection to the adb
server and added ReadOrderlyShutdown() when it made sense. I wasn't able
to add it to the following:

* interactive_shell: this doesn't matter because this is interactive and
  thus can't be run fast enough to use up ports.
* adb sideload: I couldn't get enough test coverage and I don't think
  this is being called frequently enough to be a problem.
* send_shell_command, backup, adb_connect_command, adb shell, adb
  exec-out, install_multiple_app, adb_send_emulator_command: These
  already wait for server socket shutdown since they already call
  recv() until zero.
* restore, adb exec-in: protocol design can't have the server close
  first.
* adb start-server: no fd is actually returned
* create_local_service_socket, local_connect_arbitrary_ports,
  connect_device: probably called rarely enough not to be a problem.

Also in this change
===================

* Clarify comments in when adb_shutdown() is called before exit().
* add some missing adb_close() in adb sideload.
* Fixup error handling and comments in adb_send_emulator_command().
* Make SyncConnection::SendQuit return a success boolean.
* Add unittest for adb emu kill command. This gets code coverage over
  this very careful piece of code.

Change-Id: Iad0b1336f5b74186af2cd35f7ea827d0fa77a17c
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-10-30 16:23:10 -07:00
Elliott Hughes
878f0b9c82 Merge "Fix ps -Z so it combines with other arguments."
am: dd48ffe910

* commit 'dd48ffe91003f29e378ef30776cdc4e6091db759':
  Fix ps -Z so it combines with other arguments.
2015-10-30 23:15:29 +00:00