bootstat: Remove boot_complete metrics of past boot
When the `sys.boot_completed=1 && sys.bootstat.first_boot_completed=0`
are met, `RecordBootComplete()` runs. This function adds a metric file
for boot_complete, ota_boot_complete, or factory_reset_boot_complete
depending on the boot type. A bug occurs when the system reboots with a
different type, as it reports metrics from the previous, unrelated boot.
This CL makes sure that any metric files from other boot types are
removed when a new boot is recorded.
Test: `bootstat --record_boot_complete -p` reports only one kind of
boot_complete
Bug: 427910639
Change-Id: I55448183cfc1a0eb5da5b2fa1aa49ac97a72e82c
3 files changed