| James Hawkins | 6bff639 | 2016-01-21 15:16:36 -0800 | [diff] [blame] | 1 | # This file is the LOCAL_INIT_RC file for the bootstat command. | 
|  | 2 |  | 
|  | 3 | on post-fs-data | 
|  | 4 | mkdir /data/misc/bootstat 0700 root root | 
|  | 5 |  | 
| James Hawkins | eef069a | 2016-03-11 14:59:50 -0800 | [diff] [blame] | 6 | # Record the time at which the user has successfully entered the pin to decrypt | 
|  | 7 | # the device, /data is decrypted, and the system is entering the main boot phase. | 
|  | 8 | # | 
|  | 9 | # post-fs-data: /data is writable | 
|  | 10 | # property:init.svc.bootanim=running: The boot animation is running | 
|  | 11 | on post-fs-data && property:init.svc.bootanim=running | 
|  | 12 | exec - root root -- /system/bin/bootstat -r post_decrypt_time_elapsed | 
|  | 13 |  | 
| James Hawkins | b7893e6 | 2017-01-17 13:27:05 -0800 | [diff] [blame] | 14 | # sys.logbootcomplete is a signal to enable the bootstat logging mechanism. | 
|  | 15 | # This signaling is necessary to prevent logging boot metrics after a soft | 
|  | 16 | # reboot (e.g., adb shell stop && adb shell start).  /proc/uptime is not reset | 
|  | 17 | # during a soft reboot, which leads to false boot time metrics being reported. | 
|  | 18 | # | 
|  | 19 | # The 'on boot' event occurs once per hard boot (device power on), which | 
|  | 20 | # switches the flag on. If the device performs a soft reboot, the flag is | 
|  | 21 | # switched off and cannot be switched on until the device hard boots again. | 
|  | 22 |  | 
|  | 23 | # Enable bootstat logging on boot. | 
|  | 24 | on boot | 
|  | 25 | setprop sys.logbootcomplete 1 | 
|  | 26 |  | 
|  | 27 | # Disable further bootstat logging on a soft reboot. A soft reboot is | 
|  | 28 | # signaled by the zygote stopping. | 
|  | 29 | on property:init.svc.zygote=stopping | 
|  | 30 | setprop sys.logbootcomplete 0 | 
|  | 31 |  | 
| James Hawkins | 88a579a | 2016-12-01 14:02:17 -0800 | [diff] [blame] | 32 | # Record boot complete metrics. | 
| James Hawkins | b7893e6 | 2017-01-17 13:27:05 -0800 | [diff] [blame] | 33 | on property:sys.boot_completed=1 && property:sys.logbootcomplete=1 | 
| James Hawkins | eef069a | 2016-03-11 14:59:50 -0800 | [diff] [blame] | 34 | # Record boot_complete and related stats (decryption, etc). | 
|  | 35 | exec - root root -- /system/bin/bootstat --record_boot_complete | 
| James Hawkins | 6bff639 | 2016-01-21 15:16:36 -0800 | [diff] [blame] | 36 |  | 
| James Hawkins | 10f54be | 2016-02-09 15:32:38 -0800 | [diff] [blame] | 37 | # Record the boot reason. | 
|  | 38 | exec - root root -- /system/bin/bootstat --record_boot_reason | 
|  | 39 |  | 
| James Hawkins | c0188da | 2016-02-23 16:18:19 -0800 | [diff] [blame] | 40 | # Record time since factory reset. | 
|  | 41 | exec - root root -- /system/bin/bootstat --record_time_since_factory_reset | 
|  | 42 |  | 
| James Hawkins | 6bff639 | 2016-01-21 15:16:36 -0800 | [diff] [blame] | 43 | # Log all boot events. | 
|  | 44 | exec - root root -- /system/bin/bootstat -l |