Commit graph

150 commits

Author SHA1 Message Date
Lisa Liu
82674dedcd bootstat: Add Tj thermal shutdown
Add "reboot,thermal,tj" to kBootReasonMap

Bug: 174705050
Test: adb shell echo 110000 > /dev/thermal/tz-by-name/BIG/emul_temp
adb shell bootstat -p

Change-Id: Iea7da4024a57eff7a758e0e9a2321eb220fc5c28
2021-03-17 08:56:06 +00:00
Yifan Hong
08ba15d143 bootstat: clarify unit.
Test: pass
Change-Id: I7fc5cf9a5ae8ff895e20922bc7266ef210e8659f
2021-03-03 17:13:34 -08:00
Jim Kaye
b7386a6239 Add Silent Mode boot controls
Add "reboot,forcedsilent" and "reboot,forcednonsilent"

Bug: 134521909
Test: Manually with 'adb reboot forcedsilent'
Change-Id: Ib07d2b78e6263bc25b23e9973590e399eaf4d7ca
2020-07-01 16:57:01 -07:00
Nikita Ioffe
49062f3b72 Improve logging in bootstat.
This should help in debugging issues related to the mismatch between
actual last reboot reason property and the expected one (see attached
bug).

Test: adb reboot
Test: adb logcat | grep bootstat
Bug: 152900920
Change-Id: I085cf1fb80a30389fd3ba821d40b6111a3294d95
2020-04-02 13:03:21 +01:00
Mark Salyzyn
ee016ce0b3 bootstat: enhance last reboot reason property with file backing
Helps with support of recovery and rollback boot reason history, by
also using /metadata/bootstat/persist.sys.boot.reason to file the
reboot reason.

Test: manual
Bug: 129007837
Change-Id: Id1d21c404067414847bef14a0c43f70cafe1a3e2
2020-02-14 13:24:16 -08:00
Keun young Park
606af6dfff bootstat: Migrate to StatsLog for metrics
- All events are migrated to StatsLog atoms.
- Still keep the string based name for BootEvent logging as that makes it
  easier for debugging purpose.

Bug: 132691841
Test: check boot related stats are pushed after boot up
      $ adb shell cmd stats print-stats

Change-Id: I33313695a8a2d0a3c74f7705c0843c8c4bad2133
Merged-In: I33313695a8a2d0a3c74f7705c0843c8c4bad2133
2020-02-05 12:53:24 -08:00
Howard Ro
fe0b389190 Remove libmetricslogger dependency from bootstats
These are either already migrated or are planned to be migrated to
statsd.

Bug: 147777989
Bug: 148575354
Test: compiles
Merged-In: I00b110dcf5cf4a0fb1673fe05004662b6f3327d0
Change-Id: I00b110dcf5cf4a0fb1673fe05004662b6f3327d0
2020-01-31 17:39:02 -08:00
Nikita Ioffe
4a787d96ce Whitelist reboot reasons related to userspace reboot failure
Test: system/core/bootstat/boot_reason_test.sh
Bug: 135984674
Change-Id: I31422329f1109273909293a83913ae801eb1fe52
2020-01-23 00:12:02 +00:00
Tom Cherry
a76bfb2d97 Simply reboot if the boringssl self test fails
If this check fails and an OTA or mainline module update has recently
happened, we want to rollback the recent change.  The easiest way to
handle this is to reboot, which will trigger the fallback mechanisms
that are already in place.

Bug: 141082587
Test: device reboots if self test fails
Test: device rolls back a recently applied OTA with failing self test
Test: device rolls back a recently applied conscrypt apex update with
      failing self test
Change-Id: Iff879deff09d347262dc7a2acadb9164a5029d4a
2019-09-19 14:59:07 -07:00
Mark Salyzyn
61c7cc6d88 Merge "bootstat: power_on* handling"
am: 91338a6aa2

Change-Id: Ia3cccc615dbb49c3624e73ea248b9e3c5d0ad61d
2019-07-15 08:59:33 -07:00
Mark Salyzyn
48d03ad3f0 bootstat: power_on* handling
Missed spots: power_on_charger to cold,charger and
power_on added to cold,powerkey alias list.

