Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5129582 authored by James Hawkins's avatar James Hawkins Committed by android-build-merger
Browse files

Merge "bootstat: Fix false metrics due to soft reboots."

am: bde89da5

Change-Id: I4c49fff20f78e4bff744dfe94a7207cf7e151404
parents bd8a24e2 bde89da5
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -11,8 +11,26 @@ on post-fs-data
on post-fs-data && property:init.svc.bootanim=running
    exec - root root -- /system/bin/bootstat -r post_decrypt_time_elapsed

# sys.logbootcomplete is a signal to enable the bootstat logging mechanism.
# This signaling is necessary to prevent logging boot metrics after a soft
# reboot (e.g., adb shell stop && adb shell start).  /proc/uptime is not reset
# during a soft reboot, which leads to false boot time metrics being reported.
#
# The 'on boot' event occurs once per hard boot (device power on), which
# switches the flag on. If the device performs a soft reboot, the flag is
# switched off and cannot be switched on until the device hard boots again.

# Enable bootstat logging on boot.
on boot
    setprop sys.logbootcomplete 1

# Disable further bootstat logging on a soft reboot. A soft reboot is
# signaled by the zygote stopping.
on property:init.svc.zygote=stopping
    setprop sys.logbootcomplete 0

# Record boot complete metrics.
on property:sys.boot_completed=1
on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
    # Record boot_complete and related stats (decryption, etc).
    exec - root root -- /system/bin/bootstat --record_boot_complete