bootstat: Update boot reason property earlier
bootstat updates boot reason upon boot_complete, however users of the updated properties e.g. getLastShutdownReason from PowerManager could be called before boot_complete. This introduces a inconsistency and racing for those APIs. In this CL, we change boot reason to be updated at the same time when zygote starts where persist properties have been loaded already. Also the initialization of bootloader's boot reason is pulled into post-fs where all kernel command line arguments have been parsed in init already. Bug: 122696730 Bug: 119509425 Test: trigger thermal shutdown and see warnings Test: verify boot reason properties updated correctly post boot Change-Id: Ia393b98ea072bc0ae6e4110d111393b34be0ee5d Signed-off-by: Wei Wang <wvw@google.com>
This commit is contained in:
parent
708d45979c
commit
4e9c653c93
bootstat
|
@ -1,7 +1,9 @@
|
|||
# This file is the LOCAL_INIT_RC file for the bootstat command.
|
||||
|
||||
# mirror bootloader boot reason to system boot reason
|
||||
on property:ro.boot.bootreason=*
|
||||
# Mirror bootloader boot reason to system boot reason
|
||||
# ro.boot.bootreason should be set by init already
|
||||
# before post-fs trigger
|
||||
on post-fs && property:ro.boot.bootreason=*
|
||||
setprop sys.boot.reason ${ro.boot.bootreason}
|
||||
|
||||
on post-fs-data
|
||||
|
@ -66,11 +68,16 @@ on boot
|
|||
on property:init.svc.zygote=stopping
|
||||
setprop sys.logbootcomplete 0
|
||||
|
||||
# Set boot reason
|
||||
on zygote-start
|
||||
# Converts bootloader boot reason and persist.sys.boot.reason to system boot reason
|
||||
# Need go after persist peroperties are loaded which is right before zygote-start trigger
|
||||
exec_background - system log -- /system/bin/bootstat --set_system_boot_reason
|
||||
|
||||
# Record boot complete metrics.
|
||||
on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
|
||||
# Converts bootloader boot reason to system boot reason
|
||||
# Record boot_complete and related stats (decryption, etc).
|
||||
# Record the boot reason.
|
||||
# Record time since factory reset.
|
||||
# Log all boot events.
|
||||
exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l
|
||||
exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l
|
||||
|
|
Loading…
Reference in New Issue