• Home
  • History
  • Annotate
  • only in /frameworks/native/cmds/dumpstate/
History log of /frameworks/native/cmds/dumpstate/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ced6078b0e03a75d9b78e61ce25609bd2cb97b1d 24-Jun-2016 Mark Salyzyn <salyzyn@google.com> dumpstate: Also pick up /sys/fs/pstore/console-ramoops-0 for LAST KMSG

(cherry pick from commit 7d0a762ecaf9f4d005f0f6db913034c2e084d362)

Bug: 29639467
Change-Id: Iba0b1754eaebfb2b0624dcbef522b7d8456eeb50
umpstate.cpp
ab69cc1f11a7e391bd3bb017a22ed747da89b21b 22-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Run iptables as root." into nyc-dev
c0808155fd10d2d5c49bb4c8d4cafed8da28c182 18-Jun-2016 Felipe Leme <felipeal@google.com> Run iptables as root.

iptables requires root access and su is not available on user builds,
hence it must be ran before dropping uid to shell user.

BUG: 29455997

Change-Id: I10c6337b411875b061ae9556b6e9c44f83301ae1
umpstate.cpp
ea1aa91a25f28fb44f36b394e002ede56302eb30 16-Jun-2016 David Brazdil <dbrazdil@google.com> Merge "Revert "Attach profiles to bug reports"" into nyc-dev
236f7054ec9fcfde32c6ef39097791f0b158dfc2 16-Jun-2016 David Brazdil <dbrazdil@google.com> Revert "Attach profiles to bug reports"

This reverts commit 0faf2b870f934c1cdd883d29642fd84da3b352e2.

Bug: 28610953
Bug: 29395357
Change-Id: I609fe344dfc61311e37b91b48480d9392764a598
umpstate.cpp
3f83dbe2e0bb9cabe598ef0812ae358b1c5b415f 11-Jun-2016 Felipe Leme <felipeal@google.com> Fixed -t order (should be *after* dumpsys :-)

BUG: 29042642
Change-Id: I1b88634b0152f849a57f8e82adc82bdc5e609db7
umpstate.cpp
6ab3c01d1806e44976c10b34e5f6a5c5531c1da5 10-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Set version to 1.0" into nyc-dev
f678562fa46992f4f8792429f4237fb925db093f 10-Jun-2016 Felipe Leme <felipeal@google.com> Merge "Expose more useful functions that can be used by dumpstate_board()." into nyc-dev
12af7d51a1a0c4e98955ae58a69552b8f55904eb 08-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Explicitly sets dumpsys timeout." into nyc-dev
7cff462202437da5bba003a8687582af21fa0a0b 08-Jun-2016 Felipe Leme <felipeal@google.com> Explicitly sets dumpsys timeout.

The run_command() function takes a timeout as argument, and dumpsys can
also optionally takes a timeout with the -t argument, hence it makes
sense to pass the same value for both (otherwise dumpsys will timeout in
10s).

BUG: 29042642
Change-Id: Ib6e987d94e966686bab71223d7f910af9e549814
umpstate.cpp
0faf2b870f934c1cdd883d29642fd84da3b352e2 03-Jun-2016 David Brazdil <dbrazdil@google.com> Attach profiles to bug reports

Includes the entire '/data/misc/profiles' folder in the bug report
ZIP file if not user build.

Bug: 28610953
Change-Id: I99d46f024e5557cf94e6045a51c46a605a00c52b
umpstate.cpp
249beee359da256f7c41c481d45c06765b6a1d8a 04-Jun-2016 Calvin On <con@google.com> Expose more useful functions that can be used by dumpstate_board().

BUG: 28640932
Fixes: 28867848
Change-Id: I38123e5b348f4560212559176eb60dbad4f22364
umpstate.cpp
umpstate.h
ca9c12e64d44f6c67cd46819583239f0ad051a51 20-May-2016 Felipe Leme <felipeal@google.com> Set version to 1.0

BUG: 27366368
Change-Id: Iac8ed413d41d0c26a39343025920f433d5d7ddba
ugreport-format.md
umpstate.cpp
0816520c5cd60519d8e221ed92497aa5464e3039 30-May-2016 Erik Kline <ek@google.com> Use explicit path for /vendor/xbin/wlutil

At this time /vendor/xbin is not in root's path.

Bug: 28850734
Change-Id: Ib6c2b6f8b0285854670c843dcc437cfcc84484a8
umpstate.cpp
f7f2b0fd059bc26e27c022f3fb446fc74eab6c88 27-May-2016 Erik Kline <ek@google.com> Add "ip maddr" to dumpstate output for debugging.

Bug: 28966611
Change-Id: I8fdab94fbd41448e52f2fed406e8f43edf7f18ad
umpstate.cpp
6108f5d4004d2a3397c22d22025b8e0eb79b8467 23-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Expose functions used to add entries to the zip file." into nyc-dev
71ca15eadd3da0c102a8539f7a88294a94456623 20-May-2016 Felipe Leme <felipeal@google.com> Expose functions used to add entries to the zip file.

Currently only dumpstate.cpp is using the new functions and variables
used to add an entry to the zip file so they're defined locally, but
they should be exposed through the .h so they can be used by the
device-specific dumpstate_board() implementations.

This CL moves the following definitions to the .h:

- bugreport_dir
- ZIP_ROOT_DIR
- add_zip_entry()
- add_zip_entry_from_fd()

It also refactored functions that were taking a specific file location
to use bugreport_dir instead, to avoid pollution on main().

BUG: 28867848
Change-Id: Ic5faa203b0863bc950d640f22fb91977e52b6bfc
umpstate.cpp
umpstate.h
34222565fc9cf167d8ebe6068a9695f4b0b0f1b0 19-May-2016 Wei Liu <luciferleo@google.com> Fix the DUMPSYS skip.

b/28869921

Change-Id: Idc108b2d3cfd237f459467a3c399a0ba5e248d24
umpstate.cpp
f0922cc1786c0c2fbf44c10b0005243ecbb4227d 15-May-2016 Nick Kralevich <nnk@google.com> dumpstate: convert sprintfs to snprintfs

Bug: 28731007
Change-Id: Icfa4d6dfaf69e989ec785146a6bde1afb6a6f345
umpstate.cpp
tils.cpp
c4eee56dab06a7de1db18327f8d4831f89d1d640 22-Apr-2016 Felipe Leme <felipeal@google.com> Remove temporary file on user builds.

BUG: 27366368
Change-Id: Id85566f6ba02fcb6afc122ffe6990d0a14086375
umpstate.cpp
5c04e7465eda8a558244e772da1e7d2a0d5f94e2 14-Apr-2016 Andy Hung <hunga@google.com> Unify dumped native stack traces

Bug: 28179196

Change-Id: Ie728ceace7aaf38389dd9684342e351feed6e5a7
tils.cpp
ef1081f96d3c3915fe84c505674fbd70170ed284 13-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added support for 'bugreport -z'." into nyc-dev
2628e9e939fda323fa44c5cb743f4a77b12a312a 13-Apr-2016 Felipe Leme <felipeal@google.com> Added support for 'bugreport -z'.

Dumpstate now supports zipped bugreport, whose output is more complete
than the flat-file bugreports provided prior to N.

The whole workflow is split in different components:

- adb supports a 'bugreport -z <ZIP_FILE>' option, which calls a
bugreportz binary.
- bugreportz starts the dumpstatez service.
- dumpstatez starts dumpstate with some flags that opens a socket for
control (not output).
- Once dumpstate is finished, it prints the bugreport location to
stdout.
- adb pulls the zip file and renames according to the command-line
argument.
- bugreport prints a deprecation message.

The reason for a new binary (bugreportz) instead of passing arguments to
bugreport (like -z) is backward compatibility: pre-N versions of
bugreport would ignore such argument and generate a text bugreport,
which is not what adb would be expecting.

BUG: 27653204

Change-Id: I47f6f677eba11d5fb54818ae5a0b3cab069776ee
umpstate.cpp
umpstate.h
umpstate.rc
tils.cpp
a50117e54a97aea5b3b2c279fb5643704c460b05 13-Apr-2016 Nick Kralevich <nnk@google.com> Drop compatibility with pre 2012 adb clients

On very old versions of adb, when "adb bugreport" was executed,
the command "adb shell dumpstate" was run. This was later changed
to "adb shell bugreport". Change
1e339878c128ef47271278779c2685a8dfa49cd1 added a backwards
compatibility hack (see bug 6391938).

It turns out that nobody has been able to execute
/system/bin/dumpstate as a non-root user for 2 releases now due
to SELinux restrictions, so maintaining the code bloat to support
this workaround is pointless.

Delete the code.

Bug: 6391938
Change-Id: I49eebcca1fcec5a39593c53e2e6d23ec87f65a35
umpstate.cpp
cc37b8ecc463a3e030d673ebdd0b1cb9c5eddab8 11-Apr-2016 Felipe Leme <felipeal@google.com> Setting v1-dev4 as default.

BUG: 27618668
Change-Id: I59c3a7c256c4d059ae3c29411120d3e9c9a5d995
umpstate.cpp
90e840f00713bf9c1016c4f2584ef70e0a87ca14 01-Apr-2016 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: acquire /data/misc/logd/ log contents" into nyc-dev
29c39715b8a45ca2e97aecd8ebb63183f63da72b 01-Apr-2016 Felipe Leme <felipeal@google.com> Added option to redirect stdout on run_command_always.

There are cases where a command should not write to stdout. For example,
when sending the initial broadcast before the header is printed.

This change adds this option to run_command_always, and uses enums to
make it easier to read what's been passed to it.

BUG: 27953643

Change-Id: I9aed0cb0df4112b31d2079241114e206b9d0bb0c
umpstate.h
tils.cpp
4d42dea08915ccbb61ca05903af5330d02d66755 01-Apr-2016 Mark Salyzyn <salyzyn@google.com> dumpstate: acquire /data/misc/logd/ log contents

Bug: 27965066
Change-Id: I78c7ef4b45179729f505c3fe5d84c33a22ce41bf
umpstate.cpp
fbe08bfdfdadfcf05bb83e255fa12fc44202aa73 31-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Add build id as part of bugreport name." into nyc-dev
9385b1761aeaaee586cb4777345b18d5517821af 31-Mar-2016 Felipe Leme <felipeal@google.com> Add build id as part of bugreport name.

Rather than bugreport-DATE, the base bugreport name will be
bugreport-BUILD_ID-DATE, which will make it easier to identify
build associated with the report.

Since this change modifies the bugreport format, its version has been
increased to 'v1-dev4' and it is not enabled by default.

BUG: 27618668
Change-Id: I4492f8234520ee27c2eb0e4b8313fc937c498fea
ugreport-format.md
umpstate.cpp
14e034a02ec34b2c76afb06975bdfc943a9b5607 31-Mar-2016 Felipe Leme <felipeal@google.com> Dumps systrace to a file.

The atrace command can take a while, so rather than use a pipe it's
better to write its output to a temporary file and add that file to the
zip, timing out if necessary.

BUG: 27821761
Change-Id: I09f438077d001167d92da3009016bcab815ce530
umpstate.cpp
tils.cpp
baa85bd893665a48aee73d7ca7b73cd39b48f998 29-Mar-2016 Felipe Leme <felipeal@google.com> Call _exit() instead of exit() on child failure.

As explained on man _exit:

"The function _exit() terminates the calling process "immediately".
Any open file descriptors belonging to the process are closed;"

If exit() is called instead, the resulting zip file will be corrupted.

BUG: 27900023
BUG: 27804637
Change-Id: I6591749603753d6016f350c629b7082cf6780ae2
umpstate.cpp
tils.cpp
faf67e3fe2451e75d0369906a579d3e1386a5064 28-Mar-2016 Felipe Leme <felipeal@google.com> Increased estimated max progress of bugreports.

The initial estimate was based on earlier work done before new sections
were added, and it was too slow.

Ideally we should have a per-device estimate, but for N we'll just
increase the common max.

BUG: 26373682
Change-Id: I1a8ce7f09fc6588ac1513a20fa1149aab8c38351
umpstate.h
d6ab01105bbd80dfa2fc2debc8e31d6422c378ee 25-Mar-2016 Mark Salyzyn <salyzyn@google.com> dumpstate: Add /data/misc/recovery

(cherry picked from commit 23e86e91ff971a00f62954833a17df2dad1a13af)

Bug: 27176738
Change-Id: Ibc2342c6a29e5aebcac4875d7c2eed48fa8af7de
umpstate.cpp
ea160d134cd46c246859072f90ab5dd05ada6364 24-Mar-2016 Felipe Leme <felipeal@google.com> Improved (or warned about lack of) error handling.

It would be safer for dumpstate to exit when execvp on a child fails; a
common occurrence is when a list of command arguments is missing NULL.

dumpstate should be more robust to detect those missing NULL-terminated
args, but that will be addressed in a future change.

BUG: 27804637
BUG: 27832567
Change-Id: Ibcbe46041a86b16e365fbb40613b8c4bdf39744c
umpstate.cpp
tils.cpp
73f731c30a8b7d811127b8e89e01c427b6aab622 24-Mar-2016 Felipe Leme <felipeal@google.com> Fixed send_broadcast and fork handling issues.

send_broadcast() was calling run_command_always(char*, bool, int, char*) passing:
run_command_always(NULL, 20, true, am_args);

