Commit graph

22134 commits

Author SHA1 Message Date
Felipe Leme
80a65d03c9 Minor improvements on bugreport generation.
- Skipped artificial 100/100 message, since pulling will take care of
  the final 100% progress.
- Consolidated unsupported lines in just one message.
- Let user know the bugreport can still be recovered when it could not
  be copied to the destination directory.

BUG: 30451114

Change-Id: Icfce9c1e8e7ed407719728b9874679ac40b21eab
2016-08-01 13:31:57 -07:00
James Hawkins
f85554e12f bootstat: Fix a potential unhandled exception for malformed input.
In rare cases the hardware storage on the device may be hosed and return
garbage.  Use ParseInt which handles bad input instead of stoi.

BUG: 29334139
Change-Id: I91aedc169df110bea8097775f73dda11def22311
(cherry picked from commit 4dded613b3)
2016-07-29 08:24:28 -07:00
TreeHugger Robot
a6cb3062ff Merge "Improved keychord logging." into nyc-mr1-dev 2016-07-29 01:07:09 +00:00
Felipe Leme
c64c982e72 Improved keychord logging.
Often a bugreport is accidentally triggered by the combo keys, but there
is nothing in the bugreport to confirm that action because init's
klog level is KLOG_NOTICE_LEVEL.

This change change keychord's INFO messages to NOTICE, and also logs the
case where a service was not launched because ADB was disabled.

BUG: 30440213
BUG: 30345559

Change-Id: I6ccadef1621cb41dcd15e7c1660366f0e147dc7a
2016-07-28 14:11:32 -07:00
Felipe Leme
f7c38b4c03 Removed extra 'pulling file' message.
Taking a zip bugreport has 2 phases: generating the bugreport and
pulling the file.

Initially adb was printing 2 messages, but since the latter is almost
instantaneously, it could be confusing to have 2 lines...

Fixes: 30451250
Change-Id: I1c6cc6163492c1fb6064667dfdb7aaf6ed4c4c6f
2016-07-28 12:13:57 -07:00
Felipe Leme
cd42d658b2 Show bugreport progress.
adb calls bugreportz to generate a bugreport; initially, bugreportz
would only report the final status of the operation (OK or FAIL), but
now it sends intermediate PROGRESS lines reporting its progress (in the
form of current/max).

Similarly, the initial implementation of 'adb bugreport <zip_file>'
would print an initial 'please wait' message and wait for the full
stdout before parsing the result, but now it uses a new callback class
to handle the stdout as it is generated by bugreportz.

BUG: 28609499

Change-Id: I6644fc39a686279e1635f946a47f3847b547d1c1
2016-07-26 16:15:16 -07:00
Felipe Leme
07ac8554b4 Refactored functions that copy sdout and stderr to strings to use a callback.
BUG: 28609499

Change-Id: I04aea346e18678ea00797f7f659480edba4436c2
2016-07-26 16:14:46 -07:00
Felipe Leme
78e0963e4b Split bugreport() into its own file and added unit tests.
bugreport() will be soon refactored to track progress, which will
require more comprehensive unit tests.

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

Fixes: 30100363
Bug: 30268737

Change-Id: I3cdf114a0b5547293320042ff0749a60886440b0
2016-07-26 16:14:20 -07:00
Mark Salyzyn
d211558788 Merge "logd: klogd: deal with htc modified printk" into nyc-mr1-dev 2016-07-21 18:09:10 +00:00
Fyodor Kupolov
1faf57bf0b Merge "Fix permissions for /data/preloads" into nyc-mr1-dev 2016-07-21 16:54:13 +00:00
Thierry Strudel
56efe020b7 Merge changes from topic 'enable_persist_kernel_log' into nyc-mr1-dev
* changes:
  logcatd: trampoline persist.logd.logpersistd to logd.logpersistd
  logcatd: add stop and clear actions
  logcatd: Do not su for setprop
  logcat: allow comma-separate list of buffers
  logcat: clear when specifying file output
  logcat: Adjust help to make it more meaningful
2016-07-21 04:07:25 +00:00
Fyodor Kupolov
13639b46d0 Fix permissions for /data/preloads
Default permission bits are 771. It causes permission denied errors when
MediaProvider tries to scan /data/preloads. We have to allow read for others.

