Merge "Pause recovery when it ends with Shutdown" into main
diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h
index d0d2e67..5c64cff 100644
--- a/otautil/include/otautil/sysutil.h
+++ b/otautil/include/otautil/sysutil.h
@@ -106,7 +106,7 @@
[[noreturn]] void Reboot(std::string_view target);
// Triggers a shutdown.
-bool Shutdown(std::string_view target);
+[[noreturn]] void Shutdown(std::string_view target);
// Returns a null-terminated char* array, where the elements point to the C-strings in the given
// vector, plus an additional nullptr at the end. This is a helper function that facilitates
diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp
index b3ead97..2c7752e 100644
--- a/otautil/sysutil.cpp
+++ b/otautil/sysutil.cpp
@@ -233,9 +233,13 @@
while (true) pause();
}
-bool Shutdown(std::string_view target) {
+void Shutdown(std::string_view target) {
std::string cmd = "shutdown," + std::string(target);
- return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
+ if (!android::base::SetProperty(ANDROID_RB_PROPERTY, cmd)) {
+ LOG(FATAL) << "Shutdown failed";
+ }
+
+ while (true) pause();
}
std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args) {