I.e., it was passing "true" (!1) as the boolean, and 1 (true) as the
timeout value; the proper call should be:

run_command_always(NULL, true, 20, am_args);

Also, the code handling failure on child calls was calling _exit(),
which quits dumpstate - it should simply return the function instead.

BUG: 27804637

Change-Id: If8c9b40eddc8b76f92e6d11078dfe446a39ad4d4
umpstate.cpp
tils.cpp
ec72578b8461a5601962ea8102fd74a1f86d91fb 23-Mar-2016 Felipe Leme <felipeal@google.com> Flushes stdout when execvp fails.

BUG: 27804637
Change-Id: Idf414a1d08bf51854475c74767588a4814c8d806
tils.cpp
b0133cdeaa98afa55249546f68b6167f1dde65b8 23-Mar-2016 Felipe Leme <felipeal@google.com> Handled failure of execvp and increases am timeout.

The run_command_always() call fork and runs the command in the child
code, and user to have the above logic:

if (pid == 0) {
// boiling code
execvp(command, (char**) args);
// execvp's result will be handled after waitpid_with_timeout() below...
_exit(-1); // ...but it doesn't hurt to force exit, just in case
}

Recently, the _exit(-1) line was removed and there's been reports of
dumpstate hanging after, because it tries to wait for pid 0 to
finish (and in some cases it even tries to kill it).

Also increased the timeout when running am to send broadcasts.

BUG: 27804637
BUG: 27809534
Change-Id: Ia129253e367e5886d305947e56a643fd660a33bd
umpstate.cpp
tils.cpp
8b78b758a8b5b831c48562233df055c22e2541af 22-Mar-2016 Thierry Strudel <tstrudel@google.com> dumpsys: make timeout value an argument

Also rework the args parsing using getopt_long.

Bug: 27788406
Change-Id: I60fd8e614616334d47b8de574f3c81a121a6ac0a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
umpstate.cpp
26ae72392e76e4acc82842f4a53ad41bcbc6811e 21-Mar-2016 Felipe Leme <felipeal@google.com> Fixed typo.

BUG: 27419521

Change-Id: Ie9f0b24876353e532f4ebe2ff4935938c3c7a781
umpstate.cpp
7363bafd0a94aa98a267edbbcb27abc9ef72f1dd 21-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Don't use su to when calling am or dumpsys." into nyc-dev
71a74ac75c8687195d27642fa0db31a796102c59 17-Mar-2016 Felipe Leme <felipeal@google.com> Capture systrace buffers.

When tracing is enabled (/sys/kernel/debug/tracing/tracing_on = 1),
dumpstate will run 'atrace --async_dump' and redirect its output to a
systrace.txt entry in the zip file.

BUG: 27419521
Change-Id: Ia6de46a691b25febac31331fe0aa8701c9a84ebb
ugreport-format.md
umpstate.cpp
umpstate.h
tils.cpp
3dba69aad214a873c619d125ff0441b817947100 17-Mar-2016 Felipe Leme <felipeal@google.com> Added -q flag to showmap.

dumpstate calls showmap for each pid, and since most of them are empty,
it ends up polluting logcat with entries like:

03-17 14:49:05.974 12160 12160 E dumpstate: command '/system/xbin/su
root showmap -q 9867' failed: No such file or directory

BUG: 26906985
Change-Id: I7e064b2ec8901b6ccee49b228be96ff2847c703c
tils.cpp
cf6a8b47dc04f1c33ddc337b5e21f2c5b7354cb5 11-Mar-2016 Felipe Leme <felipeal@google.com> Don't use su to when calling am or dumpsys.

su is not available on user builds anymore, hence the bugreport
notifications would never be sent on those builds. Instead, it should
explicitly drop root using system calls.

BUG: 27583193
Change-Id: Ia6256b241fdd6ab4c059fb764b10b4445ad6551d
umpstate.cpp
umpstate.h
tils.cpp
d3d45c3dddf48d557f2b0d622df8ebc1317f9bb5 17-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Improve logging of child commands." into nyc-dev
a34efb7ae17a7ea1078cce75be634120bd72a421 11-Mar-2016 Felipe Leme <felipeal@google.com> Improve logging of child commands.

When execvpe() is called it doesn't return, so the child error handling
should be done at the parent, otherwise the failure is not printed in the bugreport.

BUG: 27583193
Change-Id: I6161e4c72b7b0da7b82bff7fd72d7a5aaf4d6e89
umpstate.cpp
umpstate.h
tils.cpp
26bd34c984f11dcfc241fecf7858d16f87f3bc1a 15-Mar-2016 Felipe Leme <felipeal@google.com> Added zip location on log message.

BUG: 27660862
Change-Id: I6e9dc816955762fde0d4ddb9ac4cbf12b607cbbd
umpstate.cpp
f7f2651e0c07d138679fd405999f30d0ab35e10b 11-Mar-2016 Lorenzo Colitti <lorenzo@google.com> Pass -n to netstat.

netstat does lots of DNS lookups, which will slow down the dump
process and creates the risk that the dump will be incomplete.

Bug: 26154009
Change-Id: Ibefa259bf74e85ab8dbdfac76f82c101d47686a7
umpstate.cpp
e4eb4f0e2380f698d31b0089fb0e22020b70c2bc 11-Mar-2016 Lorenzo Colitti <lorenzo@google.com> Merge "Remove the route command from dumpstate." into nyc-dev
990bcce0fddc765f8d5398b431ab461a775fc10c 11-Mar-2016 Lorenzo Colitti <lorenzo@google.com> Remove the route command from dumpstate.

Its output is irrelevant and misleading, because:

1. It only looks at the "main" routing table, which is a last
resort routing table that is trumped by all other networks and
cannot even be used by non-root users.
2. The proper way to understand device routing is to look at the
output of "ip rule" and "ip route", both of which are already
in the bugreport.

Bug: 26154009
Change-Id: Ice19799639daa156a0d4dbb69915031e5582a8ed
umpstate.cpp
107a05f72e711c92545d0be648ab79c4f858f372 09-Mar-2016 Felipe Leme <felipeal@google.com> Improved usage of stderr for logging.

Dumpstate have some macros that write logs to both ALOG and stderr,
which is useful when the latter is redirected to a file.

But prior to this change, only the log statements from dumpstate.cpp
were using it, and utils.cpp was logging to stderr directly.

This change not only uses MYLOGE for all error messages, but also closes
stderr at the very end (so it doesn't miss statements like the
parameters sent to send_broadcast) and uses MYLOGD for the overall progress.

BUG: 27437378
Change-Id: I373a523e20c98d8f445822103784fa9900c6c684
umpstate.cpp
tils.cpp
9c74aadb40cb5982cd38410529d464485c182058 01-Mar-2016 Felipe Leme <felipeal@google.com> Removed temporary 'v1-dev1-dumpsys-split' version and bumped version to
'v1-dev2'.

BUG: 26639621
Change-Id: I5f26272d221330b01d2b873e00105a8f8b739b63
umpstate.cpp
ed9e142fb6874cd1d3cbeb655c700c9a0126ba5a 27-Feb-2016 Felipe Leme <felipeal@google.com> Merge "Rename .zip file if necessary." into nyc-dev
9127435ffbb081fe91a30169f394a57fd31fd05e 27-Feb-2016 Felipe Leme <felipeal@google.com> Rename .zip file if necessary.

Users have the option to rename the suffix of the files generated by
dumpstate by letting Shell set the dumpstate.PID.name property.

This works fine for text files and used to work for zip files as well,
but now the zip file is opened earlier in the process, so it has to be
renamed at the end.

BUG: 27384407
Change-Id: I288d8eb4a3ffe0161b86cdce14f63e9bfdf865ab
umpstate.cpp
cc2a2fa64e22378d980ae0ae95c8865ebea05f69 25-Feb-2016 Felipe Leme <felipeal@google.com> Moved final vibration to the end of the process.

BUG: 26347468
Change-Id: I872d9175fd09b47da512cb2da11a533a921d9a5c
umpstate.cpp
503ebdbc5ecae9dda74124a4350c40f81a695c02 24-Feb-2016 Felipe Leme <felipeal@google.com> Merge "Improved dumpstate logging." into nyc-dev
c4e490047a7dd605fb087b71d3b97182e409985c 23-Feb-2016 Felipe Leme <felipeal@google.com> Merge "Send max duration when bugreport is finished so Shell can update metrics." into nyc-dev
ee2e4a01f9ca9aae7ee111abcd5c139fc810bf65 23-Feb-2016 Felipe Leme <felipeal@google.com> Send max duration when bugreport is finished so Shell can update
metrics.

BUG: 26759986
Change-Id: If599bfb2558c523e64fd6f176eeb494d3e116928
umpstate.cpp
f9dbae88419bc5bb272a41cceadd1b4e318f5572 22-Feb-2016 Ruchi Kandoi <kandoiruchi@google.com> dumpstate: Remove deprecated /proc/wakelocks

Bug: 13930710
Change-Id: I64733a6093ca227aaee29fc58288a964b7b6b7f9
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
umpstate.cpp
88c7933df551f6dadd8cc931d104b01d6d1609e4 22-Feb-2016 Felipe Leme <felipeal@google.com> Improved dumpstate logging.

BUG: 26906985
Change-Id: Id439560504a365961337fddcca4ba6c1ef9f377d
umpstate.cpp
umpstate.h
tils.cpp
60292e5c8324475c5afbd0a6703b6b3ae2c94b1a 16-Feb-2016 Xia Yang <xiay@nvidia.com> dumpstate: remove length modifier on assignment suppressed scanf item

gcc throws warning for using the two together as there is no point specifying
storage size if the item is not to be stored. With -Werror enabled in this
module, such warning breaks the build under gcc compiling.

Change-Id: I6478c7cdb39f4709a63089191cc4ff541564cea4
tils.cpp
861dd225fcd53f3e8d10469600648226c6e887cf 16-Feb-2016 Xia Yang <xiay@nvidia.com> dumpstate: remove -std=gnu99

-std=gnu99 no longer has effect now that dumpstate is C++.

The flag also break build if target platform is configured to default
gcc compiler since gcc throws warning for having -std=gnu99 when compiling
C++ and we have -Werror for the module.

Reproduce:
mm LOCAL_CLANG=false
...
error: command line option '-std=gnu99' is valid for C/ObjC but not for C++ [-Werror]

Change-Id: If1c272868ec4626873e7d91342b1fea51a15c52e
ndroid.mk
6fe9db67f6c92d5fbf87d371da5cca412f672630 12-Feb-2016 Felipe Leme <felipeal@google.com> Changed permission of temporary bugreport and dumpstate log files to Shell.

BUG: 27164100

Change-Id: I569cbe4854fad44c95c9bf3e2efa9c3c93317003
umpstate.cpp
421c1c07e73ef91a8fb887ad0045f37335722b2e 12-Feb-2016 Felipe Leme <felipeal@google.com> Merge "Split bugreport identifier into id and pid." into nyc-dev
d5e724a4d3f77024d311b1b4e01846e41fdbe98b 11-Feb-2016 Felipe Leme <felipeal@google.com> Send broadcasts as Shell.

The BUGREPORT_STARTED was being sent as root, which would cause it to
bypass Shell restrictions when DISALLOW_DEBUGGING_FEATURES is set.

Also added the missing --receiver-background and unhardcoded shell's uid
from previous changes.

BUG: 26814173

Change-Id: I867361efafb96c7e709f83806a9301afc637a27e
umpstate.cpp
tils.cpp
fdf52d3697aa0396bd9d8883892937b99a6772a0 02-Feb-2016 Srinath Sridharan <srinathsr@google.com> Split dumpsys into critical and non-critical sections.

Order in which we report stats in bugreport can disrupt cpu and memory
stats. This CL sorts the bugreport process
from least impactful to most impactful to try and keep the
system stats as close to its initial state as possible throughout the BR (eg.
things like dumpsys meminfo should run before dumping thread stacks)

BUG: 26639621
Change-Id: I29dccfd423d83a6a69b7e025d45cb9cebfc41cc4
umpstate.cpp
tils.cpp
1b0225a4792d92ff67ac8a0aa79352fad40bd805 10-Feb-2016 Felipe Leme <felipeal@google.com> Fixed format.

Change-Id: If0322e3dcf56005541aa08e0ab91dae10d2d385d
umpstate.cpp
60869c9e1e91170d487715fc30b795d786630c54 10-Feb-2016 Felipe Leme <felipeal@google.com> Fixed C++ syntax.

Change-Id: I9702fdede589dd37cb498bbf63c0773816a7e3b8
umpstate.cpp
umpstate.h
a297c3258f6f7ea52cc2dcc42d62f85fda12a163 06-Feb-2016 Mark Salyzyn <salyzyn@google.com> dumpstate: report process times

(cherry picked from commit 0751efa64cddfab69749236193e776058c9db595)

- Fix per-pid helper to pick up comm if cmdline is empty
and assume kernel thread.
- Add per pid report command line user time if not kernel thread,
system time and I/O time, plus percentage if non zero.

Bug: 26966375
Change-Id: I6b499f535cc3687eb468b32ae39e7d151dffb11f
ndroid.mk
umpstate.cpp
umpstate.h
tils.cpp
8fecfdda012928bc2fe6d0e66fd4a4c912946254 09-Feb-2016 Felipe Leme <felipeal@google.com> Split bugreport identifier into id and pid.