Bug: 29940807
Change-Id: I45645cf1154501ccb64bef08b9ad7bf7709dfd8e
2016-07-20 17:25:12 -07:00
Josh Gao
087ea18caa DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644 am: 5920345eeb am: cb4d905c96 -s ours am: e467cced5c am: 174579d6ef am: a3a674ea10 am: ff716c73ea -s ours
am: 77374d698d

Change-Id: I9cdd6842033e57837a6466e8669aaa75f22af53e
2016-07-19 20:55:47 +00:00
Josh Gao
43250c10e8 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367 am: 9048b3bb8e am: 6cb199bf4a -s ours am: 851f840835 am: be484f3f7b am: 1e1eae1992 am: 71908ef2f8 -s ours
am: be2e5ea5a9

Change-Id: I9916a033d3fa29d340ef75e5a7c866415e4ce517
2016-07-19 20:55:47 +00:00
Josh Gao
77374d698d DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644 am: 5920345eeb am: cb4d905c96 -s ours am: e467cced5c am: 174579d6ef am: a3a674ea10
am: ff716c73ea  -s ours

Change-Id: I50b3147d6d31c1b8fec7ae4601f72ab9ce71327b
2016-07-19 20:53:21 +00:00
Josh Gao
be2e5ea5a9 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367 am: 9048b3bb8e am: 6cb199bf4a -s ours am: 851f840835 am: be484f3f7b am: 1e1eae1992
am: 71908ef2f8  -s ours

Change-Id: I0dda3544e9c6c44b61cd088e1423d42af35ad0e0
2016-07-19 20:53:20 +00:00
Josh Gao
ff716c73ea DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644 am: 5920345eeb am: cb4d905c96 -s ours am: e467cced5c am: 174579d6ef
am: a3a674ea10

Change-Id: I95414ed03014463d684b64c06b74a2a8616faaa2
2016-07-19 20:50:16 +00:00
Josh Gao
71908ef2f8 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367 am: 9048b3bb8e am: 6cb199bf4a -s ours am: 851f840835 am: be484f3f7b
am: 1e1eae1992

Change-Id: I2bd7a6994c5d426402ee9d3e2adcc16f603b7c62
2016-07-19 20:50:16 +00:00
Josh Gao
a3a674ea10 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644 am: 5920345eeb am: cb4d905c96 -s ours am: e467cced5c
am: 174579d6ef

Change-Id: Ie3efaa41bacc640286a3aa6cfe353b16c707f15f
2016-07-19 20:47:10 +00:00
Josh Gao
7500016d8f Merge \\\\\"DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.\\\\\" into mnc-dev am: 73922b82ee am: 8a9e4369f6 am: ba143fd959 am: b1471215a8 -s ours
am: e11ffee38c

Change-Id: Id1459e5c49d640dfbc826e32e1081480353d31f7
2016-07-19 20:44:26 +00:00
Josh Gao
174579d6ef DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644 am: 5920345eeb am: cb4d905c96 -s ours
am: e467cced5c

Change-Id: Id5534fddb6ca8c237fbcfd310a6843f03c12a3d3
2016-07-19 20:44:11 +00:00
Josh Gao
1e1eae1992 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367 am: 9048b3bb8e am: 6cb199bf4a -s ours am: 851f840835
am: be484f3f7b

Change-Id: I1c9a4f7cdec227e78910678f05e6232a60f05bb1
2016-07-19 20:43:26 +00:00
Josh Gao
e467cced5c DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644 am: 5920345eeb
am: cb4d905c96  -s ours

Change-Id: Ia99e7055a24da12133e48e03b466fe09ebcb811f
2016-07-19 20:42:28 +00:00
Josh Gao
e11ffee38c Merge \\\\"DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.\\\\" into mnc-dev am: 73922b82ee am: 8a9e4369f6 am: ba143fd959
am: b1471215a8  -s ours

Change-Id: I6932c59185c0e31e6db27431609a47049caa6dc8
2016-07-19 20:42:12 +00:00
Josh Gao
be484f3f7b DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367 am: 9048b3bb8e am: 6cb199bf4a -s ours
am: 851f840835

