Commit graph

17358 commits

Author SHA1 Message Date
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
Elliott Hughes
36d7af4cf6 Merge "Set HOME, LOGNAME, SHELL, and USER from adbd." 2015-11-02 22:05:07 +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
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
605f2f024b Merge "metricsd: Report the model manifest id." 2015-11-02 20:53:57 +00: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
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
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
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
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
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
dd48ffe910 Merge "Fix ps -Z so it combines with other arguments." 2015-10-30 23:11:18 +00:00
Elliott Hughes
d2e26c0e30 Fix ps -Z so it combines with other arguments.
This is another step towards being able to swap toolbox ps out for
a more complete ps. This should also let us fix dumpstate to not
need a separate "ps -Z" run --- we can just add -Z to the previous
run of ps instead.

Change-Id: I0b96dff51988edd2b33879f8c31faccebeeffddd
2015-10-30 15:16:45 -07:00
Elliott Hughes
9d1636b193 Merge "Remove the name filtering from toolbox ps." 2015-10-30 22:14:55 +00:00
Elliott Hughes
5dc119a67b Remove the name filtering from toolbox ps.
Regular ps doesn't have this, and at least in our tree everyone
seems to actually pipe to grep instead of using this anyway. But
since the switch to a more full-featured ps is going to be a nightmare
anyway, let's dip a toe in the water by removing something we don't plan
on supporting.

Change-Id: Id220ae0cfdad8368341730f643a2bfbaad3c9716
2015-10-30 15:03:30 -07:00
Mark Salyzyn
d2c8cf8265 Merge "logd: statistics report chatty effective percentage" 2015-10-30 22:00:38 +00:00
Mark Salyzyn
95ec339f5e Merge "logd: Add support for *.logd.filter" 2015-10-30 21:59:25 +00:00
Mark Salyzyn
c723df805a logd: statistics report chatty effective percentage
Report the ESTIMATED instantaneous percentage decrease or increase
that an UID has to the logs as a result of the chatty filtration.

Bug: 22855208
Change-Id: If1e77afb81a2739a72b39bc7c57071763c1d64d8
2015-10-30 14:54:17 -07:00
Mark Salyzyn
932f7acc81 logd: Add support for *.logd.filter
- Add device (ro.logd.filter), persistent (persist.logd.filter)
  properties to control the default filters
- Allow logcat -P default to produce expected results
- Allow logcat -P disable to produce expected results

Change-Id: I651cb705373ec1e88a99e4b9086da4f9668a468a
2015-10-30 14:54:17 -07:00
Bertrand SIMONNET
e6b96d6d19 metricsd: Report the model manifest id.
When the model manifest id is defined in weave, report it.

Bug: 25386505
Test: the model manifest id is uploaded when defined.
Test: If weaved.conf is not defined, metricsd uploads the default value.

Change-Id: Ic895671621fda9ce5cdeacdbdba58aa73a6887fc
2015-10-30 14:42:55 -07:00
Elliott Hughes
26352bf1fb Merge "Show transfer progress in adb sync/pull/push." 2015-10-30 21:41:19 +00:00
Elliott Hughes
9ebdf72a54 Merge "fastboot shouldn't erase non-existent cache partitions." 2015-10-30 21:34:47 +00:00
Elliott Hughes
b708d16283 Show transfer progress in adb sync/pull/push.
Change-Id: If5439877d060f9bab29cf84be996071cf680c2d4
2015-10-30 14:19:23 -07:00
Elliott Hughes
2fd45a9cea fastboot shouldn't erase non-existent cache partitions.
Check that the cache partition exists before trying to erase it.

Also clean up some of the C string handling and int booleans.

Bug: http://b/25375777
Change-Id: I1880e542b729f2026ab3a2943d4bee9d659b1eeb
2015-10-30 14:15:22 -07:00
Adam Lesinski
25322eeddd Merge "ZipWriter: archive disk numbers are 0 index based" 2015-10-30 16:56:11 +00:00
Adam Lesinski
ac60abdd70 Merge "Add deflate compression to ZipWriter" 2015-10-30 16:55:55 +00:00
Sami Tolvanen
b093cda7fb Merge "fs_mgr: set partition.*.verified property even without state" 2015-10-30 14:51:34 +00:00
Sami Tolvanen
25b230c62c fs_mgr: set partition.*.verified property even without state
Set properties on verity_update_state even if verity state management
is not used.

