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

Commit dafced93 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

bootstat: Do not allow unknown boot reasons to land in first field.

If we sniff an unknown boot reason from last kmsg, make sure it
has a "reboot," prefix.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ia1c401b8899d1f0c56bd4f5d8d2d19b7fc889a30
parent 88d692c0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -477,8 +477,10 @@ std::string BootReasonStrToReason(const std::string& boot_reason) {
        if (subReason != "") {  // Will not land "reboot" as that is too blunt.
          if (isKernelRebootReason(subReason)) {
            ret = "reboot," + subReason;  // User space can't talk kernel reasons.
          } else {
          } else if (isKnownRebootReason(subReason)) {
            ret = subReason;
          } else {
            ret = "reboot," + subReason;  // legitimize unknown reasons
          }
        }
      }