Change-Id: I4edf38e6bbee8745241329816647d730addc23ea
2016-07-19 20:40:05 +00:00
Josh Gao
cb4d905c96 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours am: b9b6ec3644
am: 5920345eeb

Change-Id: I06ba81a4abd04402ef250efebd333b878496cdab
2016-07-19 20:38:46 +00:00
Josh Gao
b1471215a8 Merge \\\"DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.\\\" into mnc-dev am: 73922b82ee am: 8a9e4369f6
am: ba143fd959

Change-Id: I7968a0d6d374c140c0b40a866d597dc6ca9ade25
2016-07-19 20:38:43 +00:00
Josh Gao
851f840835 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367 am: 9048b3bb8e
am: 6cb199bf4a  -s ours

Change-Id: I26ed6fa730d66419319a5832b7f011cd15601e03
2016-07-19 20:36:38 +00:00
Josh Gao
ba143fd959 Merge \\"DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.\\" into mnc-dev am: 73922b82ee
am: 8a9e4369f6

Change-Id: I7aa9984853f5114aea36d51ea2903b729b60d5e8
2016-07-19 20:35:39 +00:00
Josh Gao
5920345eeb DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 0528829b73 -s ours
am: b9b6ec3644

Change-Id: Iaf40759e124c4a01a9a3d21021939729a73c48e9
2016-07-19 20:35:39 +00:00
Josh Gao
1a0d789268 Merge \"debuggerd: verify that traced threads belong to the right process.\" into nyc-dev
am: d3d04f4d72

Change-Id: Ibe7073dfbb8f35acaf494fca82ac6a855a34c704
2016-07-19 20:34:17 +00:00
Josh Gao
8a9e4369f6 Merge \"DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.\" into mnc-dev
am: 73922b82ee

Change-Id: I36abe7ac6a52b561cfed8dfa689216b166f4df43
2016-07-19 20:34:12 +00:00
Josh Gao
6cb199bf4a DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 36dd144367
am: 9048b3bb8e

Change-Id: I2223884e41d15dabf94df861e28f9392b82678af
2016-07-19 20:33:40 +00:00
Josh Gao
b9b6ec3644 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
am: 0528829b73  -s ours

Change-Id: I1644cca9d9631f291a3e80b6813e9cc33a8d5833
2016-07-19 20:32:42 +00:00
Josh Gao
9048b3bb8e DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
am: 36dd144367

Change-Id: I29864f223541596e9ffccb44c0c257399b0d9cb0
2016-07-19 20:30:19 +00:00
Josh Gao
d3d04f4d72 Merge "debuggerd: verify that traced threads belong to the right process." into nyc-dev 2016-07-19 20:20:57 +00:00
Josh Gao
73922b82ee Merge "DO NOT MERGE: debuggerd: verify that traced threads belong to the right process." into mnc-dev 2016-07-19 20:20:56 +00:00
Mark Salyzyn
0b4a63d212 logd: klogd: deal with htc modified printk
Skip leading 'c0  32767 ' and place pid (32767 in example) into pid
field of log record.

Bug: 29831823
Change-Id: I9fcd3cb0235dfcad78627736712a20d2dc1250cc
2016-07-19 11:13:14 -07:00
Mark Salyzyn
df5d12850a logcatd: trampoline persist.logd.logpersistd to logd.logpersistd
(cherry pick from 2591d483c8)

Best practices so that device can set logd.logpersistd properties.
Values can be overriden with trampolines for persist.logd.logpersistd
values except as designed for empty content to keep out of the way.

This allows us to set logd.logpersistd* for a non-persistent collection
that does not survive a reboot, and to use persist.logd.logpersistd*
for persistent collection that does survive a reboot.

Added logd.logpersistd.enable to gate when logpersist service can be
run allowing the properties to be adjusted safely prior to this state
as is the case for device property.

NB: /init will complain when trying to trampoline an empty property,
    this is acceptable for functionality, but may be considered
    annoying from the logging perspective.

