blob: 1300a277a4de3f3fecf3a875260e65f321fbd9ee [file] [log] [blame]
James Hawkins6bff6392016-01-21 15:16:36 -08001# This file is the LOCAL_INIT_RC file for the bootstat command.
2
Mark Salyzynb304f6d2017-08-04 13:35:51 -07003# mirror bootloader boot reason to system boot reason
4on property:ro.boot.bootreason=*
5 setprop sys.boot.reason ${ro.boot.bootreason}
6
James Hawkins6bff6392016-01-21 15:16:36 -08007on post-fs-data
Mark Salyzync3ad75b2017-08-09 14:54:56 -07008 mkdir /data/misc/bootstat 0700 system log
9 # To deal with ota transition resulting from a change in DAC from
10 # root.root to system.log, may be deleted after ota has settled.
11 chown system log /data/misc/bootstat/absolute_boot_time
12 chown system log /data/misc/bootstat/boot_complete
13 chown system log /data/misc/bootstat/boot_complete_no_encryption
14 chown system log /data/misc/bootstat/boot_reason
Mark Salyzyn25246dd2017-09-18 10:27:01 -070015 chown system log /data/misc/bootstat/boottime.bootloader.1BLE
16 chown system log /data/misc/bootstat/boottime.bootloader.1BLL
17 chown system log /data/misc/bootstat/boottime.bootloader.2BLE
18 chown system log /data/misc/bootstat/boottime.bootloader.2BLL
19 chown system log /data/misc/bootstat/boottime.bootloader.AVB
20 chown system log /data/misc/bootstat/boottime.bootloader.KD
21 chown system log /data/misc/bootstat/boottime.bootloader.KL
22 chown system log /data/misc/bootstat/boottime.bootloader.ODT
23 chown system log /data/misc/bootstat/boottime.bootloader.SW
24 chown system log /data/misc/bootstat/boottime.bootloader.total
Mark Salyzync3ad75b2017-08-09 14:54:56 -070025 chown system log /data/misc/bootstat/build_date
26 chown system log /data/misc/bootstat/factory_reset
27 chown system log /data/misc/bootstat/factory_reset_boot_complete
28 chown system log /data/misc/bootstat/factory_reset_boot_complete_no_encryption
29 chown system log /data/misc/bootstat/factory_reset_current_time
30 chown system log /data/misc/bootstat/factory_reset_record_value
31 chown system log /data/misc/bootstat/last_boot_time_utc
32 chown system log /data/misc/bootstat/ota_boot_complete
33 chown system log /data/misc/bootstat/ota_boot_complete_no_encryption
34 chown system log /data/misc/bootstat/post_decrypt_time_elapsed
35 chown system log /data/misc/bootstat/ro.boottime.init
36 chown system log /data/misc/bootstat/ro.boottime.init.cold_boot_wait
37 chown system log /data/misc/bootstat/ro.boottime.init.selinux
38 chown system log /data/misc/bootstat/time_since_factory_reset
39 chown system log /data/misc/bootstat/time_since_last_boot
40 # end ota transitional support
James Hawkins6bff6392016-01-21 15:16:36 -080041
James Hawkinsc08e9962016-03-11 14:59:50 -080042# Record the time at which the user has successfully entered the pin to decrypt
43# the device, /data is decrypted, and the system is entering the main boot phase.
44#
45# post-fs-data: /data is writable
46# property:init.svc.bootanim=running: The boot animation is running
Wei Wangbd6ab492017-02-09 09:58:14 -080047# property:ro.crypto.type=block: FDE device
48on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block
Mark Salyzyn557a9d42017-09-15 13:02:19 -070049 exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed
James Hawkinsc08e9962016-03-11 14:59:50 -080050
James Hawkins800ceb42017-01-17 13:27:05 -080051# sys.logbootcomplete is a signal to enable the bootstat logging mechanism.
James Hawkinsf1c23502017-01-31 11:52:48 -080052# This signaling is necessary to prevent logging boot metrics after a runtime
53# restart (e.g., adb shell stop && adb shell start). /proc/uptime is not reset
54# during a runtime restart, which leads to false boot time metrics being reported.
James Hawkins800ceb42017-01-17 13:27:05 -080055#
56# The 'on boot' event occurs once per hard boot (device power on), which
James Hawkinsf1c23502017-01-31 11:52:48 -080057# switches the flag on. If the device performs a runtime restart, the flag is
James Hawkins800ceb42017-01-17 13:27:05 -080058# switched off and cannot be switched on until the device hard boots again.
59
60# Enable bootstat logging on boot.
61on boot
62 setprop sys.logbootcomplete 1
63
James Hawkinsf1c23502017-01-31 11:52:48 -080064# Disable further bootstat logging on a runtime restart. A runtime restart is
James Hawkins800ceb42017-01-17 13:27:05 -080065# signaled by the zygote stopping.
66on property:init.svc.zygote=stopping
67 setprop sys.logbootcomplete 0
68
James Hawkinse4079fb2016-12-01 14:02:17 -080069# Record boot complete metrics.
James Hawkins800ceb42017-01-17 13:27:05 -080070on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
Tej Singhfe3e7622018-02-06 15:57:38 -080071 # Converts bootloader boot reason to system boot reason
James Hawkinsc08e9962016-03-11 14:59:50 -080072 # Record boot_complete and related stats (decryption, etc).
James Hawkinsa4a1a4a2016-02-09 15:32:38 -080073 # Record the boot reason.
James Hawkins53684ea2016-02-23 16:18:19 -080074 # Record time since factory reset.
James Hawkins6bff6392016-01-21 15:16:36 -080075 # Log all boot events.
Tej Singhfe3e7622018-02-06 15:57:38 -080076 exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l