bootstat: usb and rtc refinement

For all known cases, if usb is present in the bootloader reason,
then it is actually reporting a cold,charger canonical boot reason.
This signifies that the device was powered down, and was woken
up by the charger being connected.

For all known cases, if rtc is present in the bootloader reason,
then it is actually reporting a cold,rtc canonical boot reason.
This signifies that the device was powered down, and was woken
up by the rtc clock.

Test: boot_reason_test.sh
Bug: 74595769
Bug: 63736262
Change-Id: I04bede0b7ccaa1b859943f7def93521a8f7b25c6
This commit is contained in:
Mark Salyzyn 2018-03-16 11:00:14 -07:00
parent f4be06450a
commit 8aa36c67f8
2 changed files with 6 additions and 0 deletions

View file

@ -429,6 +429,8 @@ validate_reason() {
*thermal* ) var="shutdown,thermal" ;;
*s3_wakeup* ) var="warm,s3_wakeup" ;;
*hw_reset* ) var="hard,hw_reset" ;;
*usb* ) var="cold,charger" ;;
*rtc* ) var="cold,rtc" ;;
*bootloader* ) var="bootloader" ;;
* ) var="reboot" ;;
esac

View file

@ -289,6 +289,8 @@ const std::map<std::string, int32_t> kBootReasonMap = {
{"oem_sdi_err_fatal", 145},
{"pmic_watchdog", 146},
{"software_master", 147},
{"cold,charger", 148},
{"cold,rtc", 149},
};
// Converts a string value representing the reason the system booted to an
@ -591,6 +593,8 @@ std::string BootReasonStrToReason(const std::string& boot_reason) {
{"shutdown,thermal", "thermal"},
{"warm,s3_wakeup", "s3_wakeup"},
{"hard,hw_reset", "hw_reset"},
{"cold,charger", "usb"},
{"cold,rtc", "rtc"},
{"reboot,2sec", "2sec_reboot"},
{"bootloader", ""},
};