Test: boot_reason_test.sh
Change-Id: Ie25ce55a6b4c01eb06bd6c3b223114255218e4d5
2019-07-09 11:35:49 -07:00
Jone Chou
8ba1ba26d6 Merge "bootstat: add reboot,longkey sub-reason to known set" am: c0349199db
am: 3418abfed7

Change-Id: I1bbebb85ea7da6b64930a594f41389eaf606b3df
2019-06-25 01:02:09 -07:00
Jone Chou
b9a8033037 bootstat: add reboot,longkey sub-reason to known set
regular expression:
- "reboot,longkey,.*" (184)

regex is dependent on:
- https://android-review.googlesource.com/947976

Test: none
Bug: 132955428
Bug: 133520088
Change-Id: I53d13d95ac11ac73273824156363378372a562ed
2019-06-24 06:29:49 +00:00
Mark Salyzyn
12e02d5668 Merge "recovery: report compliant reboot reason (Part Deux)" am: 5f7314b7e1
am: 789ae60a9d

Change-Id: I8edf9ca91a611dd43a4544505ae98edf3df857aa
2019-05-28 09:22:58 -07:00
Treehugger Robot
5f7314b7e1 Merge "recovery: report compliant reboot reason (Part Deux)" 2019-05-28 15:57:24 +00:00
Mark Salyzyn
65d8b9be99 recovery: report compliant reboot reason (Part Deux)
shutdown and reboot should have a corresponding sub-reason.

