2016-01-22 00:16:36 +01:00
|
|
|
# This file is the LOCAL_INIT_RC file for the bootstat command.
|
|
|
|
|
2019-02-07 19:05:42 +01:00
|
|
|
# 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=*
|
2017-08-04 22:35:51 +02:00
|
|
|
setprop sys.boot.reason ${ro.boot.bootreason}
|
|
|
|
|
2016-01-22 00:16:36 +01:00
|
|
|
on post-fs-data
|
2017-08-09 23:54:56 +02:00
|
|
|
mkdir /data/misc/bootstat 0700 system log
|
|
|
|
# To deal with ota transition resulting from a change in DAC from
|
|
|
|
# root.root to system.log, may be deleted after ota has settled.
|
|
|
|
chown system log /data/misc/bootstat/absolute_boot_time
|
|
|
|
chown system log /data/misc/bootstat/boot_complete
|
|
|
|
chown system log /data/misc/bootstat/boot_complete_no_encryption
|
|
|
|
chown system log /data/misc/bootstat/boot_reason
|
2017-09-18 19:27:01 +02:00
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.1BLE
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.1BLL
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.2BLE
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.2BLL
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.AVB
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.KD
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.KL
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.ODT
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.SW
|
|
|
|
chown system log /data/misc/bootstat/boottime.bootloader.total
|
2017-08-09 23:54:56 +02:00
|
|
|
chown system log /data/misc/bootstat/build_date
|
|
|
|
chown system log /data/misc/bootstat/factory_reset
|
|
|
|
chown system log /data/misc/bootstat/factory_reset_boot_complete
|
|
|
|
chown system log /data/misc/bootstat/factory_reset_boot_complete_no_encryption
|
|
|
|
chown system log /data/misc/bootstat/factory_reset_current_time
|
|
|
|
chown system log /data/misc/bootstat/factory_reset_record_value
|
|
|
|
chown system log /data/misc/bootstat/last_boot_time_utc
|
|
|
|
chown system log /data/misc/bootstat/ota_boot_complete
|
|
|
|
chown system log /data/misc/bootstat/ota_boot_complete_no_encryption
|
|
|
|
chown system log /data/misc/bootstat/post_decrypt_time_elapsed
|
|
|
|
chown system log /data/misc/bootstat/ro.boottime.init
|
|
|
|
chown system log /data/misc/bootstat/ro.boottime.init.cold_boot_wait
|
|
|
|
chown system log /data/misc/bootstat/ro.boottime.init.selinux
|
|
|
|
chown system log /data/misc/bootstat/time_since_factory_reset
|
|
|
|
chown system log /data/misc/bootstat/time_since_last_boot
|
|
|
|
# end ota transitional support
|
2016-01-22 00:16:36 +01:00
|
|
|
|
2016-03-11 23:59:50 +01:00
|
|
|
# Record the time at which the user has successfully entered the pin to decrypt
|
|
|
|
# the device, /data is decrypted, and the system is entering the main boot phase.
|
|
|
|
#
|
|
|
|
# post-fs-data: /data is writable
|
|
|
|
# property:init.svc.bootanim=running: The boot animation is running
|
2017-02-09 18:58:14 +01:00
|
|
|
# property:ro.crypto.type=block: FDE device
|
|
|
|
on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block
|
2017-09-15 22:02:19 +02:00
|
|
|
exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed
|
2016-03-11 23:59:50 +01:00
|
|
|
|
2017-01-17 22:27:05 +01:00
|
|
|
# sys.logbootcomplete is a signal to enable the bootstat logging mechanism.
|
2017-01-31 20:52:48 +01:00
|
|
|
# This signaling is necessary to prevent logging boot metrics after a runtime
|
|
|
|
# restart (e.g., adb shell stop && adb shell start). /proc/uptime is not reset
|
|
|
|
# during a runtime restart, which leads to false boot time metrics being reported.
|
2017-01-17 22:27:05 +01:00
|
|
|
#
|
|
|
|
# The 'on boot' event occurs once per hard boot (device power on), which
|
2017-01-31 20:52:48 +01:00
|
|
|
# switches the flag on. If the device performs a runtime restart, the flag is
|
2017-01-17 22:27:05 +01:00
|
|
|
# switched off and cannot be switched on until the device hard boots again.
|
|
|
|
|
|
|
|
# Enable bootstat logging on boot.
|
|
|
|
on boot
|
|
|
|
setprop sys.logbootcomplete 1
|
|
|
|
|
2017-01-31 20:52:48 +01:00
|
|
|
# Disable further bootstat logging on a runtime restart. A runtime restart is
|
2017-01-17 22:27:05 +01:00
|
|
|
# signaled by the zygote stopping.
|
|
|
|
on property:init.svc.zygote=stopping
|
|
|
|
setprop sys.logbootcomplete 0
|
|
|
|
|
2019-02-07 19:05:42 +01:00
|
|
|
# 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
|
|
|
|
|
2016-12-01 23:02:17 +01:00
|
|
|
# Record boot complete metrics.
|
2017-01-17 22:27:05 +01:00
|
|
|
on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
|
2016-03-11 23:59:50 +01:00
|
|
|
# Record boot_complete and related stats (decryption, etc).
|
2016-02-10 00:32:38 +01:00
|
|
|
# Record the boot reason.
|
2016-02-24 01:18:19 +01:00
|
|
|
# Record time since factory reset.
|
2016-01-22 00:16:36 +01:00
|
|
|
# Log all boot events.
|
2019-02-07 19:05:42 +01:00
|
|
|
exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l
|