Merge "Whitelist reboot reasons related to userspace reboot failure" am: abe52dcb88 am: 2edb1355d5 am: cb694f3542

Change-Id: Ia8e1f7de3bf9b69556442035a0d8922eef10b7d1
This commit is contained in:
Automerger Merge Worker 2020-01-31 16:35:08 +00:00
commit 6b7985aa8d
3 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -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();

View file

@ -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) {