summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2020-03-13 22:25:02 +0100
committerTianjie Xu <xunchang@google.com>2020-03-14 00:09:48 +0100
commit00c4aba9bf428717fc00e26a03e97401eca76ee8 (patch)
tree9e972783e02a3969c3e38aaf1a687f07f56b779c
parentMerge "Merge stage-aosp-master to aosp-master - DO NOT MERGE" (diff)
downloadandroid_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.tar
android_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.tar.gz
android_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.tar.bz2
android_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.tar.lz
android_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.tar.xz
android_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.tar.zst
android_bootable_recovery-00c4aba9bf428717fc00e26a03e97401eca76ee8.zip
-rw-r--r--otautil/include/otautil/sysutil.h2
-rw-r--r--otautil/sysutil.cpp8
-rw-r--r--recovery.cpp8
-rw-r--r--recovery_ui/ui.cpp3
-rw-r--r--updater/install.cpp1
5 files changed, 8 insertions, 14 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) {
diff --git a/recovery.cpp b/recovery.cpp
index 9ea616e13..b1f106b1c 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -783,13 +783,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
ui->Print("Retry attempt %d\n", retry_count);
// Reboot back into recovery to retry the update.
- if (!Reboot("recovery")) {
- ui->Print("Reboot failed\n");
- } else {
- while (true) {
- pause();
- }
- }
+ Reboot("recovery");
}
// If this is an eng or userdebug build, then automatically
// turn the text display on if the script fails so the error
diff --git a/recovery_ui/ui.cpp b/recovery_ui/ui.cpp
index 6f5cbbca6..330721773 100644
--- a/recovery_ui/ui.cpp
+++ b/recovery_ui/ui.cpp
@@ -375,9 +375,6 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
case RecoveryUI::REBOOT:
if (reboot_enabled) {
Reboot("userrequested,recovery,ui");
- while (true) {
- pause();
- }
}
break;
diff --git a/updater/install.cpp b/updater/install.cpp
index 62ff87e76..7608dc3cd 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -733,7 +733,6 @@ Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique
Reboot(property);
- sleep(5);
return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name);
}