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

Commit 2be430ac authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix performance degradation from BootSequence atom"

parents d356071f 993f6561
Loading
Loading
Loading
Loading
+21 −12
Original line number Diff line number Diff line
@@ -1129,6 +1129,13 @@ android::base::boot_clock::duration GetUptime() {
  return android::base::boot_clock::now().time_since_epoch() - GetBootTimeOffset();
}

void SetSystemBootReason() {
  const std::string bootloader_boot_reason(GetProperty(bootloader_reboot_reason_property));
  const std::string system_boot_reason(BootReasonStrToReason(bootloader_boot_reason));
  // Record the scrubbed system_boot_reason to the property
  SetProperty(system_reboot_reason_property, system_boot_reason);
}

// Records several metrics related to the time it takes to boot the device,
// including disambiguating boot time on encrypted or non-encrypted devices.
void RecordBootComplete() {
@@ -1208,12 +1215,10 @@ void RecordBootReason() {
  boot_event_store.AddBootEventWithValue("boot_reason", boot_reason);

  // Log the scrubbed system_boot_reason.
  const std::string system_reason(BootReasonStrToReason(reason));
  const std::string system_reason(GetProperty(system_reboot_reason_property));
  int32_t system_boot_reason = BootReasonStrToEnum(system_reason);
  boot_event_store.AddBootEventWithValue("system_boot_reason", system_boot_reason);

  // Record the scrubbed system_boot_reason to the property
  SetProperty(system_reboot_reason_property, system_reason);
  if (reason == "") {
    SetProperty(bootloader_reboot_reason_property, system_reason);
  }
@@ -1279,6 +1284,7 @@ int main(int argc, char** argv) {

  int option_index = 0;
  static const char value_str[] = "value";
  static const char system_boot_reason_str[] = "set_system_boot_reason";
  static const char boot_complete_str[] = "record_boot_complete";
  static const char boot_reason_str[] = "record_boot_reason";
  static const char factory_reset_str[] = "record_time_since_factory_reset";
@@ -1289,6 +1295,7 @@ int main(int argc, char** argv) {
      { "print",                no_argument,       NULL,   'p' },
      { "record",               required_argument, NULL,   'r' },
      { value_str,              required_argument, NULL,   0 },
      { system_boot_reason_str, no_argument,       NULL,   0 },
      { boot_complete_str,      no_argument,       NULL,   0 },
      { boot_reason_str,        no_argument,       NULL,   0 },
      { factory_reset_str,      no_argument,       NULL,   0 },
@@ -1308,6 +1315,8 @@ int main(int argc, char** argv) {
          // |optarg| is an external variable set by getopt representing
          // the option argument.
          value = optarg;
        } else if (option_name == system_boot_reason_str) {
          SetSystemBootReason();
        } else if (option_name == boot_complete_str) {
          RecordBootComplete();
        } else if (option_name == boot_reason_str) {
+2 −1
Original line number Diff line number Diff line
@@ -68,8 +68,9 @@ on property:init.svc.zygote=stopping

# Record boot complete metrics.
on property:sys.boot_completed=1 && property:sys.logbootcomplete=1
    # Converts bootloader boot reason to system boot reason
    # Record boot_complete and related stats (decryption, etc).
    # Record the boot reason.
    # Record time since factory reset.
    # Log all boot events.
    exec_background - system log -- /system/bin/bootstat --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l
    exec_background - system log -- /system/bin/bootstat --set_system_boot_reason --record_boot_complete --record_boot_reason --record_time_since_factory_reset -l