Updating:
    "reboot,userrequested,fastboot"
    "reboot,userrequested,recovery"
    "reboot,userrequested,recovery,ui"
    "shutdown,userrequested,fastboot"
    "shutdown,userrequested,recovery"
    "reboot,unknown#" (Can't happen, debug)

Test: none
Bug: 133326470
Change-Id: Icf1ab0d462ec2de2272914a36994a095998d6186
2019-05-23 13:53:03 -07:00
Wei Wang
ef320007a7 Report non-empty system boot reason when bootloader reason is empty
Bug: 133321647
Test: build
Change-Id: Iada572f969d100ded28639c64afbb2d7440d032a
Merged-In: Icd3ea4b69ef2ad040926e2b0e121a8f5f1c1b658
2019-05-22 14:55:49 -07:00
Wei Wang
f5730912ef Merge "Report non-empty system boot reason when bootloader reason is empty" into qt-dev
am: c39fcd42d7

Change-Id: Iadbf136ae1f2b567033750cfd12302ab2c4b2dce
2019-05-22 14:37:18 -07:00
Wei Wang
699e342b3d Report non-empty system boot reason when bootloader reason is empty
Bug: 133321647
Test: build
Change-Id: Icd3ea4b69ef2ad040926e2b0e121a8f5f1c1b658
2019-05-22 09:46:02 -07:00
Mark Salyzyn
8d1be80de2 bootstat: add recovery/fastboot boot reasons
Test: none
Change-Id: I3013c28d02c9744bdfa312c179143f7db9e51596
2019-05-21 10:54:07 -07:00
Mark Salyzyn
4e7acf7075 bootstat: label Mediatek boot reasons
Comment which strings come from Mediatek devices to aid maintenance.

Test: compile
Bug: 74595769
Bug: 63736262
Change-Id: Ic60970bcbbb389e4158ee691c4c81e6514d3b870
2019-05-21 10:53:56 -07:00
Mark Salyzyn
10377df9f8 init: ro.boottime.init.first_stage
Add a property ro.boottime.init.first_stage to provide us a
first stage init duration from start to exec completed in
nanoseconds.

For consistency, report nanoseconds duration for
ro.boottime.init.selinux as well instead of milliseconds.
Now also report consistently from start to exec completed
instead of just the selinux load time.

SideEffects: ro.boottime.init.selinux is reported to TRON and
             may alarm with the millionfold increase in precision.
             ro.boottime.init is now also consistent with ns
             precision.

Test: inspect
Bug: 124491153
Bug: 129780532
Change-Id: Iff4f1a3a1ab7ff0a309c278724c92da0832b9a69
2019-05-08 16:07:10 +00:00
Jone Chou
edf4682cae bootstat: add 3 pmic off reasons to known set
regular expression:
- "reboot,pmic_off_fault,.*" (175)
- "reboot,pmic_off_s3rst,.*" (176)
- "reboot,pmic_off_other,.*" (177)

regex is dependent on:
https://android-review.googlesource.com/947976

Test: none
Bug: 116838876
Bug: 128929506
Change-Id: I7fae9ecee536f790c8f493c3f5e5f75b03efb1d6
Signed-off-by: Jone Chou <jonechou@google.com>
2019-05-03 14:41:21 +00:00
Mark Salyzyn
c805a48b11 bootstat: Allow regex matches for boot reasons
If the matching string contains a [, \ or *, then it is also checked
with a regex match.  Exact match is always tried firsts.  If we do
not find an exact string match, switch to iterate through the entire
list for regex strings to find a match.

This allows us to scale with details without consuming a large
number of enums, permitting details that we do not necessarily want
resolution on to propagate to TRON.  The hierarchical nature of the
boot reason <reason>,<subreason>,<detail>... can cause scenarios
where the <detail> does not matter to TRON, but does matter to
bugreport collection.

Add a bootstat --boot_reason_enum function to expose and test the
kBootReasonMap matchihg algorithm.

Add a kBootReasonMap test that exhaustively tests all built-in
entries, and an example of one regex entry.  New regex entries added
to bootstat.cpp will need a series of exact match examples added into
filter_kBootReasonMap() function.

Test: boot_reason_test.sh kBootReasonMap (or all tests)
Bug: 116838876
Bug: 128929506
Change-Id: I3f7b5de22f99195b7ce99672a212174365960b3f
Merged-In: I3f7b5de22f99195b7ce99672a212174365960b3f
2019-05-01 18:17:04 +00:00
Jone Chou
446d6c6d01 bootstat: add 3 pmic off reasons to known set
regular expression:
- "reboot,pmic_off_fault,.*" (175)
- "reboot,pmic_off_s3rst,.*" (176)
- "reboot,pmic_off_other,.*" (177)

regex is dependent on:
https://android-review.googlesource.com/947976

Test: none
Bug: 116838876
Bug: 128929506
Change-Id: I7fae9ecee536f790c8f493c3f5e5f75b03efb1d6
Signed-off-by: Jone Chou <jonechou@google.com>
2019-04-24 14:14:10 +08:00
Mark Salyzyn
67ee8a8ef9 bootstat: Allow regex matches for boot reasons
If the matching string contains a [, \ or *, then it is also checked
with a regex match.  Exact match is always tried firsts.  If we do
not find an exact string match, switch to iterate through the entire
list for regex strings to find a match.

This allows us to scale with details without consuming a large
number of enums, permitting details that we do not necessarily want
resolution on to propagate to TRON.  The hierarchical nature of the
boot reason <reason>,<subreason>,<detail>... can cause scenarios
where the <detail> does not matter to TRON, but does matter to
bugreport collection.

Add a bootstat --boot_reason_enum function to expose and test the
kBootReasonMap matchihg algorithm.

Add a kBootReasonMap test that exhaustively tests all built-in
entries, and an example of one regex entry.  New regex entries added
to bootstat.cpp will need a series of exact match examples added into
filter_kBootReasonMap() function.

Test: boot_reason_test.sh kBootReasonMap (or all tests)
Bug: 116838876
Bug: 128929506
Change-Id: I3f7b5de22f99195b7ce99672a212174365960b3f
2019-04-23 07:14:44 -07:00
Jone Chou
d51036d641 bootstat: add 4 reboot reasons to known set
- reboot,rtc
- reboot,dm-verity_device_corrupted
- reboot,dm-verity_enforcing
- reboot,keys_clear

Test: none
Bug: 128929506
Bug: 128929604
Change-Id: I5438c236abb67b74c7b9d717930c0ea69f70540d
Signed-off-by: Jone Chou <jonechou@google.com>
2019-03-20 16:53:29 +00:00
Jone Chou
508e615b8e bootstat: add 4 reboot reasons to known set
- reboot,rtc
- reboot,dm-verity_device_corrupted
- reboot,dm-verity_enforcing
- reboot,keys_clear

Test: none
Bug: 128929506
Bug: 128929604
Change-Id: I5438c236abb67b74c7b9d717930c0ea69f70540d
Signed-off-by: Jone Chou <jonechou@google.com>
2019-03-20 19:44:20 +08:00
Mark Salyzyn
6fc0829c5a bootstat: add recovery,quiescent and reboot,quiescent to known set
Reserve recovery,quiescent and reboot,quiescent to known reboot
reasons.

Test: none
Bug: 120624642
Change-Id: I78c52f6db447c9d3980a3f2007471bc7aa60e25f
2019-03-11 10:08:05 -07:00
Mark Salyzyn
88d308d786 bootstat: local GetProperty use libbase
libbase GetProperty collects the properties properly, which also
allow for content greater than 128 bytes in length.

Replace internal GetProperty and SetProperty helpers with libbase
version.

Test: unit tests
Bug: 121161069
Bug: 124114707
Change-Id: Ic0829955705ebaa19d747bb3f6942f4b9786316a
2019-02-11 13:16:59 -08:00
Mark Salyzyn
7c72116c43 bootstat: crash when parsing ro.boot.boottime
If ro.boot.boottime is malformed or truncated, it will crash
bootstat operations.

Test: compile
Bug: 121161069
Bug: 124114707
Change-Id: Ie2edcffb6d54a8e0c7f2e9a89ae4b29cce246d75
2019-02-08 19:54:41 +00:00
Mark Salyzyn
f62983a646 bootstat: smpl -> reboot,powerloss
smpl anywhere in boot loader reason string will match and convert to
reboot,powerloss when propagated to system boot reason.

Test: compile
Bug: 63736262
Change-Id: I156bfefd05d2bab480408cf6bb1dc4c61c8983f9
2018-09-26 13:02:16 -07:00
Mark Salyzyn
ec7bafee94 bootstat: uvlo -> reboot,undervoltage
uvlo anywhere in boot loader reason string will match and convert to
reboot,undervoltage when propagated to system boot reason.

Test: compile
Bug: 63736262
Change-Id: I14b0b7e8185aa4fb519efdb6cb1306718e9de69c
2018-09-26 13:02:16 -07:00
Mark Salyzyn
274b5447fa bootstat: duplicate boot reason entries
Selected visually obvious non-compliant boot reasons to allow
for future re-use of a later formerly duplicated entry.

Test: compile
Bug: 112157996
Change-Id: I3c6b449d36f9e4b745214dd7840b1dc1258bf483
2018-08-07 09:57:32 -07:00
Mark Salyzyn
0e78b13226 Merge "bootstat: record reboot reason history in persist.sys.boot.reason.history"
am: 70025585ff

Change-Id: Ife1200808d84f198441821f0af9d0b11e22780fa
2018-07-02 13:34:25 -07:00
Treehugger Robot
70025585ff Merge "bootstat: record reboot reason history in persist.sys.boot.reason.history" 2018-07-02 20:28:49 +00:00
Mark Salyzyn
c858df30a7 Merge "bootstat: kpdpwr actually means reboot,longkey"
am: 50d874b873

Change-Id: Ic8e4655df0d55a8a3a356e3ca72ea3e7680cfdad
2018-07-02 11:14:50 -07:00
Mark Salyzyn
5c58c9d566 bootstat: record reboot reason history in persist.sys.boot.reason.history
Retain the last four reboot reasons from latest to oldest, adding a
detail of UTC epoch time for each.  Beef up boot_reason_test.sh to
deal with multi-line content.

Test: boot_reason_test.sh
Bug: 110925971
Change-Id: Ie2600434b95a885693f005a363ee38d9eba18ee7
2018-06-29 13:54:07 -07:00
Mark Salyzyn
88d1b4a326 bootstat: kpdpwr actually means reboot,longkey
Test: compile
Bug: 71809701
Change-Id: I812777645b988f9627bcf62e7ef70cc2085d9106
2018-06-28 17:40:26 +00:00
Elliott Hughes
d60dad16a3 resolve merge conflicts of 8c6f7ec060 to stage-aosp-master
BUG: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ibd2adc272b69d9752f04bee5901fc7590aaaf93a
2018-06-16 08:37:57 -07:00
Elliott Hughes
50a24eb3bc bootstat: remove the only caller of liblogcat.
We need to make progress both on adding the real interface for battery
level and cleaning up logging. This stands in the way of both.

Bug: http://b/77725702
Test: builds
Change-Id: Ia457e497606c2c7965d6895baebb26eef17857c9
Merged-In: Ia457e497606c2c7965d6895baebb26eef17857c9
2018-06-15 12:36:46 -07:00
Mark Salyzyn
a58318960e resolve merge conflicts of ca57890a80 to stage-aosp-master
Bug: 86671991
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ia49d1a9311f6a7a84dd96c31f79ecdc3143084b2
2018-06-14 15:06:36 -07:00
Mark Salyzyn
adc433d3ea bootstat: clear persist.sys.boot.reason once read
To ensure a surprise reboot does not take the last boot reason on
face value especially if coming from more than one boot sessions ago.
We shift and clear the value from persist.sys.boot.reason to
sys.boot.reason.last and establish a correct last reboot reason in
the canonical sys.boot.reason property.

This effectively deprecates persist.sys.boot.reason as an API.  They
should have been using sys.boot.reason instead for a correctly
determined reasoning.

Test: boot_reason_test.sh
Bug: 86671991
Merged-In: If85750704445088fd62978679ab3a30744c46abb
Change-Id: If85750704445088fd62978679ab3a30744c46abb
2018-06-14 15:36:56 +00:00
Luis Hector Chavez
bfe1835d82 Merge "bootstat: Remove the CAP_SYSLOG capability"
am: cefd4e56ad

Change-Id: I0a0627228434d0284b4f535942c97121d9773e14
2018-06-12 15:00:42 -07:00
Treehugger Robot
cefd4e56ad Merge "bootstat: Remove the CAP_SYSLOG capability" 2018-06-12 20:59:45 +00:00
Mark Salyzyn
fa284f0fdb Merge "bootstat: ppdone_timeout kernel panic"
am: e5aa7ee753

Change-Id: Idbedd218104a272458192123ddf889d5d9fb379b
2018-06-12 08:58:23 -07:00
Luis Hector Chavez
0becca32bc bootstat: Remove the CAP_SYSLOG capability
This change removes the CAP_SYSLOG file based capability from bootstat,
since the intention is that it should not be accessing the logs in the
long term. In order to avoid bitrot, the fallback code that depends on
CAP_SYSLOG has also been removed.

Bug: 62845925
Test: system/core/bootstat/boot_reason_test.sh
Change-Id: I899be44ef3ac1c4d81072f801d55c928ae09bb15
2018-06-11 12:41:24 -07:00
Mark Salyzyn
78e54fd0ab bootstat: ppdone_timeout kernel panic
Add kernel_panic,_sde_encoder_phys_cmd_handle_ppdone_timeout to help track
occurrences.

Test: compile
Bug: 67728931
Change-Id: I3306ae2936dc4355902e838d9ac8d8b11837348d
2018-06-08 10:37:06 -07:00
Mark Salyzyn
fe8c22df50 Merge changes Iecedc3b1,I28987f08 am: dc17e9efa0
am: 0d18efbdf8

Change-Id: I97fbc26deaad32ad6719ef8496722872b7928595
2018-06-04 16:34:01 -07:00
Tej Singh
993f65619e Fix performance degradation from BootSequence atom
(partial cherry pick from commit fe3e762b6d)

Adding the boot sequence reported atom in ag/3518079 caused the duration
of bootstat to increase, as seen in b/72864061. I isolated the cause
down to calling BootReasonStrToReason. However, this function also gets
called in ReportBootReason, so I created another function that does the
parsing and sets the system boot reason property, and made
RecordBootReason and statsd logging get that property.

Bug: 72864061
Test: rebooted phone, verified boot events were received in adb shell
logcat -b stats and verified adb shell bootstat -p printed correct
values. Ran timing tests as well on walleye with 20 boots: before this
change, the average was ~150-160ms. After, it was ~80ms.
Change-Id: I92dbc9880328835647be7d9d50c7861b42f27bdb
Merged-In: I92dbc9880328835647be7d9d50c7861b42f27bdb
2018-06-04 13:31:05 -07:00