Although 'pid' is more useful when diagnosing problems with the
bugreport workflow, it could be confusing to the end user. Hence, a
sequential id (started at 1 after a reboot) would be more useful.

BUG: 27076108
Change-Id: I6fd7ea8c703e8040034af183ef5cd35adfbcb4ef
umpstate.cpp
cbce55d4fdbdd2e5a5515054c48d2116c5db2712 08-Feb-2016 Felipe Leme <felipeal@google.com> Improved dumpstate logging.

dumpstate generates 3 types of output:

- stdout: used for the bugreport itself and is redirected to a file
if requested.
- stderr: used for errors, is only useful when dumpstate is called from
adb (otherwise is ignored).
- ALOG: logged into logcat and available in the bugreport.

This current approach has 2 problems:

- stderr output is ignored when dumpstatet is called from bugreport
services.
- bugs on dumpstate are often hard to diagnose
(AKA 'Who watches the watchmen?').

This change mitigates these problems by redirecting stderr into a log
file (which will also be included in the bugreport notification) and by
keeping the .tmp file around (for the extreme cases where the .zip file
could not be generated or got corrupted).

BUG: 26906985
Change-Id: I73e7b1dd10ad9f83b7aa1043131ff3b74c426fdb
umpstate.cpp
umpstate.h
tils.cpp
0078b180aeacc7b0cb89ec14cfa3326489392059 07-Feb-2016 Jeff Sharkey <jsharkey@google.com> Merge "Migrate default app data on non-FBE devices."
cc6281cf8146cddb8ace7cbd58c67321639c1520 07-Feb-2016 Jeff Sharkey <jsharkey@android.com> Migrate default app data on non-FBE devices.

When a system app requests "forceDeviceEncrypted" they expect their
default app storage to point at a consistent location regardless of
device FBE support. So when booting upgraded non-FBE devices, we
may need to migrate any data from CE to DE. Note that on non-FBE
devices these are just semantic locations with identical protection.

This migration *only* works for non-FBE devices; changing
forceDeviceEncrypted flags on an FBE device always requires a full
data wipe.

Bug: 26668510
Change-Id: I8bd5b8ba882e6bd067c0381041b27c35d6e47788
umpstate.rc
010f15bb6dadc92e25cae52142ee13036adc5a73 05-Feb-2016 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: refine calculated eMMC performance values" am: 088e7586ea am: 917b324e19
am: a960bc95b2

* commit 'a960bc95b2430ba01fc4b04b4527d32e00eeb4b5':
dumpstate: refine calculated eMMC performance values
a960bc95b2430ba01fc4b04b4527d32e00eeb4b5 05-Feb-2016 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: refine calculated eMMC performance values" am: 088e7586ea
am: 917b324e19

* commit '917b324e19121766a9f8112d0fbc4424f172e615':
dumpstate: refine calculated eMMC performance values
01d6c3935ace93f208fa3d93802b286e7484cfae 04-Feb-2016 Mark Salyzyn <salyzyn@google.com> dumpstate: refine calculated eMMC performance values

Correct the raw performance with the average queue depth. Add a
report for I/O per second, and the average queue depth. Round
values up.

Bug: 26966375
Change-Id: I2a8d233872d5e5ff79d433abba3c34d5945701f4
umpstate.cpp
111b9d06cc0fc72438782c9234f28675e5077ef4 03-Feb-2016 Felipe Leme <felipeal@google.com> Improved how the Shell directories are created.

When dumpstate is run for the first time, the
/data/data/com.android.shell/files/bugreports does not exist, which was
crashing dumpstate because the code that added the version.txt entry was
not checking if the zip_writer was NULL.

The crash itself was fixed by adding a sanity check in the functions
that add entries to the zip file, but that only hid the real problem:
it is necessary to create the parent directories before creating the zip
file, otherwise the first run will always generate a .txt file (since
dumpstate falls back to .txt when it cannot create the .zip).

This change also improves how the parent directories are created by
checking if they exist first, rather than always calling mkdir().

BUG: 26949960

Change-Id: I1434be5c36a3fad0b3a2a26c7eaaab03a1228c30
umpstate.cpp
umpstate.h
tils.cpp
809d74e92c16cf694c929b8ca2b54515af13e9fe 02-Feb-2016 Felipe Leme <felipeal@google.com> Added metadata entries to zipped bugreport:

- version.txt: bugreport format version
- main-entry.txt: name of the entry containing the main bugreport (flat file)

Also documented the zip format versions on bugreport-format.txt.

BUG: 26910355
BUG: 26639621

Change-Id: I76b9f6d330c36ad554fae8e691c9ea3ab3c97edd
ugreport-format.md
umpstate.cpp
608385dd151e36a93f3e3f4a7514b1e720d20ae9 01-Feb-2016 Felipe Leme <felipeal@google.com> Redirect output to file ASAP, otherwise printf() calls might be missed.

Also removed the duraction reporter on add_zip_entry_from_fd - since it
was spamming the report and the timing could be infered by calculating the
delta between each ALOGD entry anyways - and logged PID and statistics.

BUG: 26885492
Change-Id: Iadb00957daac68b7a40b0e36ee5cce2b82264588
umpstate.cpp
umpstate.h
tils.cpp
0b53106639154710039fc4185662f2b4101e8e91 29-Jan-2016 Felipe Leme <felipeal@google.com> Merge "Proper fix of am args."
43fd1bbc6675430a4ecfde07e88a414ed5c41c0c 29-Jan-2016 Felipe Leme <felipeal@google.com> Proper fix of am args.

BUG: 26871362
Change-Id: If3411b69ea1feef827cd23ef81baa8c0ffeaa309
umpstate.cpp
942c50d1e5fa92a8e9b5c5a20a6918ee72ee68f2 29-Jan-2016 Felipe Leme <felipeal@google.com> Merge "Fixed usage --receiver-foreground on am call."
b0b4aa2d1df3c2c1f591776083a33cd28ad306bd 29-Jan-2016 Felipe Leme <felipeal@google.com> Fixed usage --receiver-foreground on am call.

BUG: 26871362
Change-Id: Ied8e663eec59c83a06a8f2a6e2908c02ac1558c8
umpstate.cpp
tils.cpp
f5248da50134b087cbe8b58d2e1d2310537911e3 28-Jan-2016 Chien-Yu Chen <cychen@google.com> dumpstate: enable cameraserver

Enable bugreport callstack dump for cameraserver.

Bug: 24511454
Change-Id: I8f4b14a95b3a1abedc4cf072335f0f31b18006af
tils.cpp
edb0b0c309dd1a48d127f691e6d9b29392d1af44 27-Jan-2016 Felipe Leme <felipeal@google.com> Pass --receiver-foreground to AM intents.

BUG: 26805230
Change-Id: I29181367522353817c730b398550a738a4776594
tils.cpp
770410dcf2f72cf4e806442263e63719a0be0f5a 27-Jan-2016 Felipe Leme <felipeal@google.com> Fixed performance issue by moving buffer allocation outside loop.

Also improved logging.

BUG: 26637170
BUG: 26777547
Change-Id: I99511f3f71c58eba1f5539508f9a685d0a58cc58
umpstate.cpp
tils.cpp
876de450004b02b9c028ece0d3ca850504caaa4d 26-Jan-2016 Mark Salyzyn <salyzyn@google.com> Merge "Revert "dumpstate: Add security log dump"" am: 316923d359
am: fd0d76730f

* commit 'fd0d76730f06bec15c90e9a9da64ee19361c3a9f':
Revert "dumpstate: Add security log dump"
fd0d76730f06bec15c90e9a9da64ee19361c3a9f 26-Jan-2016 Mark Salyzyn <salyzyn@google.com> Merge "Revert "dumpstate: Add security log dump""
am: 316923d359

* commit '316923d3597af72d1cbd9eb2745a02706275fdb8':
Revert "dumpstate: Add security log dump"
43afe5d0b537999d5de9613626eca24f34cc52ef 26-Jan-2016 Mark Salyzyn <salyzyn@google.com> Revert "dumpstate: Add security log dump"

This reverts commit c7ad8cb82f035576c28707a8cbeb16b7ead2a4e7.

Bug: 26029733
Change-Id: I0c61f4d2c0aa9e07c6cc7b190d803e98c3a98d40
umpstate.cpp
f3599b35c5f7f86cced0f3386a6c80e0b552f358 26-Jan-2016 Nick Kralevich <nnk@google.com> dumpstate.cpp: collect command line earlier

We need to collect the command line before we use it.

Bug: 26777547
Change-Id: I715adce62511c4cc553eb462d853559687a1677f
umpstate.cpp
cbbdf73608bace91270622034e4813a2355b7bf1 07-Jan-2016 Michal Karpinski <mkarpinski@google.com> Improvements for SHA256_file_hash()

Bug: 26154009
Change-Id: I7cee0563edb7e8030716ae2925a940f3c158721e
umpstate.cpp
4db754fd7c13993d81d98157f10e8015422d1e3a 11-Dec-2015 Michal Karpinski <mkarpinski@google.com> dumpstate.cpp changes to accomodate remote bugreports

Added four new commands to dumpstate() - route, printenv, netstat
and lsmod.
Added -R flag for remote bugreports, which will send
android.intent.action.REMOTE_BUGREPORT_FINISHED broadcast with an extra
SHA256 hash counted by a new method SHA256_file_hash(path).

Bug: 26154009
Change-Id: Ibd7cb8f38dfc8f0fa3fda3e56dcd04b7d1fe68b9
ndroid.mk
umpstate.cpp
c9677274372318e2b1cd817c24cd44f312aee662 07-Jan-2016 Michal Karpinski <mkarpinski@google.com> Merge "Adding new bugreportremote service"
635ca31754ae734b0c540ac5600d58ae55cd4237 05-Jan-2016 Felipe Leme <felipeal@google.com> Include mount info on zipped bugreport.

BUG: 7280247
Change-Id: Iae2a7881c11564c8dbd3641f5ee5ab72c181da2a
umpstate.cpp
tils.cpp
e82a27d0c1e3f2cef6f13a1a9efff55638601752 05-Jan-2016 Felipe Leme <felipeal@google.com> Adds recovery files when writing to zip file.

BUG: 25351711
Change-Id: I3bac7a0d3a6f388b46570595d22436f0a4f74bee
umpstate.cpp
0c80cf0caaf5dce5ef4d0265b249bd1ec680cca1 05-Jan-2016 Felipe Leme <felipeal@google.com> Adds all tombstone files when writing to zipped file.

Currently, a bugreport simply cats any tombstone file modified in the
last half an hour into the bugreport. This is a problem since the
tombstones contain a lot of really valuable information, and sometimes
users don't get a bugreport in this time frame. In addition, some of our
monkey testing has the same problem.

Since now dumpstate can create a zip file, we can include all directly
on it, although still using the old mechanism when it's creating it (for example, when invoked through 'adb bugreport').

BUG: 25974224
Change-Id: Ie29fd7d91953d91232b0db1c9588043aee13f93e
umpstate.cpp
umpstate.h
tils.cpp
1e9edc619c6b1ca3998a26eaa4882b55ce801f12 22-Dec-2015 Felipe Leme <felipeal@google.com> Refactored zipfile generation.

Previously, the bugreport.zip was only created at after dumpstate
finished, at which point the temporary file was added to it.

With this refactoring, the bugreport.zip is created earlier on and the
temporary file is added at the end: although this change doesn't alter
the final result, it allows future changes to add more files to the .zip

BUG: 26293568
Change-Id: Ic0a111d009aac954c9746130df226a2dfeb679bc
umpstate.cpp
78f2c86235d5882a8dc84c85a1c1864062e5f3af 21-Dec-2015 Felipe Leme <felipeal@google.com> Prints out how long it takes to generate each section.

It's done using a DurationReporter helper class that prints starts
counting when constructed and prints the duration when destructed.

Typical usage:

function do_something() {
DurationReporter duration_reporter(title);
// Do something.
}

Change-Id: I87134d9a1b003300384376c242a3c034a46244c4
umpstate.cpp
umpstate.h
tils.cpp
6834ea7ee3338066e44235c990da1ab75417e33e 21-Dec-2015 Felipe Leme <felipeal@google.com> Removed the -p option since screenshots are now taken by Shell.

BUG: 26274653
Change-Id: I55760fe01bded0d194f2c56ebc809d555ceedf77
umpstate.rc
b922d6941c257f39af42d4dd4c66e6657b9bae73 15-Dec-2015 Michal Karpinski <mkarpinski@google.com> Adding new bugreportremote service

Bug: 26152603
Change-Id: Ibe5c908f69b0f2cd704ab5c7f71a7ff13da021e3
umpstate.rc
9609bbd79668dbc3c8c16c773c92637de98bfa70 15-Dec-2015 Andy Hung <hunga@google.com> dumpstate: add audioserver

enable bugreport callstack dump of /system/bin/audioserver

Bug: 24511453
Change-Id: I1c73c2ec299913b717e69b357bd669babafe58d1
tils.cpp
32a59625e0a70eb38648320ddde84e6c91cc9cef 15-Dec-2015 Felipe Leme <felipeal@google.com> Merge "Migrated dumpstate to C++."
am: 1f62517b36

