summaryrefslogtreecommitdiffstats
path: root/otautil
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2020-03-14 23:33:29 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-03-14 23:33:29 +0100
commita69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7 (patch)
tree8651cb90295a8fa07e968c8e584e72f1b9d2a104 /otautil
parentMerge "recovery: Remove HOST_OS guard for f2fs tools" (diff)
parentConsolidate the wait in recovery's reboot (diff)
downloadandroid_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.tar
android_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.tar.gz
android_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.tar.bz2
android_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.tar.lz
android_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.tar.xz
android_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.tar.zst
android_bootable_recovery-a69c69b26f3dce9bac5b32f3c8f7c6c7115a0de7.zip
Diffstat (limited to 'otautil')
-rw-r--r--otautil/include/otautil/sysutil.h2
-rw-r--r--otautil/sysutil.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h
index 326db8644..d0d2e67d7 100644
--- a/otautil/include/otautil/sysutil.h
+++ b/otautil/include/otautil/sysutil.h
@@ -103,7 +103,7 @@ class MemMapping {
// Reboots the device into the specified target, by additionally handling quiescent reboot mode.
// All unknown targets reboot into Android.
-bool Reboot(std::string_view target);
+[[noreturn]] void Reboot(std::string_view target);
// Triggers a shutdown.
bool Shutdown(std::string_view target);
diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp
index 6cd46c6a9..b3ead9736 100644
--- a/otautil/sysutil.cpp
+++ b/otautil/sysutil.cpp
@@ -219,14 +219,18 @@ MemMapping::~MemMapping() {
ranges_.clear();
}
-bool Reboot(std::string_view target) {
+void Reboot(std::string_view target) {
std::string cmd = "reboot," + std::string(target);
// Honor the quiescent mode if applicable.
if (target != "bootloader" && target != "fastboot" &&
android::base::GetBoolProperty("ro.boot.quiescent", false)) {
cmd += ",quiescent";
}
- return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
+ if (!android::base::SetProperty(ANDROID_RB_PROPERTY, cmd)) {
+ LOG(FATAL) << "Reboot failed";
+ }
+
+ while (true) pause();
}
bool Shutdown(std::string_view target) {