Bug: 28788401
Bug: 28813587
Bug: 28936216
Bug: 29831823
Change-Id: I97317e8eedfae4daa8e3ef39e64e7c5c23d8b573
2016-07-19 11:13:14 -07:00
Mark Salyzyn
2d737011d6 logcatd: add stop and clear actions
(cherry pick from commit cd5118bf1e)

- add stop and clear (and stop) actions to logcatd.rc
- use stop and clear actions in logpersist script

Bug: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Id05118fb51e40609fd7b3a934cf9302f67ef6d1d
2016-07-19 11:13:14 -07:00
Mark Salyzyn
befa79d7e0 logcatd: Do not su for setprop
(cherry pick from commit 8d2a65572b)

sepolicy now permits setting persist.logd.logpersistd in shell

Bug: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Ieed50eae0f91afa5b0c0e4ade7a71922c4b7ef93
2016-07-19 11:13:14 -07:00
Mark Salyzyn
7545b471a2 logcat: allow comma-separate list of buffers
(cherry pick from commit 4517773296)

- Add parsing to support comma+ separated list of buffers.
- Move get_size test into a standalone get_groups function
- add some additional tests for this feature, leveraging
  get_groups to confirm buffer selection.

Bug: 28120456
Bug: 28788401
Bug: 28813587
Change-Id: I0b42736c08cf4b2a435cb74cda540dc163a26bd1
2016-07-19 11:13:14 -07:00
Mark Salyzyn
c869959d62 logcat: clear when specifying file output
(cherry pick from commit b7d059bb2f)

If -c and -f are both specified, clear the files rather
than notifying the logger to clear its data. The -f then
acts like a switch between clearing the in-memory log
data, or the on-disk logrotate data.

Bug: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Ib1d1fb46ea09f81a2fd9bebb6c8f0f9f2355f6e8
2016-07-19 11:13:14 -07:00
Mark Salyzyn
3f6777a3dd logcat: Adjust help to make it more meaningful
(cherry pick from commit 378f4745a2)

It is not clear about the long option aliases, list
them comma separate first for clarity. Squash lines
of help content if possible. Lock to 3 indents, one
for options, another for text on same line as options
and another for next line or continuation.

Bug: 28120456
Bug: 28788401
Bug: 28813587
Change-Id: I5331acde3ac0fd3b87f6699ba108f6cef46a1563
2016-07-19 11:13:10 -07:00
Josh Gao
ddf5451df0 adb: use asocket\\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402 am: 29aa08f8cc -s ours
am: 2ca04650df

Change-Id: Idf98d144e2416c98e8d585b98a9175ea71417a51
2016-07-18 20:24:17 +00:00
Josh Gao
a50e8ffa7d DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
Fix two races in debuggerd's PTRACE_ATTACH logic:
  1. The target thread in a crash dump request could exit between the
     /proc/<pid>/task/<tid> check and the PTRACE_ATTACH.
  2. Sibling threads could exit between listing /proc/<pid>/task and the
     PTRACE_ATTACH.

Backport of NYC change I4dfe1ea30e2c211d2389321bd66e3684dd757591
Bug: http://b/29555636
Change-Id: I6c6efcf82a49bca140d761b2d1de04215ba4d252
2016-07-18 13:23:29 -07:00
Josh Gao
2ca04650df adb: use asocket\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402
am: 29aa08f8cc  -s ours

Change-Id: I0dc701f0946e066ecab854f99867057629b1ccc9
2016-07-18 20:20:29 +00:00
Josh Gao
d4d4edf81b adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e am: 163802c244 -s ours
am: 46468f8cef

Change-Id: Ic01011008edb3481c0a4191aaf2f178e76c3458c
2016-07-18 20:17:18 +00:00
Josh Gao
46468f8cef adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e
am: 163802c244  -s ours

Change-Id: I778721bfdf8bace675ca86fb2b49a1d0ecd052b2
2016-07-18 20:12:58 +00:00
Josh Gao
29aa08f8cc adb: use asocket\\\'s close function when closing. am: f71c01493a am: d179556680
am: e2a5846402

Change-Id: I089c7390c4e5f325b3c6e8ff54012430a436c05d
2016-07-18 19:54:17 +00:00