* commit '1f62517b3654a3c0e95ea4d5b3664fac8115acdf':
Migrated dumpstate to C++.
515eb0db0a03de0a721ef034b3f3898e1d7e42e7 15-Dec-2015 Felipe Leme <felipeal@google.com> Migrated dumpstate to C++.

Changes required:

- Explicity casting function pointers.
- Moving variables initialization before 'goto' statements.
- Changing string references from 'char *' to 'const char *'.
- Using 'extern "C"' so device-dependent implementation of
'dumpstate_board()' can be written in C or C++.

BUG: 25563823

Change-Id: Ibeb70fd23e64e9b530736b554a372cb232fe1a44
ndroid.mk
umpstate.c
umpstate.cpp
umpstate.h
ibdumpstate_default.c
ibdumpstate_default.cpp
tils.c
tils.cpp
f1d82f4aca7e6b535aa74464906fb06c9807c0af 14-Dec-2015 Felipe Leme <felipeal@google.com> Merge "Moved 'bugreportplus' from init.rc to dumpstate.rc"
8d1d572f907fe68e666f8d77dd30b7b15afd9a45 14-Dec-2015 Felipe Leme <felipeal@google.com> Moved 'bugreportplus' from init.rc to dumpstate.rc

BUG: 26034608
Change-Id: I633a5c0ca34ab60cfd5b9c8052b546970288d9d6
umpstate.rc
dca3004731b77dad2bdb26336e0061f63bacf35c 14-Dec-2015 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: Add security log dump" am: bc611a1d3e
am: 0c124edf7c

* commit '0c124edf7c633588e300f1855d22739194ba7194':
dumpstate: Add security log dump
0c124edf7c633588e300f1855d22739194ba7194 14-Dec-2015 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: Add security log dump"
am: bc611a1d3e

* commit 'bc611a1d3e2beea849a251fecda096ed142519a6':
dumpstate: Add security log dump
c7ad8cb82f035576c28707a8cbeb16b7ead2a4e7 11-Dec-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: Add security log dump

Bug: 26029733
Change-Id: I2e5b44d642bbac7f62f63388dd8a3123f2abeafe
umpstate.c
7def230c05111876d44f56cd2a4f711b4b408c48 11-Dec-2015 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: build breakage @2482293" am: c93d0937e4
am: 8197219a6e

* commit '8197219a6e34d72174fc69ff60608afec912a4f4':
dumpstate: build breakage @2482293
8197219a6e34d72174fc69ff60608afec912a4f4 11-Dec-2015 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: build breakage @2482293"
am: c93d0937e4

* commit 'c93d0937e4e86a260f4dc6b91971b6750f67a3f3':
dumpstate: build breakage @2482293
4b45d6732c649aa15799076d68e5fb5a170819bc 11-Dec-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: build breakage @2482293

aosp is in C, internal is C++, struct must be explicit

Bug: 24200279
Change-Id: I1c9d8156a86db6de73ee5b70063e63b38170b052
tils.c
f55d402132afa4b9dd38aa69e50ec7b7efb1927c 11-Dec-2015 Mark Salyzyn <salyzyn@google.com> resolve merge conflicts of 01c1129fe6 to master.

Change-Id: I84f862b4858ecc97461750833a0e6f9cf96c34c4
01c1129fe60785ee7b5707fbaabf24f44f030c13 11-Dec-2015 Mark Salyzyn <salyzyn@google.com> Merge "dumpstate: Dump eMMC 5.0 stats"
am: f9b3fc457f

* commit 'f9b3fc457f22be834e6bc6c3f704d7ddb38dcbb8':
dumpstate: Dump eMMC 5.0 stats
8c8130eb68c89987a94db084608a4229bad06c18 09-Dec-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: Dump eMMC 5.0 stats

Extended csd EXT_CSD_REV, PRE_EOL_INFO, DEVICE_LIFE_TIME_EST_TYP_A,
and DEVICE_LIFE_TIME_EST_TYP_B fields printed if available. Allow
dumpstate access to /sys/kernel/debug/mmc0/mmc0:0001/ext_csd.

Bug: 24200279
Change-Id: I310bdcf546a9307cf927f109359ad5a6d24b70f8
umpstate.c
umpstate.h
umpstate.rc
tils.c
8c5ac0a92605a62bff21c23c520ecbf833d683bc 09-Dec-2015 Felipe Leme <felipeal@google.com> Merge "Fixed logic that was passing NULL to a std::string parameter and crashing dumpstate."
3634a1e3459cb609da709646107e246cafbc01f9 09-Dec-2015 Felipe Leme <felipeal@google.com> Fixed logic that was passing NULL to a std::string parameter and
crashing dumpstate.

BUG: 8420215
Change-Id: If2f3ebad559683b5b6a8c2209de93ac3bec4fb1e
umpstate.cpp
umpstate.h
tils.cpp
b744ac2a7d537dd7227a23ebfc43cff0259dee27 09-Dec-2015 Felipe Leme <felipeal@google.com> Merge "Take screenshot right away when invoked with -P."
9dc117c415d0df0a3acd900709d05deabe975704 07-Dec-2015 Elliott Hughes <enh@google.com> Track rename from base/ to android-base/.

Change-Id: I13839256a0fb159a3b53009c2cb6b0fa639bad2e
umpstate.cpp
e338bf60701e5b955ab0a097f2631f2190218894 07-Dec-2015 Felipe Leme <felipeal@google.com> Take screenshot right away when invoked with -P.

Traditionally, the screenshot was not taken right away because it could
skew other services like the Surface Flinger, and such approach often
resulted on irrelevant screenshots.

Now there is more user-friendly workflow, where the bugreport progress
is shown in the UI and the user can take further actions. In this
workflow, it's ok to take the screeshot right away, since the other
features might already be causing interference: if the user doesn't want
interference, the old workflow should be used instead.

Since the new workflow requires the -P (for Progress) parameter, such
parameter can also be used to determine when to take the screenshot.

Also added progress statistics at the end of the bugreport.

BUG: 8420215
Change-Id: I9dad8ea59d47848f217182ccec0f527b42e07f50
umpstate.cpp
umpstate.h
tils.cpp
ad5f6c475934ac6a658a203069a9f055540946e7 30-Nov-2015 Felipe Leme <felipeal@google.com> Minor improvements in the bugreport progress workflow:

- Allow users to rename the suffix in the bugreport files by setting the
dumpstate.pid.name system property. For example, instead of
bugreport-2015-12-02-15-23-46, it could be bugreport-My-App-Crashed.

- Dynamically adjust the max weight if the current progress overflows
the previous max (and set the dumpstate.pid.max system property
accordingly, so UI can be updated as well).

- Strip .txt from the name sent on BUGREPORT_STARTED.

BUG: 25794470
Change-Id: I7634ddd2975bcf93d6612d16c09da1cd7b4e1d91
umpstate.cpp
umpstate.h
tils.cpp
8ab87b6efebb50892b6e28b9acfd4c33a2a88ac8 01-Dec-2015 Felipe Leme <felipeal@google.com> Merge "Fix initial value of do_update_progress."
08b5578b7370b11e6eeb1f2619fd9d54b0536760 01-Dec-2015 Felipe Leme <felipeal@google.com> Fix initial value of do_update_progress.

Since it was set to 1, dumpstate (and bugreport as well) would fail if
-o option was not set.

BUG: 25944860
Change-Id: Iafcb2bc6a4120ebff237f25a998a3c528d7bc1aa
tils.cpp
e159c7f25d52636b01e9d8bc7d6175c2263696be 30-Nov-2015 Sharvil Nanavati <sharvil@google.com> Increase raft timeout to 10min so we get complete logs from older devices. am: 804339a59e am: 7126caa17f am: c3ee5e8fb9
am: 47c010ce75

* commit '47c010ce750a1af707f6eee28cd5458fba6f1439':
Increase raft timeout to 10min so we get complete logs from older devices.
47c010ce750a1af707f6eee28cd5458fba6f1439 30-Nov-2015 Sharvil Nanavati <sharvil@google.com> Increase raft timeout to 10min so we get complete logs from older devices. am: 804339a59e am: 7126caa17f
am: c3ee5e8fb9

* commit 'c3ee5e8fb94e1af7338e4217afb3365531ae0309':
Increase raft timeout to 10min so we get complete logs from older devices.
c3ee5e8fb94e1af7338e4217afb3365531ae0309 30-Nov-2015 Sharvil Nanavati <sharvil@google.com> Increase raft timeout to 10min so we get complete logs from older devices. am: 804339a59e
am: 7126caa17f

* commit '7126caa17f4b76632335daa8090ba9e37db35102':
Increase raft timeout to 10min so we get complete logs from older devices.
9c5440cdfc1fe6a5604abfd91e8d160542a36212 30-Nov-2015 Felipe Leme <felipeal@google.com> Merge "Adds a -P option so dumpstate can report its progress."
804339a59e4abcbcf5a50a60ff0543e6b404e572 28-Nov-2015 Sharvil Nanavati <sharvil@google.com> Increase raft timeout to 10min so we get complete logs from older devices.