Bug: 24865045
Change-Id: Ic68a9e1a230c959eeb2a769260ff7d8e100cb1e1
(cherry picked from 0eb0516665678aec7712d88b51c96aaf8b312060)
2015-10-30 13:14:38 +00:00
Narayan Kamath
b57cd14596 Merge "libziparchive: fix calculation of mod_time." 2015-10-30 10:03:28 +00:00
beonit
0e99a2f79a libziparchive: fix calculation of mod_time.
Take mod_date into account as well, and fixes the issue where
all entries had creation dates in 1979.

Signed-off-by: beonit <beonit@gmail.com>
Change-Id: Id101794fa08218d15f2d1ba4e4a313c1807ea7aa
2015-10-30 10:01:38 +00:00
Mark Salyzyn
bb51fbc4d4 Merge changes Iefbea3b1,Ieb924b6d
* changes:
  liblog: add android_log_timestamp() private function
  liblog: logcat: add epoch and monotonic format modifiers
2015-10-29 23:00:14 +00:00
Mark Salyzyn
500afc7532 liblog: add android_log_timestamp() private function
Change-Id: Iefbea3b1be2f97cfdeb35e5330e5495e0337215b
2015-10-29 14:23:42 -07:00
Mark Salyzyn
4cbed02e44 liblog: logcat: add epoch and monotonic format modifiers
- '-v epoch' prints seconds since Jan 1 1970
- '-v monotonic' print cpu seconds since start of device
- '-T sssss.mmm...' as alternate tail time format

NB: monotonic is a best estimate and may be out by a few ms
    given the synchronization source clue accuracy.

Bug: 23668800
Change-Id: Ieb924b6d3817669c7e53beb9c970fb626eaad460
2015-10-29 14:23:42 -07:00
Dan Willemsen
4d18ae9301 Merge "Use GetBuildTime from libchrome instead of __DATE__" 2015-10-29 20:53:38 +00:00
Dan Willemsen
faa566d29f Use GetBuildTime from libchrome instead of __DATE__
So that this daemon doesn't change on every build, use the system build
date from libchrome (which reads ro.build.date). That way we don't have
to update this daemon for every OTA.

Bug: 24204119
Change-Id: I136d53e5e4ebb9430a57dace66198d8d704d7ca3
2015-10-29 13:02:42 -07:00
John Reck
d69089a742 Teach sp<> how to std::move
Arguably we should migrate to std::shared_ptr
but for now make std::vector<sp<>> a bit less
horrible

Change-Id: Ia458a2daff0b656b2f3310b3ea100565ec844c69
2015-10-29 07:17:40 -07:00
Elliott Hughes
24704399cd Merge "Don't use VLAs in adb." 2015-10-27 22:47:05 +00:00
Alex Vakulenko
6ac83e416f Merge "core: Rename libchromeos into libbrillo" 2015-10-27 22:46:51 +00:00
Elliott Hughes
6d92997ec4 Don't use VLAs in adb.
This makes no measurable difference to the sync time; "adb sync" of
everything on /system for a Nexus 9 still takes 20s.

Change-Id: Ifa2626f7453937e43856b9c4ee06e1f5db0aa273
2015-10-27 15:46:41 -07:00
Steve Fung
f7416174ca Merge "crash_reporter: Make report log more useful" 2015-10-27 22:18:59 +00:00
Steve Fung
ef3c85a027 Merge "crash_sender: Properly handle curl errors" 2015-10-27 21:56:06 +00:00
Steve Fung
270f508b50 crash_reporter: Make report log more useful
Convert the crash reporter upload log to be json objects.
Report the product_id in the crash report upload log.  Also add
the exec name to the log to make it easier finding specific
crash reports if multiple binaries are crashing.

Bug: 25121166
Change-Id: I48ad88fcb0bb00b4a21dc6f2aa54f94cead971ea
2015-10-27 14:45:27 -07:00