Merge "Pause recovery when it ends with Shutdown" into main am: 75014b82e2

Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3030423

Change-Id: I7ab1dd0f8082958ef812b26019c319770df3f02b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2024-04-30 17:32:09 +00:00 committed by Automerger Merge Worker
commit 6dee61bf56
2 changed files with 7 additions and 3 deletions

View file

@ -106,7 +106,7 @@ class MemMapping {
[[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

View file

@ -233,9 +233,13 @@ void Reboot(std::string_view target) {
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) {