Don't proceed with userspace reboot if device doesn't support it
Test: set property to false and adb reboot userspace
Bug: 135984674
Change-Id: I11e55243df002dd54e533a6b9fc529866597d4dd
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 0e61234..5ca1fee 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -834,6 +834,10 @@
}
static void HandleUserspaceReboot() {
+ if (!android::sysprop::InitProperties::userspace_reboot_in_progress().value_or(false)) {
+ LOG(ERROR) << "Attempted a userspace reboot on a device that doesn't support it";
+ return;
+ }
// Spinnig up a separate thread will fail the setns call later in the boot sequence.
// Fork a new process to monitor userspace reboot while we are investigating a better solution.
pid_t pid = fork();