Loading bootstat/boot_reason_test.sh +10 −10 Original line number Original line Diff line number Diff line Loading @@ -7,7 +7,7 @@ # - watch adb logcat -b all -d -s bootstat # - watch adb logcat -b all -d -s bootstat # - watch adb logcat -b all -d | audit2allow # - watch adb logcat -b all -d | audit2allow # - wait until screen is up, boot has completed, can mean wait for # - wait until screen is up, boot has completed, can mean wait for # sys.boot_completed=1 and sys.logbootcomplete=1 to be true # sys.boot_completed=1 and sys.bootstat.first_boot_completed=1 to be true # # # All test frames, and nothing else, must be function names prefixed and # All test frames, and nothing else, must be function names prefixed and # specifiged with the pattern 'test_<test>() {' as this is also how the # specifiged with the pattern 'test_<test>() {' as this is also how the Loading Loading @@ -230,13 +230,13 @@ wait_for_screen() { if [ -n "`get_property sys.boot.reason`" ] if [ -n "`get_property sys.boot.reason`" ] then then vals=`get_property | vals=`get_property | sed -n 's/[[]sys[.]\(boot_completed\|logbootcomplete\)[]]: [[]\([01]\)[]]$/\1=\2/p'` sed -n 's/[[]sys[.]\(boot_completed\|bootstat.first_boot_completed\)[]]: [[]\([01]\)[]]$/\1=\2/p'` if [ "${vals}" = "`echo boot_completed=1 ; echo logbootcomplete=1`" ] if [ "${vals}" = "`echo boot_completed=1 ; echo bootstat.first_boot_completed=1`" ] then then sleep 1 sleep 1 break break fi fi if [ "${vals}" = "`echo logbootcomplete=1 ; echo boot_completed=1`" ] if [ "${vals}" = "`echo bootstat.first_boot_completed=1 ; echo boot_completed=1`" ] then then sleep 1 sleep 1 break break Loading Loading @@ -384,15 +384,15 @@ init : processing action (post-fs-data) from (/system/etc/init/bootstat.rc init : processing action (boot) from (/system/etc/init/bootstat.rc init : processing action (boot) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=*) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=*) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=* && post-fs) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=* && post-fs) from (/system/etc/init/bootstat.rc init : processing action (zygote-start) from (/system/etc/init/bootstat.rc init : processing action (sys.bootstat.first_zygote_start=0 && zygote-start) from (/system/etc/init/bootstat.rc init : processing action (sys.boot_completed=1 && sys.logbootcomplete=1) from (/system/etc/init/bootstat.rc init : processing action (sys.boot_completed=1 && sys.bootstat.first_boot_completed=0) from (/system/etc/init/bootstat.rc (/system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat -r post_decrypt_time_elapsed)' (/system/bin/bootstat -r post_decrypt_time_elapsed)' init : Command 'exec - system log -- /system/bin/bootstat --record_boot_complete' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_boot_complete' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_boot_reason' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_boot_reason' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_time_since_factory_reset' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_time_since_factory_reset' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc: init : Command 'exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc init : Command 'exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc (/system/bin/bootstat --record_boot_complete)'... (/system/bin/bootstat --record_boot_complete)'... (/system/bin/bootstat --record_boot_complete)' (pid${SPACE} (/system/bin/bootstat --record_boot_complete)' (pid${SPACE} (/system/bin/bootstat --record_boot_reason)'... (/system/bin/bootstat --record_boot_reason)'... Loading bootstat/bootstat.rc +18 −18 Original line number Original line Diff line number Diff line Loading @@ -50,34 +50,34 @@ on post-fs-data on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed # sys.logbootcomplete is a signal to enable the bootstat logging mechanism. # Initialize bootstat state machine. # 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. # # # The 'on boot' event occurs once per hard boot (device power on), which # sys.bootstat.first_boot_completed: responsible for making sure that record_boot_complete happens # switches the flag on. If the device performs a runtime restart, the flag is # only once per device hard reboot. Possible values: # switched off and cannot be switched on until the device hard boots again. # # sys.bootstat.first_boot_completed=0 - first boot completed trigger wasn't processed yet. # Enable bootstat logging on boot. # sys.bootstat.first_boot_completed=1 - first boot completed trigger was processed and on boot # record_boot_complete was called. Subsequent boot completed setprop sys.logbootcomplete 1 # triggers (e.g. due to userspace reboot) won't retrigger # record_boot_complete # Disable further bootstat logging on a runtime restart. A runtime restart is # # signaled by the zygote stopping. # IMPORTANT, ro.persistent_properties.ready=1 trigger is used here to ensure that we initialize on property:init.svc.zygote=stopping # state machine only once, which as result ensures that bootstat --set_system_boot_reason and setprop sys.logbootcomplete 0 # bootstat --record_boot_complete will be called only once per full reboot. on property:ro.persistent_properties.ready=true setprop sys.bootstat.first_boot_completed 0 # Set boot reason # Set boot reason on zygote-start on property:ro.persistent_properties.ready=true # Converts bootloader boot reason and persist.sys.boot.reason to system boot reason # 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 # 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 exec_background - system log -- /system/bin/bootstat --set_system_boot_reason # Record boot complete metrics. # Record boot complete metrics. on property:sys.boot_completed=1 && property:sys.logbootcomplete=1 on property:sys.boot_completed=1 && property:sys.bootstat.first_boot_completed=0 # Record boot_complete and related stats (decryption, etc). # Record boot_complete and related stats (decryption, etc). # Record the boot reason. # Record the boot reason. # Record time since factory reset. # Record time since factory reset. # Log all boot events. # Log all boot events. exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l setprop sys.bootstat.first_boot_completed 1 Loading
bootstat/boot_reason_test.sh +10 −10 Original line number Original line Diff line number Diff line Loading @@ -7,7 +7,7 @@ # - watch adb logcat -b all -d -s bootstat # - watch adb logcat -b all -d -s bootstat # - watch adb logcat -b all -d | audit2allow # - watch adb logcat -b all -d | audit2allow # - wait until screen is up, boot has completed, can mean wait for # - wait until screen is up, boot has completed, can mean wait for # sys.boot_completed=1 and sys.logbootcomplete=1 to be true # sys.boot_completed=1 and sys.bootstat.first_boot_completed=1 to be true # # # All test frames, and nothing else, must be function names prefixed and # All test frames, and nothing else, must be function names prefixed and # specifiged with the pattern 'test_<test>() {' as this is also how the # specifiged with the pattern 'test_<test>() {' as this is also how the Loading Loading @@ -230,13 +230,13 @@ wait_for_screen() { if [ -n "`get_property sys.boot.reason`" ] if [ -n "`get_property sys.boot.reason`" ] then then vals=`get_property | vals=`get_property | sed -n 's/[[]sys[.]\(boot_completed\|logbootcomplete\)[]]: [[]\([01]\)[]]$/\1=\2/p'` sed -n 's/[[]sys[.]\(boot_completed\|bootstat.first_boot_completed\)[]]: [[]\([01]\)[]]$/\1=\2/p'` if [ "${vals}" = "`echo boot_completed=1 ; echo logbootcomplete=1`" ] if [ "${vals}" = "`echo boot_completed=1 ; echo bootstat.first_boot_completed=1`" ] then then sleep 1 sleep 1 break break fi fi if [ "${vals}" = "`echo logbootcomplete=1 ; echo boot_completed=1`" ] if [ "${vals}" = "`echo bootstat.first_boot_completed=1 ; echo boot_completed=1`" ] then then sleep 1 sleep 1 break break Loading Loading @@ -384,15 +384,15 @@ init : processing action (post-fs-data) from (/system/etc/init/bootstat.rc init : processing action (boot) from (/system/etc/init/bootstat.rc init : processing action (boot) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=*) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=*) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=* && post-fs) from (/system/etc/init/bootstat.rc init : processing action (ro.boot.bootreason=* && post-fs) from (/system/etc/init/bootstat.rc init : processing action (zygote-start) from (/system/etc/init/bootstat.rc init : processing action (sys.bootstat.first_zygote_start=0 && zygote-start) from (/system/etc/init/bootstat.rc init : processing action (sys.boot_completed=1 && sys.logbootcomplete=1) from (/system/etc/init/bootstat.rc init : processing action (sys.boot_completed=1 && sys.bootstat.first_boot_completed=0) from (/system/etc/init/bootstat.rc (/system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l)' (/system/bin/bootstat -r post_decrypt_time_elapsed)' (/system/bin/bootstat -r post_decrypt_time_elapsed)' init : Command 'exec - system log -- /system/bin/bootstat --record_boot_complete' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_boot_complete' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_boot_reason' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_boot_reason' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_time_since_factory_reset' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc: init : Command 'exec - system log -- /system/bin/bootstat --record_time_since_factory_reset' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc: init : Command 'exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l' action=sys.boot_completed=1 && sys.logbootcomplete=1 (/system/etc/init/bootstat.rc init : Command 'exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l' action=sys.boot_completed=1 && sys.bootstat.first_boot_completed=0 (/system/etc/init/bootstat.rc (/system/bin/bootstat --record_boot_complete)'... (/system/bin/bootstat --record_boot_complete)'... (/system/bin/bootstat --record_boot_complete)' (pid${SPACE} (/system/bin/bootstat --record_boot_complete)' (pid${SPACE} (/system/bin/bootstat --record_boot_reason)'... (/system/bin/bootstat --record_boot_reason)'... Loading
bootstat/bootstat.rc +18 −18 Original line number Original line Diff line number Diff line Loading @@ -50,34 +50,34 @@ on post-fs-data on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block on post-fs-data && property:init.svc.bootanim=running && property:ro.crypto.type=block exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed exec_background - system log -- /system/bin/bootstat -r post_decrypt_time_elapsed # sys.logbootcomplete is a signal to enable the bootstat logging mechanism. # Initialize bootstat state machine. # 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. # # # The 'on boot' event occurs once per hard boot (device power on), which # sys.bootstat.first_boot_completed: responsible for making sure that record_boot_complete happens # switches the flag on. If the device performs a runtime restart, the flag is # only once per device hard reboot. Possible values: # switched off and cannot be switched on until the device hard boots again. # # sys.bootstat.first_boot_completed=0 - first boot completed trigger wasn't processed yet. # Enable bootstat logging on boot. # sys.bootstat.first_boot_completed=1 - first boot completed trigger was processed and on boot # record_boot_complete was called. Subsequent boot completed setprop sys.logbootcomplete 1 # triggers (e.g. due to userspace reboot) won't retrigger # record_boot_complete # Disable further bootstat logging on a runtime restart. A runtime restart is # # signaled by the zygote stopping. # IMPORTANT, ro.persistent_properties.ready=1 trigger is used here to ensure that we initialize on property:init.svc.zygote=stopping # state machine only once, which as result ensures that bootstat --set_system_boot_reason and setprop sys.logbootcomplete 0 # bootstat --record_boot_complete will be called only once per full reboot. on property:ro.persistent_properties.ready=true setprop sys.bootstat.first_boot_completed 0 # Set boot reason # Set boot reason on zygote-start on property:ro.persistent_properties.ready=true # Converts bootloader boot reason and persist.sys.boot.reason to system boot reason # 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 # 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 exec_background - system log -- /system/bin/bootstat --set_system_boot_reason # Record boot complete metrics. # Record boot complete metrics. on property:sys.boot_completed=1 && property:sys.logbootcomplete=1 on property:sys.boot_completed=1 && property:sys.bootstat.first_boot_completed=0 # Record boot_complete and related stats (decryption, etc). # Record boot_complete and related stats (decryption, etc). # Record the boot reason. # Record the boot reason. # Record time since factory reset. # Record time since factory reset. # Log all boot events. # Log all boot events. exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l setprop sys.bootstat.first_boot_completed 1