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

Commit abe52dcb authored by Nikita Ioffe's avatar Nikita Ioffe Committed by Gerrit Code Review
Browse files

Merge "Whitelist reboot reasons related to userspace reboot failure"

parents d7c1bc73 4a787d96
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -312,6 +312,11 @@ const std::map<std::string, int32_t> kBootReasonMap = {
    {"reboot,unknown[0-9]*", 183},
    {"reboot,longkey,.*", 184},
    {"reboot,boringssl-self-check-failed", 185},
    {"reboot,userspace_failed,shutdown_aborted", 186},
    {"reboot,userspace_failed,watchdog_triggered", 187},
    {"reboot,userspace_failed,watchdog_fork", 188},
    {"reboot,userspace_failed,*", 189},
    {"reboot,mount_userdata_failed", 190},
};

// Converts a string value representing the reason the system booted to an
+2 −1
Original line number Diff line number Diff line
@@ -1123,6 +1123,7 @@ static Result<void> ExecVdcRebootOnFailure(const std::string& vdc_arg) {
    auto reboot_reason = vdc_arg + "_failed";
    if (android::sysprop::InitProperties::userspace_reboot_in_progress().value_or(false)) {
        should_reboot_into_recovery = false;
        reboot_reason = "userspace_failed," + vdc_arg;
    }

    auto reboot = [reboot_reason, should_reboot_into_recovery](const std::string& message) {
@@ -1159,7 +1160,7 @@ static Result<void> do_remount_userdata(const BuiltinArguments& args) {
    }
    // TODO(b/135984674): check that fstab contains /data.
    if (auto rc = fs_mgr_remount_userdata_into_checkpointing(&fstab); rc < 0) {
        trigger_shutdown("reboot,mount-userdata-failed");
        trigger_shutdown("reboot,mount_userdata_failed");
    }
    if (auto result = queue_fs_event(initial_mount_fstab_return_code, true); !result) {
        return Error() << "queue_fs_event() failed: " << result.error();
+3 −3
Original line number Diff line number Diff line
@@ -737,7 +737,7 @@ static Result<void> DoUserspaceReboot() {
    auto guard = android::base::make_scope_guard([] {
        // Leave shutdown so that we can handle a full reboot.
        LeaveShutdown();
        trigger_shutdown("reboot,abort-userspace-reboot");
        trigger_shutdown("reboot,userspace_failed,shutdown_aborted");
    });
    // Triggering userspace-reboot-requested will result in a bunch of setprop
    // actions. We should make sure, that all of them are propagated before
@@ -831,7 +831,7 @@ static void UserspaceRebootWatchdogThread() {
    if (!WaitForProperty("sys.boot_completed", "1", timeout)) {
        LOG(ERROR) << "Failed to boot in " << timeout.count() << "ms. Switching to full reboot";
        // In this case device is in a boot loop. Only way to recover is to do dirty reboot.
        RebootSystem(ANDROID_RB_RESTART2, "userspace-reboot-watchdog-triggered");
        RebootSystem(ANDROID_RB_RESTART2, "userspace_failed,watchdog_triggered");
    }
    LOG(INFO) << "Device booted, stopping userspace reboot watchdog";
}
@@ -847,7 +847,7 @@ static void HandleUserspaceReboot() {
    if (pid < 0) {
        PLOG(ERROR) << "Failed to fork process for userspace reboot watchdog. Switching to full "
                    << "reboot";
        trigger_shutdown("reboot,userspace-reboot-failed-to-fork");
        trigger_shutdown("reboot,userspace_failed,watchdog_fork");
        return;
    }
    if (pid == 0) {