diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index d08a59f77..6409db0d5 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -312,6 +312,11 @@ const std::map 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 diff --git a/init/builtins.cpp b/init/builtins.cpp index c87759016..742e0896d 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -1123,6 +1123,7 @@ static Result 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 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(); diff --git a/init/reboot.cpp b/init/reboot.cpp index 8c9071494..8b239fe7f 100644 --- a/init/reboot.cpp +++ b/init/reboot.cpp @@ -737,7 +737,7 @@ static Result 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) {