bootstat.rc 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # This file is the LOCAL_INIT_RC file for the bootstat command.
  2. # Mirror bootloader boot reason to system boot reason
  3. # ro.boot.bootreason should be set by init already
  4. # before post-fs trigger
  5. on post-fs && property:ro.boot.bootreason=*
  6. setprop sys.boot.reason ${ro.boot.bootreason}
  7. on post-fs-data
  8. 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
  15. 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
  25. 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
  41. # Record the time at which the user has successfully entered the pin to decrypt
  42. # the device, /data is decrypted, and the system is entering the main boot phase.
  43. #
  44. # post-fs-data: /data is writable
  45. # property:init.svc.bootanim=running: The boot animation is running
  46. # property:ro.crypto.type=block: FDE device
  47. on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block
  48. exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed
  49. # sys.logbootcomplete is a signal to enable the bootstat logging mechanism.
  50. # This signaling is necessary to prevent logging boot metrics after a runtime
  51. # restart (e.g., adb shell stop && adb shell start). /proc/uptime is not reset
  52. # during a runtime restart, which leads to false boot time metrics being reported.
  53. #
  54. # The 'on boot' event occurs once per hard boot (device power on), which
  55. # switches the flag on. If the device performs a runtime restart, the flag is
  56. # switched off and cannot be switched on until the device hard boots again.
  57. # Enable bootstat logging on boot.
  58. on boot
  59. setprop sys.logbootcomplete 1
  60. # Disable further bootstat logging on a runtime restart. A runtime restart is
  61. # signaled by the zygote stopping.
  62. on property:init.svc.zygote=stopping
  63. setprop sys.logbootcomplete 0
  64. # Set boot reason
  65. on zygote-start
  66. # Converts bootloader boot reason and persist.sys.boot.reason to system boot reason
  67. # Need go after persist peroperties are loaded which is right before zygote-start trigger
  68. exec_background - system log -- /system/bin/bootstat --set_system_boot_reason
  69. # Record boot complete metrics.
  70. on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
  71. # Record boot_complete and related stats (decryption, etc).
  72. # Record the boot reason.
  73. # Record time since factory reset.
  74. # Log all boot events.
  75. exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l