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

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

bootstat: introduce sys.boot.reason

Adding functionality to bootstat --record_boot_complete and
--record_boot_reason to initialize sys.boot.reason, the canonical
system boot reason.

Filter out ro.boot.bootreason oem noise into sys.boot.reason.  Add
heuristics to determine what the boot reason is, when otherwise would
be defaulting to the blunt and relatively devoid of detail catch-all
reboot reasons ("reboot", "shutdown", "cold", "warm", "hard").

boot_reason_test.sh is also a compliance test.

Test: boot_reason_test.sh all
Bug: 63736262
Change-Id: Ic9a42cccbcfc89a5c0e081ba66d577a97c8c8c76
parent 2dac833e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ cc_binary {
    name: "bootstat",
    defaults: ["bootstat_defaults"],
    static_libs: ["libbootstat"],
    shared_libs: ["liblogcat"],
    init_rc: ["bootstat.rc"],
    srcs: ["bootstat.cpp"],
}
+689 −0

File added.

Preview size limit exceeded, changes collapsed.

+369 −2

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
# This file is the LOCAL_INIT_RC file for the bootstat command.

# mirror bootloader boot reason to system boot reason
on property:ro.boot.bootreason=*
    setprop sys.boot.reason ${ro.boot.bootreason}

on post-fs-data
    mkdir /data/misc/bootstat 0700 system log
    # To deal with ota transition resulting from a change in DAC from
+2 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@ static const struct fs_path_config android_files[] = {
                                           CAP_MASK_LONG(CAP_AUDIT_CONTROL) |
                                           CAP_MASK_LONG(CAP_SETGID),
                                              "system/bin/logd" },
    { 00550, AID_SYSTEM,    AID_LOG,      CAP_MASK_LONG(CAP_SYSLOG),
                                              "system/bin/bootstat" },
    { 00750, AID_ROOT,      AID_SHELL,     CAP_MASK_LONG(CAP_SETUID) |
                                           CAP_MASK_LONG(CAP_SETGID),
                                              "system/bin/run-as" },