Merge "Address the warnings in recovery code"
diff --git a/Android.mk b/Android.mk
index 9806d10..d727ca2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -56,12 +56,10 @@
LOCAL_MODULE := recovery_deps
ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
-ifeq ($(HOST_OS),linux)
LOCAL_REQUIRED_MODULES += \
make_f2fs.recovery \
sload_f2fs.recovery
endif
-endif
# On A/B devices recovery-persist reads the recovery related file from the persist storage and
# copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist
diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h
index 326db86..d0d2e67 100644
--- a/otautil/include/otautil/sysutil.h
+++ b/otautil/include/otautil/sysutil.h
@@ -103,7 +103,7 @@
// 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 6cd46c6..b3ead97 100644
--- a/otautil/sysutil.cpp
+++ b/otautil/sysutil.cpp
@@ -219,14 +219,18 @@
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 9ea616e..b1f106b 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -783,13 +783,7 @@
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 6f5cbbc..3307217 100644
--- a/recovery_ui/ui.cpp
+++ b/recovery_ui/ui.cpp
@@ -375,9 +375,6 @@
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 62ff87e..7608dc3 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -733,7 +733,6 @@
Reboot(property);
- sleep(5);
return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name);
}