From 8aa36c67f82f0c7abdf6f43cbb37cc64e2157076 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 16 Mar 2018 11:00:14 -0700 Subject: [PATCH] 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 --- bootstat/boot_reason_test.sh | 2 ++ bootstat/bootstat.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh index 603d04f67..86e87896c 100755 --- a/bootstat/boot_reason_test.sh +++ b/bootstat/boot_reason_test.sh @@ -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 diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index 5ca3bd4f6..27570b953 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -289,6 +289,8 @@ const std::map 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", ""}, };