Commit graph

159 commits

Author SHA1 Message Date
Elliott Hughes
1c5911fade Remove unused addKernelPanicSubReason() return value.
The only caller that was looking at the return value just stopped.

Test: treehugger
Change-Id: Icf2508e8e1ee4969918eadeb580f70236ba53496
2024-02-07 22:22:13 +00:00
Zheng Pan
fa544b551b bootstat: Remove long key press check
Current check is kind of device specfic and causes false positive.

Bug: 320829712
Test: Trigger long key press and check boot reason
Change-Id: I5b2b8307f16eecd05513bfa51494da174fc839bd
2024-02-06 17:39:27 -08:00
Jason Chiu
d07ec30423 bootstat: add more bootreasons
add more bootreasons for new design.

Bug: 296637681
Test: trigger apc watchdog then "adb root; adb shell bootstat -p"
Change-Id: Ia78146ba9299eea45e7d89376179e01cbd37cca8
Signed-off-by: Jason Chiu <jasoncschiu@google.com>
2023-10-20 05:56:34 +00:00
David Tracy
691d805d30 bootstat: Adds additional reboot reason patterns
- Adding allowance for arbitrary ota subreason details, such as
  success or failure conditions
- Adding the new subreason "periodic", which is useful for POS devices
  which require e.g. daily reboots as part of security requirements
Test: Full Android build

Change-Id: Id0a6d38ed902e2b25fbb050980c763912c948f27
Signed-off-by: David Tracy <dtracy@squareup.com>
2023-03-24 09:04:07 -07:00
Eric Biggers
d76e4e01c9 bootstat: remove unused FDE boot events
Android 13 dropped support for Full Disk Encryption (FDE) entirely, as
it has been replaced by File Based Encryption (FBE).  Therefore, the
FDE-specific boot events are never emitted.  Remove them from the code:

   * boot_decryption_complete
   * boot_complete_post_decrypt
   * factory_reset_boot_complete_post_decrypt
   * ota_boot_complete_post_decrypt
   * post_decrypt_time_elapsed

Bug: 208476087
Change-Id: Id7a3bbd4f273693bd37b0cd27542dc6080d1c4f4
2022-09-26 19:50:09 +00:00
Jone Chou
11160ed297 bootstat: add more bootreasons
add more bootreasons for new platform

Bug: 236191641
Test: trigger apc watchdog then "adb root; adb shell bootstat -p"
Change-Id: I8bbbe57e6c70959a4ec848b59065d0ee9fca50db
2022-07-13 17:13:16 +00:00
jiajia tang
f083957850 Replace deprecated atoms.proto file path
Path of "frameworks/base/cmds/statsd/src/atoms.proto"
is out of date. Latest path is
"frameworks/proto_logging/stats/atoms.proto".

Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Change-Id: Ib9471e812466238d79e836b026123f167aaad701
2022-07-12 06:01:44 +00:00
Jason Chiu
17251023bd bootstat: add more bootreasons
add more bootreasons for new projects

Bug: 219902794
Test: trigger apc watchdog then "adb root; adb shell bootstat -p"
Signed-off-by: Jason Chiu <jasoncschiu@google.com>
Change-Id: I7e19c4d48fb3d5b1c49dc8688936cf1d6eea6e9c
2022-07-03 14:07:09 +00:00
Howie Chang
d5f24c5bb9 bootstat: add more bootreasons
add more bootreasons for new projects

Bug: 184012295
Test: trigger apc watchdog then "adb shell bootstat -p"
Change-Id: I7166969dde3675cdbe8433dbfba634a192f6be33
2021-09-19 19:11:06 +00:00
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