blob: d697efba0f8ef18d8cc56a4e2675db0940fde6dd [file] [log] [blame]
James Hawkins6bff6392016-01-21 15:16:36 -08001# This file is the LOCAL_INIT_RC file for the bootstat command.
2
3on post-fs-data
Mark Salyzync4a524b2017-08-09 14:54:56 -07004 mkdir /data/misc/bootstat 0700 system log
5 # To deal with ota transition resulting from a change in DAC from
6 # root.root to system.log, may be deleted after ota has settled.
7 chown system log /data/misc/bootstat/absolute_boot_time
8 chown system log /data/misc/bootstat/boot_complete
9 chown system log /data/misc/bootstat/boot_complete_no_encryption
10 chown system log /data/misc/bootstat/boot_reason
11 chown system log /data/misc/bootstat/bootime.bootloader.1BLE
12 chown system log /data/misc/bootstat/bootime.bootloader.1BLL
13 chown system log /data/misc/bootstat/bootime.bootloader.2BLE
14 chown system log /data/misc/bootstat/bootime.bootloader.2BLL
15 chown system log /data/misc/bootstat/bootime.bootloader.AVB
16 chown system log /data/misc/bootstat/bootime.bootloader.KD
17 chown system log /data/misc/bootstat/bootime.bootloader.KL
18 chown system log /data/misc/bootstat/bootime.bootloader.ODT
19 chown system log /data/misc/bootstat/bootime.bootloader.SW
20 chown system log /data/misc/bootstat/bootime.bootloader.total
21 chown system log /data/misc/bootstat/build_date
22 chown system log /data/misc/bootstat/factory_reset
23 chown system log /data/misc/bootstat/factory_reset_boot_complete
24 chown system log /data/misc/bootstat/factory_reset_boot_complete_no_encryption
25 chown system log /data/misc/bootstat/factory_reset_current_time
26 chown system log /data/misc/bootstat/factory_reset_record_value
27 chown system log /data/misc/bootstat/last_boot_time_utc
28 chown system log /data/misc/bootstat/ota_boot_complete
29 chown system log /data/misc/bootstat/ota_boot_complete_no_encryption
30 chown system log /data/misc/bootstat/post_decrypt_time_elapsed
31 chown system log /data/misc/bootstat/ro.boottime.init
32 chown system log /data/misc/bootstat/ro.boottime.init.cold_boot_wait
33 chown system log /data/misc/bootstat/ro.boottime.init.selinux
34 chown system log /data/misc/bootstat/time_since_factory_reset
35 chown system log /data/misc/bootstat/time_since_last_boot
36 # end ota transitional support
James Hawkins6bff6392016-01-21 15:16:36 -080037
James Hawkinsc08e9962016-03-11 14:59:50 -080038# Record the time at which the user has successfully entered the pin to decrypt
39# the device, /data is decrypted, and the system is entering the main boot phase.
40#
41# post-fs-data: /data is writable
42# property:init.svc.bootanim=running: The boot animation is running
Wei Wangbd6ab492017-02-09 09:58:14 -080043# property:ro.crypto.type=block: FDE device
44on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block
Mark Salyzync4a524b2017-08-09 14:54:56 -070045 exec - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed
James Hawkinsc08e9962016-03-11 14:59:50 -080046
James Hawkins800ceb42017-01-17 13:27:05 -080047# sys.logbootcomplete is a signal to enable the bootstat logging mechanism.
James Hawkinsf1c23502017-01-31 11:52:48 -080048# This signaling is necessary to prevent logging boot metrics after a runtime
49# restart (e.g., adb shell stop && adb shell start). /proc/uptime is not reset
50# during a runtime restart, which leads to false boot time metrics being reported.
James Hawkins800ceb42017-01-17 13:27:05 -080051#
52# The 'on boot' event occurs once per hard boot (device power on), which
James Hawkinsf1c23502017-01-31 11:52:48 -080053# switches the flag on. If the device performs a runtime restart, the flag is
James Hawkins800ceb42017-01-17 13:27:05 -080054# switched off and cannot be switched on until the device hard boots again.
55
56# Enable bootstat logging on boot.
57on boot
58 setprop sys.logbootcomplete 1
59
James Hawkinsf1c23502017-01-31 11:52:48 -080060# Disable further bootstat logging on a runtime restart. A runtime restart is
James Hawkins800ceb42017-01-17 13:27:05 -080061# signaled by the zygote stopping.
62on property:init.svc.zygote=stopping
63 setprop sys.logbootcomplete 0
64
James Hawkinse4079fb2016-12-01 14:02:17 -080065# Record boot complete metrics.
James Hawkins800ceb42017-01-17 13:27:05 -080066on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
James Hawkinsc08e9962016-03-11 14:59:50 -080067 # Record boot_complete and related stats (decryption, etc).
Mark Salyzync4a524b2017-08-09 14:54:56 -070068 exec - system log -- /system/bin/bootstat --record_boot_complete
James Hawkins6bff6392016-01-21 15:16:36 -080069
James Hawkinsa4a1a4a2016-02-09 15:32:38 -080070 # Record the boot reason.
Mark Salyzync4a524b2017-08-09 14:54:56 -070071 exec - system log -- /system/bin/bootstat --record_boot_reason
James Hawkinsa4a1a4a2016-02-09 15:32:38 -080072
James Hawkins53684ea2016-02-23 16:18:19 -080073 # Record time since factory reset.
Mark Salyzync4a524b2017-08-09 14:54:56 -070074 exec - system log -- /system/bin/bootstat --record_time_since_factory_reset
James Hawkins53684ea2016-02-23 16:18:19 -080075
James Hawkins6bff6392016-01-21 15:16:36 -080076 # Log all boot events.
Mark Salyzync4a524b2017-08-09 14:54:56 -070077 exec - system log -- /system/bin/bootstat -l