Devices like dory get slammed when bugreports are taken and can't
compress all the raft logs in the current 5min timeout. Our dogfooders
spend their precious time getting us bugreports and then we can't act
on them because we have broken raft logs. :(

This change bumps up the timeout in the hopes that we can get complete
logs from even our slowest devices.

Change-Id: I10741a6185b39544f4c0531f0ee74864d74a1aa4
umpstate.c
b82c925d3cd54d5eff9f4f9e6d5aeb41f75365f5 28-Nov-2015 Nick Kralevich <nnk@google.com> dumpstate: call su before executing librank

librank uses /proc/PID/pagemap . Rather than granting dumpstate
CAP_SYS_ADMIN, have librank run from the SU domain.

Addresses the following denial:

avc: denied { sys_admin } for pid=6442 comm="librank" capability=21 scontext=u:r:dumpstate:s0 tcontext=u:r:dumpstate:s0 tclass=capability permissive=0

This also allows us to remove the setuid bit from librank,
which will be done in a different commit.

Bug: 25739721
Change-Id: Ibf20d67dbe01b95e5cbb860a7e0eb767b8beb74a
umpstate.cpp
71bbfc57974331dce79242ce806d92035fce06ba 23-Nov-2015 Felipe Leme <felipeal@google.com> Adds a -P option so dumpstate can report its progress.

The old workflow was:

1. dumpstate starts.
2. When dumpstate finishes, it sends a BUGREPORT_FINISHED event.
3. Shell's BugreportReceiver receives the BUGREPORT_FINISHED and issues a
system notification so user can share the bug report.

The new workflow is:

1. When dumpstate starts, it sends a BUGREPORT_STARTED with its pid and
the estimated total effort.
2. When Shell's BugreportReceiver receives the BUGREPORT_STARTED, it:
2.1 Issues a system notification so user can watch the
progresss (which is 0% initially).
2.2 Starts a service (BugreportProgressService) responsible for
polling the dumpstate progress (using system properties and the
pid) and updating the system notification.
3. As dumpstate progress, it updates the proper system property.
4. When dumpstate finishes, it sends a BUGREPORT_FINISHED event.
5. When Shell's BugreportReceiver receives the BUGREPORT_FINISHED, it:
5.1 Finishes the service if necessary.
5.2 Issues a system notification so user can share the bug report.

This CL handles the dumpstate changes only, the Shell changes will be
handled in a separate CL.

BUG: 25794470
Change-Id: I6e04203411802c88ab0d093420ccdfd26700d565
umpstate.cpp
umpstate.h
tils.cpp
36b3f6ff17e456dea81501006e33d5fdd1d3b480 20-Nov-2015 Felipe Leme <felipeal@google.com> Allow broadcasting of bug reports without a screenshot.

BUG: 25751868
Change-Id: Ideaa6c549f639aa64b30225147b2fad6c5f2d556
umpstate.cpp
umpstate.h
tils.cpp
f83543ab9d466b5d5ccfa7546e4d752a1d18f3d5 09-Oct-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: add -v printable to logcat

(cherry pick from commit 7831638e2a142cbb082d63a60ad5c04ff63933e8)

In the case where binary data lands in an utf-8 log buffer,
ensure that the content is made printable.

Bug: 23517551
Change-Id: I41696372d07228875d01a19f0c7ab2cb7494b7ef
umpstate.c
0be2b76ce9a0c943f7aad445bdf5be796c937618 20-Nov-2015 Felipe Leme <felipeal@google.com> Fixed check if zip file was generated properly.

During the earlier development stages, this function was returning an
int and later it was changed to boolean, but the check was not updated.

BUG: 25563823
Change-Id: I77f50bf2184d5dd4da2156a5eca4c8a555b567a4
umpstate.cpp
ed24d2ae2cd6e8b0afb86efa555f18bcfaf74a64 12-Nov-2015 Christopher Ferris <cferris@google.com> Fix a few bugs related to dumping files.

Fixes:

- Fix double print of header in dump_file.

- Fix a few possible file descriptor leaks.

- Add /d/ as another directory which should be skipped when printing out
last mod time of a file.

- Fix possible crash if the path passed to _dump_file_from_fd is less than
the length of one of the directory checks.

Change-Id: I450dfab76fd0ce4d4dca9ed39c82a980054f3cc3
umpstate.h
tils.cpp
74ee857d166f0696fe94628bbce391641343c418 16-Nov-2015 Felipe Leme <felipeal@google.com> Merge "Added option (-z) to generate a zipfile with the bugreport."
d907b32052aca02ad679e6ae786848d328723080 17-Oct-2015 keunyoung <keunyoung@google.com> add vehicle_network_service to stack dump

bug: 24095928
Change-Id: I32874f36003cd0dfacc8d9d5b568e6fc963bfa43
tils.cpp
0b904612c12ab59d1e86c978eb8f7662a101f4b8 13-Nov-2015 Elliott Hughes <enh@google.com> Merge "Move dumpstate to top -H rather than top -t." am: 20986bf383 am: 5e02b1bfbb
am: 439903c2ff

* commit '439903c2ff50cb632891006b9dfad0b4993b8384':
Move dumpstate to top -H rather than top -t.
5e02b1bfbbaedfb3703cd0f56e6bcac3aa4edfd9 13-Nov-2015 Elliott Hughes <enh@google.com> Merge "Move dumpstate to top -H rather than top -t."
am: 20986bf383

* commit '20986bf3830dabae74837660403c43f92c9131bd':
Move dumpstate to top -H rather than top -t.
b32c7e14ccc6507f6ce3fc02414ba04b797f4558 13-Nov-2015 Elliott Hughes <enh@google.com> Move dumpstate to top -H rather than top -t.

Change-Id: Ibc26b51e92425b2de7870a7a2890fc3566909cda
umpstate.c
6e01fa6f95fb20a2faab33561056d2e74cc097cb 12-Nov-2015 Felipe Leme <felipeal@google.com> Added option (-z) to generate a zipfile with the bugreport.

Currently, dumpstate generates a text file and Shell zips it, but that
breaks the android.intent.action.BUGREPORT_FINISHED contract.

Also changed some string variables from char* to std::string.

BUG: 25563823
Change-Id: I6e61798bf559fa9f79f629b22fd410752da2bbf7
ndroid.mk
umpstate.cpp
55b42a67f69767976ff16ab443b3e7142db693e1 11-Nov-2015 Felipe Leme <felipeal@google.com> Closes stdout when it is redirected to a file.

Bug: 19271141
Change-Id: I2990542649e64bf0a281bb9e322ed7b3b98a75c1
umpstate.cpp
93d705b6d742e8f00167ff2384e35c2205a6f9da 11-Nov-2015 Felipe Leme <felipeal@google.com> Add option to #define _DUMPSTATE_DRY_RUN_ to skip the actual dumps.

Such option is useful when debugging dumpstate itself, since it will
finish much sooner and its output will be much smaller.

Change-Id: If821ed21715461bf82eea0b2be4b926239ad69da
umpstate.cpp
umpstate.h
tils.cpp
8620bb4118a68721d10c29529dc6978847d08d00 10-Nov-2015 Felipe Leme <felipeal@google.com> Migrated dumpstate to C++.

Changes required:

- Explicity casting function pointers.
- Moving variables initialization before 'goto' statements.
- Changing string references from 'char *' to 'const char *'.
- Using 'extern "C"' so device-dependent implementation of
'dumpstate_board()' can be written in C or C++.

BUG: 25563823
Change-Id: I5712c2adbe181c6d17983cbb136b17757900b4ba
ndroid.mk
umpstate.c
umpstate.cpp
umpstate.h
ibdumpstate_default.c
ibdumpstate_default.cpp
tils.c
tils.cpp
877b5daeccaf25a84745b2dfc9f6c5d4f3787ccf 09-Nov-2015 Nick Kralevich <nnk@google.com> Merge "Allow read access to /proc entries for other UIDs"
am: fd53598220

* commit 'fd53598220e19fbb91270f1f1831f6c69c669aaa':
Allow read access to /proc entries for other UIDs
ab46a4922655bc75848660da4268ab85d72a6010 08-Nov-2015 Nick Kralevich <nnk@google.com> Allow read access to /proc entries for other UIDs

Allow dumpstate (aka adb bugreport), servicemanager, and
surfaceflinger to access /proc entries associated with other UIDs.

Bug: 23310674
Change-Id: I385dcf0db3376ba979409cbe6fe1a468d36237ef
umpstate.c
14f8cf12e2764ff554dd0e3b72cc8711b14adffe 03-Nov-2015 Bill Yi <byi@google.com> Merge commit '75c5de42b759bdcfa7c0e6103fb959c28d686116' into HEAD
1fa95dd57b61735b816e29c74a7613e261ba538d 02-Nov-2015 Elliott Hughes <enh@google.com> Merge "Further reduce duplication in bugreport ps output."
am: 670508d09a

* commit '670508d09acf64fad83d0c7ac90330d3db89c861':
Further reduce duplication in bugreport ps output.
430666bebd49cefcf88831c6fc6c3c86cad4ea48 02-Nov-2015 Elliott Hughes <enh@google.com> Further reduce duplication in bugreport ps output.

PROCESSES and PROCESSES AND THREADS can be combined. There's nothing in
the former that isn't in the latter.

Change-Id: I105a6d8d35488236ef6dbf4107496ea7e5ad70ea
umpstate.c
ed59c4e629c0c72871866e75789e0ece829f4823 31-Oct-2015 Elliott Hughes <enh@google.com> Merge "Reduce duplication in bugreport ps output."
am: 8ebad13b34

* commit '8ebad13b340921a40a367c9f1808d0c26147e2a6':
Reduce duplication in bugreport ps output.
a3533a3ae6bf8d0e1780c153cafdec86926ec22c 31-Oct-2015 Elliott Hughes <enh@google.com> Reduce duplication in bugreport ps output.

PROCESSES AND THREADS and PROCESSES (SELINUX LABELS) can be combined.
I suspect we can just remove PROCESSES too, since it's a strict
subset of the other information, but one step at a time. (The worry
is that someone's actually parsing this output, but it would be good
to find out who's doing that as soon as possible so we can work with
them as we transition to a more complete ps implementation.)

Change-Id: I5f1085f8853f7a988f7edcaeefdd7b63175c1473
umpstate.c
8b435c07eece971ab032d450777e0e1723299de1 12-Oct-2015 Jason Parks <jparks@google.com> am 7b2b968d: am 33c3c1bd: Merge "Revert "do not dumpstate raft BUG: 24159112"" into cw-e-dev

* commit '7b2b968db484118668b70d040464f379a7e9e915':
Revert "do not dumpstate raft BUG: 24159112"
31baf8d3c2833d13056b0be679f66ed0e53c8d26 12-Oct-2015 Jason Parks <jparks@google.com> Revert "do not dumpstate raft BUG: 24159112"

This reverts commit 05c862252d5021f55a69281473c67d76e7097422.

Change-Id: Ib5984796734d2a0e33f47e0fb4e446b787e0d14f
umpstate.c
ca78bbfd85dcff3c635b813d1cbe882b576b433c 09-Oct-2015 Mark Salyzyn <salyzyn@google.com> am 52b25375: Merge "dumpstate: add -v printable to logcat"

* commit '52b2537550a6fc43587980887858c7e7150255b0':
dumpstate: add -v printable to logcat
7831638e2a142cbb082d63a60ad5c04ff63933e8 09-Oct-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: add -v printable to logcat

In the case where binary data lands in an utf-8 log buffer,
ensure that the content is made printable.

Bug: 23517551
Change-Id: I41696372d07228875d01a19f0c7ab2cb7494b7ef
umpstate.c
313762d88e7820e689879e08f4a93eac3cf8af99 08-Oct-2015 Nick Kralevich <nnk@google.com> am ae0405d6: Merge "dumpstate: execute procrank using su"

* commit 'ae0405d607f9ed08d708ee990716a7881a6cfd4d':
dumpstate: execute procrank using su
2b1f88b6ac78e330ff006da6fecf8bc9d976ec67 08-Oct-2015 Nick Kralevich <nnk@google.com> dumpstate: execute procrank using su

procrank is a setuid binary which only exists on userdebug/eng
builds. Instead of executing the setuid binary, run the binary using
the su command. This eliminates one more setuid binary, and allows
the tightening of the SELinux policy.

Bug: 18342188
Change-Id: I81d06196a29489feaefb2fea0cf5c4ff1e273d2f
umpstate.c
af83daabad1ded6350d266f35ed1354826714cf4 02-Oct-2015 Erik Wolsheimer <ewol@google.com> am ddf5f250: am 05c86225: do not dumpstate raft BUG: 24159112

* commit 'ddf5f2509b48ee85dc352ee245f34a9d6307be39':
do not dumpstate raft BUG: 24159112
05c862252d5021f55a69281473c67d76e7097422 02-Oct-2015 Erik Wolsheimer <ewol@google.com> do not dumpstate raft
BUG: 24159112

Change-Id: I344aa73808992b5f84cb0536201a3ab2eb6f2b3c
umpstate.c
3854926074376ebe32d60d4736c99a2e111b3442 15-Sep-2015 Lorenzo Colitti <lorenzo@google.com> am a8273f09: am 872269a5: am 6afc38c4: Dump the ND offload status and address table in bugreports.

* commit 'a8273f094437d1e1d3c074e35c325e4512e5c465':
Dump the ND offload status and address table in bugreports.
872269a579e776c61ac5777e70ca2981771117d6 15-Sep-2015 Lorenzo Colitti <lorenzo@google.com> am 6afc38c4: Dump the ND offload status and address table in bugreports.

* commit '6afc38c45af45eb8f64793bca2903b3f4c55579b':
Dump the ND offload status and address table in bugreports.
6afc38c45af45eb8f64793bca2903b3f4c55579b 09-Sep-2015 Lorenzo Colitti <lorenzo@google.com> Dump the ND offload status and address table in bugreports.

Also, move NetworkDiagnostics between the two runs of getting the
wifi counters, so we can see the effect on the counters of
sending our probe packets.

Bug: 23661687
Change-Id: I3f81c003a35f50ac1cb8e77d0a8c73dae4fd91f3
umpstate.c
1380c8488e6bb57b7af21b3d189ae0fc941085b3 21-Aug-2015 Tom Cherry <tomcherry@google.com> am 32592270: am 64e13880: Merge "bundle init.rc contents with its service"

* commit '32592270d40d6060e19aa97949aee72c8aca0807':
bundle init.rc contents with its service
a1f3f54c2752b4108f3b21baea6d5fd73738cbff 21-Aug-2015 Tom Cherry <tomcherry@google.com> am 32592270: am 64e13880: Merge "bundle init.rc contents with its service"

* commit '32592270d40d6060e19aa97949aee72c8aca0807':
bundle init.rc contents with its service
74155996d931edbd19ed5b3f71a58ceff920b451 14-Aug-2015 Tom Cherry <tomcherry@google.com> bundle init.rc contents with its service

Bug: 23186545
Change-Id: I2a70a39122b146d5bbc9b55156e769782e011bff
ndroid.mk
umpstate.rc
df1bc67019f4eda8acfd4b97d4c4fd98b55edcb8 12-Aug-2015 Mark Salyzyn <salyzyn@google.com> resolved conflicts for merge of d213f5e7 to cw-e-dev

Change-Id: Iaea0fdd483b4d0988df442f9b291b99943009829
ecc0763e6c96c418ea4ee6c993d58d16a58407b3 30-Jul-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: add logcat -b all -S

(cherry pick from commit e3c4df96083231b519dad919fd0ed6624100b368)

- For those that are proud to call themselves logspam police
- Every time someone declares that something is too chatty, or that
they lost their logs because they were declared too chatty and
their associated logs were aggresively pruned we generally
ask them to report the logger statistics to pinpoint what software
product that is the elephant in the room.
- Every time we want to spawn a new 'stop being so spammy' bug spawned
off a bugreport collected for another purpose, we *wish* we had the
logger statistics to help add gravitas to the claim that some piece
of software is the top, or near the top, polluter.

Bug: 22351810
Change-Id: Ifae33cd21d0ae2917a3b4381502d723725b1701c
umpstate.c
67457c0e868fb6c383b3f729b46b5bd6588093ff 03-Aug-2015 Mark Salyzyn <salyzyn@google.com> resolved conflicts for merge of eb7718b1 to mnc-dr-dev-plus-aosp

Change-Id: I28e749b040fc97e36f73d11c0f2e8ca487d5b158
56c6da786ae4937fdc99862e1de3b93ecd4fc988 01-Aug-2015 Mark Salyzyn <salyzyn@google.com> am eb7718b1: am 5b7e9dc7: Merge "dumpstate: add logcat -b all -S"

* commit 'eb7718b1d2f0f0a9a735b41d15c24761f5e4cfc9':
dumpstate: add logcat -b all -S
e3c4df96083231b519dad919fd0ed6624100b368 30-Jul-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: add logcat -b all -S

- For those that are proud to call themselves logspam police
- Every time someone declares that something is too chatty, or that
they lost their logs because they were declared too chatty and
their associated logs were aggresively pruned we generally
ask them to report the logger statistics to pinpoint what software
product that is the elephant in the room.
- Every time we want to spawn a new 'stop being so spammy' bug spawned
off a bugreport collected for another purpose, we *wish* we had the
logger statistics to help add gravitas to the claim that some piece
of software is the top, or near the top, polluter.

Change-Id: Ifae33cd21d0ae2917a3b4381502d723725b1701c
umpstate.c
3b7261d5de91fb03fc97cb05fd8448a399e2b0a5 27-Jul-2015 Nick Kralevich <nnk@google.com> am ed32594d: am 2cb9994c: Merge "dumpstate: remove unnecessary mkdir"

* commit 'ed32594d0bdfc2fb675d2e5fb0259d3d22b42aff':
dumpstate: remove unnecessary mkdir
4aec04465c3e3a775f2b7ba34218535af8eb5c2f 26-Jul-2015 Nick Kralevich <nnk@google.com> am ed32594d: am 2cb9994c: Merge "dumpstate: remove unnecessary mkdir"

* commit 'ed32594d0bdfc2fb675d2e5fb0259d3d22b42aff':
dumpstate: remove unnecessary mkdir
f0b539618fbf7ea3800461b757cf416a3369b6cb 26-Jul-2015 Nick Kralevich <nnk@google.com> dumpstate: remove unnecessary mkdir

/data/anr is now created in init.rc. This code is unnecessary.

Bug: 22385254
Change-Id: I4ea9c311d52eee7fb6b90235fbd12a4c9364d71f
tils.c
8d4cb7ffc11050eebb4d06684e0eb14d9aadacb5 24-Jul-2015 Sharvil Nanavati <sharvil@google.com> Dump raft logs in bugreports if they exist.

Change-Id: I7773b8b86675d9ebf3f6d158eaaa11e47619800e
umpstate.c
8f37aa5011bf5d8c0a67126b92e3b435ffd4dca0 12-Jun-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: modify logcat timeout to compensate for storage speed

(cherry pick from commit f989162bb89dff6387f2021101306a1be6d875f7)

Discover the logcat buffer size, divide by the worst storage
speed in kb/s, and multiply by ten to estimate the timeout in
ms for each named buffer. If that value is less than 20 seconds,
then select 20 seconds. Apply this to each logcat request.

Bug: 21555259
Change-Id: Id36aebff83cb06e94350e4a84fa266b66a8444fc
umpstate.c
94a9875f7565617a000814039a4134420397a6aa 12-Jun-2015 Sharvil Nanavati <sharvil@google.com> Merge "Remove Bluedroid kernel dump from dumpstate." into mnc-dev
f989162bb89dff6387f2021101306a1be6d875f7 12-Jun-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: modify logcat timeout to compensate for storage speed

Discover the logcat buffer size, divide by the worst storage
speed in kb/s, and multiply by ten to estimate the timeout in
ms for each named buffer. If that value is less than 20 seconds,
then select 20 seconds. Apply this to each logcat request.

Bug: 21555259
Change-Id: Id36aebff83cb06e94350e4a84fa266b66a8444fc
umpstate.c
3ba7e729a7680d397113d3289fe1aae50463d56b 12-Jun-2015 Sharvil Nanavati <sharvil@google.com> Remove Bluedroid kernel dump from dumpstate.

Bluedroid doesn't have much of a kernel component and no devices
expose a bluedroid node in debugfs.

Change-Id: I5600e88c543a109257d95591704a8f2a7261dfdc
umpstate.c
90926336c19e45a1618b6251529b0071877bfdd4 09-Jun-2015 Erik Kline <ek@google.com> Incorporate network diagnostics during a bugreport

Bug: 21449922
Change-Id: I81a3774683c08f5d4ab4ea75bec45d279fb210ec
umpstate.c
bfb1f1cc832840b7232c25a91d49eb39aa79687f 16-May-2015 Elliott Hughes <enh@google.com> Don't use TEMP_FAILURE_RETRY on close in frameworks/native.

Bug: http://b/20501816
Change-Id: Id13a62f02243c6c4831e2f47944dc34fa822f5b6
(cherry picked from commit 997abb668b9248c2174c6cf169a0b7c6a02fd2cb)
tils.c
997abb668b9248c2174c6cf169a0b7c6a02fd2cb 16-May-2015 Elliott Hughes <enh@google.com> Don't use TEMP_FAILURE_RETRY on close in frameworks/native.

Bug: http://b/20501816
Change-Id: Id13a62f02243c6c4831e2f47944dc34fa822f5b6
tils.c
326842fca4883f1256aa9ed019bb3206ee76fca7 30-Apr-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: report per-partition MMC performance

(Cherry pick from commit 540e3de99fa1baa5eaf3eb3d49f4e98fd9f5bd91)

Change-Id: If5cabe186d8377056effa1c0672a90e277cd7221
umpstate.c
umpstate.h
tils.c
540e3de99fa1baa5eaf3eb3d49f4e98fd9f5bd91 30-Apr-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: report per-partition MMC performance

Change-Id: If5cabe186d8377056effa1c0672a90e277cd7221
umpstate.c
umpstate.h
tils.c
8b3e133e413774047da8005771f57c21dd31e1e3 28-Apr-2015 Ashish Sharma <ashishsharma@google.com> Inclide checkin format of dumpsys package in bugreport.

Change-Id: I809377f80e314b358eba22fa916e53c81cac2c47
umpstate.c
82f393aad651fbf06d8c6872ac10a739ff2a3e42 09-Apr-2015 Mark Salyzyn <salyzyn@google.com> am d029e95a: am 1b0a8702: am ad436ab5: Merge "dumpstate: scrub APANIC"

* commit 'd029e95a58ea0927ebd3431d9991cd316e568002':
dumpstate: scrub APANIC
f423b57dd98fcba8d0e34f98d28a9afc41577508 08-Apr-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: scrub APANIC

Bug: 19525200
Change-Id: Ia2d2857cac953fb4ceafb66ddf775d89d7a777b1
umpstate.c
4796bc3b27186de67f1af732be87e20ab1757198 19-Mar-2015 Nick Kralevich <nnk@google.com> am 4b9d0b9b: am f3201498: Merge "dumpstate: add O_CLOEXEC"

* commit '4b9d0b9b676afec086bf579015b2f74623b357fd':
dumpstate: add O_CLOEXEC
cd67e9f059e270017d5defd8784c89dd8e6bcde7 19-Mar-2015 Nick Kralevich <nnk@google.com> dumpstate: add O_CLOEXEC

Add O_CLOEXEC to various file descriptor calls, to avoid
leaking file descriptors to dumpstate's child processes.

Bug: 18342188
Change-Id: I74c47a98dfddc29c618067ad53d879b98ed1d87a
umpstate.c
tils.c
123edd9f812c93973de923397f2a5cb6fdaa4135 26-Feb-2015 Christopher Ferris <cferris@google.com> resolved conflicts for merge of 04e13acd to master

Change-Id: I9bbc9907a5cbde8b374398493bc0dc6b056ea734
69a141e07fab2672cf2cc23dcc124c46995fbf98 26-Feb-2015 Christopher Ferris <cferris@google.com> am 9d68ed0e: Merge "Add timeout for dump_file."

* commit '9d68ed0ecd3a101c13a163cfe730b13b1564b442':
Add timeout for dump_file.
9d68ed0ecd3a101c13a163cfe730b13b1564b442 26-Feb-2015 Christopher Ferris <cferris@google.com> Merge "Add timeout for dump_file."
59b0b568d0ce20394e6d491342ad0b06682dfa45 25-Feb-2015 Mark Salyzyn <salyzyn@google.com> resolved conflicts for merge of d6c8ae9c to master

Change-Id: I3cbb6ed0958b4328aca1798c7fe6080c31555a3a
2f655daeea66bf5d0e065b45a7abd515cfeeaf97 26-Feb-2015 Mark Salyzyn <salyzyn@google.com> am bb67beca: Merge "dumpstate: add pstore read"

* commit 'bb67beca35e7d570ede193a316a92022fbc2f810':
dumpstate: add pstore read
2262c16372570f57d3107d574abe2c80825d286e 16-Dec-2014 Mark Salyzyn <salyzyn@google.com> dumpstate: add pstore read

Call logcat -L to pull any LAST Android logs. If the kernel is not
configured for PSTORE and PSTORE_PMSG, the hopes are the empty
content will pressure vendors to slice up and configure support.

Change-Id: I5fddfa1e0f59f24fccc30b257ba68af8a8cf8640
umpstate.c
54bcc5ffd5a79f4f194089c58d3de571532bf39b 10-Feb-2015 Christopher Ferris <cferris@google.com> Add timeout for dump_file.

It turns out dump_file is used on a number of /proc and system files.
In one case, the read of a file stalled and caused a bugreport to
hang forever. It's still possible if there is a kernel bug that this
could stall forever, but less likely.

Also, change the return type of nanotime to uint64_t.

Testing:
- Created a named fifo and verified that dump_file fails with a timeout.
- Created a large /data/anr/traces.txt to verify that large files still
dump properly and that the additional NONBLOCK parameter doesn't cause
a problem.
- Created a dummy /data/tombstones/tombstone_00 to verify that the
dump of these files still works.
- Compared a dump using the old dumpstate to the new dumpstate to verify
nothing obviously different.

Bug: 19117030
Change-Id: I0d3dd27583c853cdaccd2fd278748cb5f9ccd4fb
umpstate.c
umpstate.h
tils.c
d527bcbc10b1fb6b998b94bbac7bfbfd3a9efdf6 17-Feb-2015 Svetoslav <svetoslavganov@google.com> Remove unnecessary settings state dump.

The settings provider now implements dump, hance special dump
code is no longer needed.

Change-Id: I93af3f6acac4ac70d6bbf569d2348cb16b8c0946
umpstate.c
umpstate.h
tils.c
34e32466466ad3f46697798c9f9644d62390c9b5 10-Feb-2015 Christopher Ferris <cferris@google.com> am 8511b3ae: Merge "Remove -z option."

* commit '8511b3ae5eb42810f97f7c3e993d7f80d3393b83':
Remove -z option.
ff4a4dc7e6e3ead12020b4dc17548d767a419dde 10-Feb-2015 Christopher Ferris <cferris@google.com> Remove -z option.

This option doesn't work with the current selinux protections and
doesn't serve much of a purpose. You can get the same results running
this:

dumpstate | gzip > /data/local/tmp/dump.txt.gz

Bug: 19271141
Change-Id: Icc76200df33dc708e30c556ec8a0f393f995fe7c
umpstate.c
umpstate.h
tils.c
16c62c468aacf40496a7cad94f49795a797cdd37 04-Feb-2015 Christopher Ferris <cferris@google.com> am 50ad67e4: Merge "Add better timeout mechanism for running commands."

* commit '50ad67e4ce6b07b5f5f4649ace81ed9a8b2c2eac':
Add better timeout mechanism for running commands.
1a9a3386151d90152cc18d995b9877b50ca84d90 30-Jan-2015 Christopher Ferris <cferris@google.com> Add better timeout mechanism for running commands.

Change-Id: I60fc9e7d59c3e0e4b8b2f69f79c6903240bfd131
tils.c
e55073a96ca7e9447592988614664b3c9666d93a 28-Jan-2015 Elliott Hughes <enh@google.com> am 0e17a265: Merge "Switch dumpstate to "ip link list"."

* commit '0e17a265f5e8bf233a3e3b74fc03ada3dc467bed':
Switch dumpstate to "ip link list".
a59828a5d2740433164872e9a0b44363e2ba0cd4 28-Jan-2015 Elliott Hughes <enh@google.com> Switch dumpstate to "ip link list".

Change-Id: Ia1db51c866890f09fbd4316764dea5982554598f
umpstate.c
31ef85529d86a9db68b002f51ec84fd9938908ab 14-Jan-2015 Christopher Ferris <cferris@google.com> Use the timeout stack dump functions.

Use the native stack dumping functions that allows time outs. If
debuggerd locks up, before a bugreport would hang forever. Now
it will timeout properly and still get all of the other information.

Bug: 18766581

(cherry picked from commit 457731f69e3106b5aae8fc04f9565af1d875876c)

Change-Id: I39e8e9c60209e3ef9efac795fedb8e1edce2bd3e
tils.c
457731f69e3106b5aae8fc04f9565af1d875876c 14-Jan-2015 Christopher Ferris <cferris@google.com> Use the timeout stack dump functions.

Use the native stack dumping functions that allows time outs. If
debuggerd locks up, before a bugreport would hang forever. Now
it will timeout properly and still get all of the other information.

Bug: 18766581
Change-Id: I85053b8dcfe6224e2b64b4d8f7f2ef448b3cda34
tils.c
d195f87b2dd4aa731a21ef3acd321e2441c5bffb 10-Jan-2015 Christopher Ferris <cferris@google.com> Fix message when a command times out.

The previous version printed out the nanoseconds elapsed, not seconds.

Bug: 18766581

(cherry picked from commit 67c5a8af9ed128d8bb56d4723303aef6f0a4500f)

Change-Id: Icbaaee83a92767694fd98e3c790f36f4d24681b0
tils.c
67c5a8af9ed128d8bb56d4723303aef6f0a4500f 10-Jan-2015 Christopher Ferris <cferris@google.com> Fix message when a command times out.

The previous version printed out the nanoseconds elapsed, not seconds.

Change-Id: I10f6d7bf7b7a4647658313ed83781fda6fd744a5
tils.c
4ba58f69cd91af1921299c585a5ade1a1a7eb8ed 22-Nov-2014 Dianne Hackborn <hackbod@google.com> Work on issue #18486438: Reduce size of bugreport output

Don't put packages.xml in to the output.

Change-Id: I88a682866365886506a003a64deb4a29c16ba21c
umpstate.c
9cea6ccbd8789f9583c78ce2b36ac5dd75717b6c 04-Nov-2014 Mark Salyzyn <salyzyn@google.com> dumpstate: report device uptime mmc performance

Bug: 18085992
Change-Id: Ibc0a37d3d2649d1e6708d9357f37ed75f2cea121
umpstate.c
2db0f5f31c015b5a89b619f8c95a9bf95c09c75b 16-Oct-2014 Arve Hjønnevåg <arve@android.com> dumpstate: Add trusty version if driver is found

Change-Id: I7780ea8e1d777c222a73408f70d8a6d49dee1d92
umpstate.c
ed9354fc846895dc53397fbb5323bef00b3a3834 02-Oct-2014 Christopher Ferris <cferris@google.com> Accept socket connection before tracing.

Sometimes dumping threads takes a long time and bugreport times
out. This change will cause us to accept the bugreport socket connection
before dumping threads and should avoid the failed to connect to dumpstate
service problems we've seen.

Bug: 17758374
Change-Id: I80afa0353cf1c340873f481a8d1d7faffff54120
umpstate.c
1dc94e315680b47fe430ef90f46c50a25c92fb6d 11-Sep-2014 Jeff Brown <jeffbrown@google.com> Make dumpstate vibrate immediately.

Previously, the vibration was not performed until after stacks
were gathered which takes a long time. Moved the vibration
to happen earlier so we provide better user feedback for the
three-button salute when collecting a bug report.

Deleted some dead code for playing begin/end sounds.

Improved the timing measurement code to help track down why
bug reports are so slow. (They take over a minute now which
can cause us to lose valuable diagnostic information.)

Bug: 17474152
Change-Id: Iac73f7993d7dc85196aad96f459b22fd4a710f94
umpstate.c
tils.c
89d4949f86f4f7b6710e951afefad186c667fd6e 09-Sep-2014 Christopher Ferris <cferris@google.com> Use time() instead of clock() for timeouts.

The clock() function returns the processor time used by the process. This
is not a good timeout mechanism since the code is suspended most of the
time waiting for the forked process to finish. Replace with the time()
function.

Bug: 17154069
Change-Id: Ib383329f9db269445d71a100553b08e71fddda3f
tils.c
2e671bbdb741c2926b6df7b240fdc31c7361f330 21-Aug-2014 Andres Morales <anmorales@google.com> Fix deadlock when killing adb bugreport

Leave default signal handler (terminate) for parent process,
add SIG_IGN as signal handler for children and let them
go down when the parent gets SIGPIPE.

Bug: 17109154
Change-Id: Id33db3e97a32f289eb2a9a1a0ca8acbe3dcd285d
umpstate.c
tils.c
d4c3d38957870fa27423dbc55d99d68772fbd490 30-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Improve network connectivity dumping.

1. Explicitly dump IP addresses.

Currently, some IP addresses are dumped using netcfg, but that
only dumps the first IPv4 address on each interface. Instead,
call ip -4 addr and ip -6 addr explicitly to dump all IPv4 and
IPv6 addresses on the system.

2. Disable dumping /proc/net/{ipv6,}route, because:

- We already dump all IPv4 and IPv6 routes in the tables that
we use.
- /proc/net/route is confusing because it only includes routes
in the main table, which are all but unused. It's also in
unreadable host-byte-order hex.
- /proc/net/ipv6_route is confusing because it includes routes
from all tables but does not say what table they are in.

3. Instead of dumping the contents of /proc/net/arp , use
"ip -4 neigh show" and "ip -6 neigh show" to dump the
neighbour caches for both IPv4 and IPv6.

Bug: 16663736
Change-Id: Id3e509b877ab7b00eb2399b6a9868b12245da2f0
umpstate.c
7dc7f3221f26b771c266a26ec785eb74287922f1 23-Jul-2014 Christopher Ferris <cferris@google.com> Add dumping of tombstones to dumpstate.

Dump only those tombstones modified within the last half an hour.

Change-Id: I8ce836b2e19eba7a9c0c31a4f312f9a382526da7
umpstate.c
umpstate.h
tils.c
d2a049220a8299ab19a96d6dcc12b7034da28d28 19-Jul-2014 Elliott Hughes <enh@google.com> Always #include <sys/...>, not <linux/...>.

(cherry picked from commit 1e4ee9afd2de12af98dbf476b73e2d43f605384c)

Change-Id: Ie005774484f98bb33c8f867cddb778ac04a1d4ea
umpstate.c
0d6180f122127a9541e6193e0e6eceb5b08c608c 17-Jul-2014 Colin Cross <ccross@android.com> dumpstate: fix dumping traces for vm processes on 64-bit

dumpstate was not dumping any stack traces for vm processes because
it was failing the string compare for /system/bin/app_process.
64-bit devices use app_process32 and app_process64 instead of
app_process, and zygote64 alongside zygote. Change the string
matching to be prefix matching.

(cherry picked from commit 8eb25d552b07ffa799b7b61ad46d0109e7512741)

Change-Id: I6b1568161fae278f0e6107990e5b750cf0ca902b
tils.c
f3381cf1a645f857dccad9a4369ae23054e9d7d4 11-Jul-2014 Matthew Xie <mattx@google.com> dump bluedroid kernel status do not merge

Change-Id: I4617f770088f86ceda2caf58bd1fdae81b3e31df
(cherry picked from commit ed3b9a09771a79b62fd4a5943d3845e7ceee6a34)
umpstate.c
c88da7cc21c61b9ac8fcac11aa812f647ffb181c 09-Jul-2014 Sreeram Ramachandran <sreeram@google.com> resolved conflicts for merge of 928e05b1 to master

Change-Id: I1d1e623a1f95baa4375a87242ce71ea789884649
928e05b12b21a846ac956e83d46635bbab592ea7 09-Jul-2014 Sreeram Ramachandran <sreeram@google.com> am 0d2bee0c: Merge "Dump all the correct routing tables."

* commit '0d2bee0c0baec56ec98867d7e044602097525248':
Dump all the correct routing tables.
2b3bba34aec65b612be8d1f52cd124d9c30955f9 09-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Dump all the correct routing tables.

The list of tables is maintained in /data/misc/net/rt_tables by netd.

Change-Id: I55475c08c5e43bcf61af916210e680c47480ac32
umpstate.c
umpstate.h
tils.c
bd81c258c2ac9f41a9263a20953d6f0f63a88887 01-May-2014 Nick Vaccaro <nvaccaro@google.com> am 45fcfb48: am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging

* commit '45fcfb48ef9e65747e7a3f35e1a4da232f6e161a':
dumpstate: increase poll timeout waiting for SIGQUIT logging
45fcfb48ef9e65747e7a3f35e1a4da232f6e161a 30-Apr-2014 Nick Vaccaro <nvaccaro@google.com> am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging

* commit '85453ecc90a94564e586f0f97c9ec2c0cf831501':
dumpstate: increase poll timeout waiting for SIGQUIT logging
85453ecc90a94564e586f0f97c9ec2c0cf831501 30-Apr-2014 Nick Vaccaro <nvaccaro@google.com> dumpstate: increase poll timeout waiting for SIGQUIT logging

Increased the maximum time dumpstate will wait for SIGQUIT process
to finish dumping its thread stacks to the logfile to 5 seconds.

Bug: 14057177
Change-Id: I0b43004512855d202f2fe0ea7b0e934e77a3a070
tils.c
165c8bdfb585b224325423b21301620f9097dc64 13-Feb-2014 Nick Kralevich <nnk@google.com> am 0e4d2885: am 2044ac43: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."

* commit '0e4d2885a34d31f5dbe5a08bdb654953abaf82a2':
Convert all selinux_android_restorecon and _setfilecon calls to new API.
0e4d2885a34d31f5dbe5a08bdb654953abaf82a2 13-Feb-2014 Nick Kralevich <nnk@google.com> am 2044ac43: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."

* commit '2044ac43e53b517526b3c70dc4fbc60ffc01693f':
Convert all selinux_android_restorecon and _setfilecon calls to new API.
26288202e7bdf2e897a11bf31a15685d7c20945f 07-Feb-2014 Stephen Smalley <sds@tycho.nsa.gov> Convert all selinux_android_restorecon and _setfilecon calls to new API.

libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
tils.c
5ecd4beef8f10f91febf916414c65d3d0e1cf734 29-Jan-2014 John Spurlock <jspurlock@google.com> Dump system settings for all users

Change-Id: Ic832b19fe698da1984876b2949c3f26990ae5076
umpstate.c
umpstate.h
tils.c
2a83daa8a3e1eab292dc1464bbe78f025f4bc0e9 23-Nov-2013 Todd Poynor <toddpoynor@google.com> dumpstate: dump console-ramoops instead of last_kmsg if present

Change-Id: I41a922b33f0b6b4e8e150a92e46032501a165e33
umpstate.c
59b1516f4cefcfd599f4e5e9c4a227a48d1ace65 05-Sep-2013 Dianne Hackborn <hackbod@google.com> Fix issue #10422349: Limit/change the battery history data in batterystats

Use new compact option to include history when dumping battery stats.

Change-Id: I3833a88db76d8791bd5c2e8f6ff414af65472a42
umpstate.c
1d6b97c869718001010cce3db387c73fd11bf32e 21-Aug-2013 Dmitry Shmidt <dimitrysh@google.com> dumpstate: Fix wifi list of networks dump

Bug: 9056601

Change-Id: Ia0adb67afdf3d478033d0ee34bbb95e621e2fe51
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
umpstate.c
4f5b9a701b3d480ae4437ec60062ecb6c94446ee 14-Aug-2013 Todd Poynor <toddpoynor@google.com> dumpstate: switch to HAL static libraries

Change-Id: I865a0b4b4a84a2d54a239e7b09874287f0c1ad56
ndroid.mk
umpstate.c
ibdumpstate_default.c
656a6b9e3645bfe2cf073b69cbb9d02832f62c26 23-Jul-2013 Alex Ray <aray@google.com> dumpstate: remove libutils dependency

Change-Id: I9745f389402c01b90877612e060ac996eba99964
umpstate.c
76b45c126be0208f6f8e8f3025b0aa8a26d3fc3a 15-Jul-2013 Nick Kralevich <nnk@google.com> dumpstate: Show SELinux process labels

Change-Id: Ie19586a3b733bd4420f6b20b5d253d42c2f165ea
umpstate.c
1bd5068a5180ac12dda374e15c7b1f70e8334284 11-Jul-2013 Dianne Hackborn <hackbod@google.com> Fix cmd line arguments for usagestats.

Change-Id: I9a1436aa1d1665924ba62a568bb4b66d67ae2814
umpstate.c
5cd46aa3399ddeaf12a211390dfde66c796ab299 10-Jul-2013 Dianne Hackborn <hackbod@google.com> Update to follow procstats options changes.

Change-Id: I6f016c944cfcd01bbbcf3cf37bc7ff05482f0012
umpstate.c
3e5fa73722c100fc9017c7a47b17a8e727aa34e1 04-Jul-2013 Dianne Hackborn <hackbod@google.com> Update to use --include-committed for procstats.

Change-Id: I5ce737b624c5617c94054d6bedebca754fbf16a9
umpstate.c
02bea9786d2ecc4c04f35fd7d9b73d4dd2b73735 27-Jun-2013 Dianne Hackborn <hackbod@google.com> Add checkin dumps to bug reports.

This is a duplicate of the associated human-readable dumps
of these services, but much better for automated parsing.

Change-Id: I902b768b03aeac1472f03f96913f9b8ada5dba9c
umpstate.c
4b2b0a7494c872b7d545a9abe2d08ca0d0325073 29-May-2013 jp abgrall <jpa@google.com> am 74bd799e: Merge "Exit dumpstate on SIGPIPE to avoid cascading child crashes"

* commit '74bd799ec20d2420459fa382533b1cc39ca9a54c':
Exit dumpstate on SIGPIPE to avoid cascading child crashes
885f888c55587e9366542b5155a06c321cde175a 06-May-2013 John Michelau <w14107@motorola.com> Exit dumpstate on SIGPIPE to avoid cascading child crashes

When dumpstate ignores SIGPIPE it can lead to a cascade of tombstones /
coredumps since many of its children don't handle or ignore it. It's
best to just exit dumpstate once the pipe is broken.

Change-Id: Ic0c57ecf4171f0c0a07837e51c41cb1876e1350c
umpstate.c
46f19772ae5659c1659a0ac8f1f72389e94a85d4 10-Apr-2013 Ying Wang <wangying@google.com> resolved conflicts for merge of c76e8a20 to jb-mr2-dev-plus-aosp

Change-Id: I895a8ad8c936a80c70aaac739c6441d3c7c55834
8a0cb4ee0b6c351de82987efb472fa38dfaf608a 10-Apr-2013 Ying Wang <wangying@google.com> Add liblog

Bug: 8580410
Change-Id: I2ca4fa00dde0b574df3619134836bcb9315bd506
ndroid.mk
e167d889e4917e6b4f569026a1492b9e9818b08e 05-Apr-2013 Geremy Condra <gcondra@google.com> am a3d3e137: Merge "dumpstate: Add SELinux restorecon call."

* commit 'a3d3e137f473a965fefced9670e3b0c6b5f7f791':
dumpstate: Add SELinux restorecon call.
957983787d7a753d34b582ae0165160f4ebf815c 04-Apr-2013 Robert Craig <rpcraig@tycho.ncsc.mil> dumpstate: Add SELinux restorecon call.

Set the security context on the directory used
to dump Dalvik and native stack traces.

Change-Id: Iba13783f10e850485ce1a8d4aa5792d55085eb22
Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>
ndroid.mk
tils.c
aaaa57bf8904ef383a9e766ace09725bc392aceb 26-Mar-2013 Jeff Sharkey <jsharkey@android.com> Bugreport broadcasts are only useful to owners.

Bug: 8415156
Change-Id: Ia73969262abe9f715f038dad934651d7e5d65c87
umpstate.c
5a93003d3f0d1808b6dcd9928041ec62ea7f67ad 19-Mar-2013 Jeff Sharkey <jsharkey@android.com> Move screenshots near beginning of dumpstate.

Bug: 8420215
Change-Id: I6adffd1182ed8f99b8d11d43785a4eb4a388ceb5
umpstate.c
7560443061846fe0be5b658a7904786892007034 14-Mar-2013 Jeff Sharkey <jsharkey@android.com> Increase screenshot timeout.

Devices with large displays take longer than 5 seconds to write.

Change-Id: If74bc4a3cec366ae28eca549bce28ef212e47d8f
umpstate.c
27f9e6d849fce956c9b8f1ad5c3d9a954501a76b 13-Mar-2013 Jeff Sharkey <jsharkey@android.com> Support broadcast when dumpstate finishes.

Add flag that sends BUGREPORT_FINISHED broadcast when dumpstate
is finished, including the resulting filesystem paths. Also reduces
directory creation to 0770.

Bug: 7005318
Change-Id: Id4c6b699a56f8acd859b7ab73368500e1a8f3c67
umpstate.c
tils.c
574d6902b7e30a1e9c2375481549c8e8a712d6e6 11-Mar-2013 jp abgrall <jpa@google.com> am ba8abb51: Merge "Ensure dumpstate children die"

* commit 'ba8abb517d1eddebeda62bf907fa446e3c3b81f6':
Ensure dumpstate children die
e7b6cf13f94f66ea446c95ab34040b0a577e43dc 07-Mar-2013 John Michelau <w14107@motorola.com> Ensure dumpstate children die

Use prctl(PR_SET_PDEATHSIG, SIGKILL) in each forked child to ensure
it dies when dumpstate dies.

This is important for two cases:
- dumpstate runs a timer for each child process. On expiration, it
sends SIGTERM to kill the process. Sometimes SIGTERM isn't enough
to kill a hung process, so the child lives on.
- When dumpstate is killed by the user before completing, outstanding
children continue to run and generate output.

Change-Id: I96e0dc918c26d56c9fee53611980ba2edd238712
tils.c
98ca63e6d15e47a9b62971f0db6424c13c226019 01-Mar-2013 Nick Kralevich <nnk@google.com> am 22641851: Merge "dumpstate: use correct header file."

* commit '22641851c48fee6e79d01adcfab01c0b625cfb3c':
dumpstate: use correct header file.
e96b2d0037857646dbf50968fbf4b2973a07f1c9 01-Mar-2013 Nick Kralevich <nnk@google.com> dumpstate: use correct header file.

Change-Id: I006d7a219ce6309259f271beff6011cc266f1a61
umpstate.c
5b8176471c0704651ceb22608c74d03877513ec0 22-Feb-2013 Dmitry Shmidt <dimitrysh@google.com> Remove obsolte 'su' from 'ping' call (to work on user build)

Change-Id: I2d391bbd39fc591eef33b9c9e4b4cdbda29e41e7
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
umpstate.c
8f75fa7bcfec553eddb59b919b44d7a93c9846a1 09-Feb-2013 Ken Sumrall <ksumrall@android.com> Do not use su to run the df command in bugreports

User builds do not have su, so when the bugreport attempts to report
disk free space, the command fails and nothing is reported. However,
the df command does not need to be run as root to report free space,
so just run the command directly.

Change-Id: Ic7deb696f293e772ddf28eacfe16e4250af9a9f3
umpstate.c
258fe7eac91689866fc5f6420bea56432799743e 09-Nov-2012 Dmitry Shmidt <dimitrysh@google.com> am 77622879: am 4bacaec4: am 0b2c9268: bugreport: Add /proc/interrupts dump

* commit '77622879a6a12c6cb916df46c919dde87656e6df':
bugreport: Add /proc/interrupts dump
03d0600ea7aa31dc1be245f787084bb151403cf4 09-Nov-2012 Dmitry Shmidt <dimitrysh@google.com> am af9e8a59: am 61db92e7: am c11f56e5: bugreport: Add wlan FW counters dump for bcmdhd

* commit 'af9e8a59619ec6050739dd68ea108cc7e182d059':
bugreport: Add wlan FW counters dump for bcmdhd
1493a3974a725d6873f317b774be333ca035a64c 07-Nov-2012 Colin Cross <ccross@android.com> dumpstate: fix incorrectly zeroed array

Change-Id: I55a916568baf66629b02a6d80fce34b84ffb3a34
tils.c
0b2c9268265e9a165551eaa66cb461d3fab8b564 07-Nov-2012 Dmitry Shmidt <dimitrysh@google.com> bugreport: Add /proc/interrupts dump

Bug: 7301178

Change-Id: Ifad3b981ac904d4637d69dfc223d5bb2c9d80bda
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
umpstate.c
c11f56e5615c5d388c072705322df5bcf22c2012 07-Nov-2012 Dmitry Shmidt <dimitrysh@google.com> bugreport: Add wlan FW counters dump for bcmdhd

Bug: 7494877

Change-Id: I4d24dbcf7596777ec02ab1312c2ab996ba7688f1
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
umpstate.c
0c22e8b31651caf12a2b4d4acef5bc65d486e570 02-Nov-2012 Colin Cross <ccross@android.com> dumpstate: dump all threads in show_wchan

for_each_pid only finds processes and not their threads. Add
for_each_tid and call it for show_wchan so we can see where all
threads are blocked in the kernel.

Change-Id: Iffb59f7c2933cecf51cdd358a36e19932c2f24c7
umpstate.c
umpstate.h
tils.c
2281af967dd840aade7bc55b19ea7df0e6da36f2 29-Oct-2012 Colin Cross <ccross@android.com> dumpstate: add kernel memory fragmentation unusable index

Dump /d/extfrag/unusable_index in bugreports. It shows the
percentage of memory in each zone that is not available for
allocations for each order.

Change-Id: I2af6680cb609887ea7b3d6107d1aa88bd0206b52
umpstate.c
719b8aa1c5c2c2e5675f92442f3da8509b297775 01-Oct-2012 Jeff Sharkey <jsharkey@android.com> Include Global table in bugreports.

Bug: 7257648
Change-Id: I84c7230fd115cf9d7269bc5367026b52cbcc86ac
umpstate.c
c8cff90d49b6eeaf0290c16517ff49df185dbdcd 17-Sep-2012 Elliott Hughes <enh@google.com> Merge "Use a named constant rather than a magic number." into jb-mr1-dev
5f87b31d8076dff08b2363961b07fc052364fe95 17-Sep-2012 Elliott Hughes <enh@google.com> Use a named constant rather than a magic number.

Change-Id: I86e8c91c6f5628df3eec38faf28598cc8cef2ea3
tils.c
86ca50d860fa256f5553ac7b313ba5ff0f120ef0 17-Sep-2012 jp abgrall <jpa@google.com> am e917bfbd: am 09a22fc2: Merge "Allow disable of dumpstate vibrate"

* commit 'e917bfbd19c265ef09c90f93f5dc175fc62259f5':
Allow disable of dumpstate vibrate
1f794c442cc63f7962c21e8e712adeca338af63e 17-Sep-2012 John Michelau <w14107@motorola.com> Allow disable of dumpstate vibrate

Change-Id: I747b757f4b5e2d6a472b7b2a19f8c1ca8a4b7fdd
umpstate.c
1fc4f80fc38f782f128102795481924a97a2d3c5 11-Sep-2012 James Dong <jdong@google.com> Add stack dump from drmserver process to bugreports

This would be helpful tracking down ANR issues in drmserver

o related-to-bug: 7132419

Change-Id: I7eceaa0c29af26bd0092110be6bddf8f4c063545
tils.c
85aea748861b5665e68b786b55f1c798f56fc0da 09-Aug-2012 Mathias Agopian <mathias@google.com> add /d/sync to dumpstate

Change-Id: I24f8f3e0420c2198ae3981fc067fb660898655e8
umpstate.c
04d7eaf138678ef591076ff02b896f93394bcfaf 09-Jun-2012 Jeff Brown <jeffbrown@google.com> am 4f0dfaa7: am 9be7caf3: Merge "Include stack traces for certain native processes in bugreport." into jb-dev

* commit '4f0dfaa7c338870eb58d96fe40234505734db728':
Include stack traces for certain native processes in bugreport.
bf7f49238d0af497d4300f7e611cf831854d6434 08-Jun-2012 Jeff Brown <jeffbrown@google.com> Include stack traces for certain native processes in bugreport.

Bug: 6615693
Change-Id: I64c3b3ce0bba62d9c332a795f7d979fb753dc27b
ndroid.mk
umpstate.c
umpstate.h
tils.c
1e339878c128ef47271278779c2685a8dfa49cd1 25-Apr-2012 Nick Kralevich <nnk@google.com> dumpstate: handle old style "adb bugreport"

When "adb bugreport" was run on previous adb releases, it
called "adb shell dumpstate". In later versions of Android,
this was changed to "adb shell bugreport", which starts
the dumpstate service.

Modify the dumpstate command so that it calls bugreport
when it's not running as root. This allows both
"adb shell dumpstate" and "adb shell bugreport" to have
the exact same output.

Bug: 6391938
Change-Id: Ia32bb9ebc579db3bee7caa0fe66dc3f124d60a12
umpstate.c
29e27a84c144fe3b941648094cad2a3f1e61e8b3 23-May-2012 Todd Poynor <toddpoynor@google.com> dumpstate: Add kernel wakeup sources info

Change-Id: I0f95afd6815c1403d8400a18ef3cd19d936d4601
umpstate.c
13461c2ffe1c77a0c11a922ba41b0922791a7874 17-May-2012 Jeff Sharkey <jsharkey@android.com> Dump packages.xml as root.

Bug: 6501151
Change-Id: Ied638bdbe9ed6fbf749a44de8ac1f9d4167829c1
umpstate.c
012c2ea5651a56218a4359c78db26dd700d9930b 17-May-2012 JP Abgrall <jpa@google.com> dumpstate: collect xtables based iface stats, update iptables info.

The newer kernels now have /proc/net/xt_qtaguid/iface_stat_fmt.
Add the extra iptables output and remove ip6tables for nat which doesn't
exist.

Change-Id: I819c707b337a707ca0acd87d9ab38cd68ca0f36c
umpstate.c
3e03d3fb6a4cb93f5f978f9d2eed7b7cc62a06a6 11-May-2012 JP Abgrall <jpa@google.com> Ignore SIGPIPE is some of the tools used via bugreport

adb bugreport > b & sleep 5; kill $?
will show that a bunch of tools will SIGPIPE when trying to output data
which is normal.
We don't have a way on linux (bsd yes), to set NOSIGPIPE on the file desc
passed down via fork/exec.

Bug: 6447319
Change-Id: I25b30a823addcff89d252f162d0a07035d4fdd3f
umpstate.c
4287cb4595d72066bc2d3cd1e2ac59cde254c707 11-Apr-2012 Jeff Sharkey <jsharkey@android.com> Add sdcard_r group to dumpstate.

Bug: 6321962
Change-Id: I318cd88493396f3d8adb5d4d0fc7a12ee40ba737
umpstate.c
d51820e8dea4f5bd9d06ff22335bead7409864b2 06-Apr-2012 Nick Kralevich <nnk@google.com> dumpstate: don't follow symlinks when creating /data/anr/traces.txt

Make Android more robust against symlink attacks when /data/anr
is world-writable.

Bug: 5614000
Change-Id: I9a7e4c4ec9aa4300ac30a968db0dcd276f364ab6
tils.c
c7f1fe26804ab986b90f3ba007db94f71e94932a 06-Apr-2012 Nick Kralevich <nnk@google.com> Ensure that /data/anr/traces.txt is world-writable

The umask changed for init. We have to force /data/anr to be world
readble and /data/anr/traces.txt to be world writable so dalvik
processes can write to it.

Hopefully this is a short term change while we investigate tightening
up these permissions.

Bug: 6300296
Change-Id: Iacb4c9f1bc69d2ac679697f9cf9a52694f888489
tils.c
f45fa6b2853cc32385375a0b63ee39ad6a968869 26-Mar-2012 Colin Cross <ccross@android.com> move dumpstate and dumpsys from frameworks/base to frameworks/native

Change-Id: I8a5318022ce5cd3e7c8055f21fe5da74639aa6c0
ndroid.mk
umpstate.c
umpstate.h
tils.c