Pause recovery when it ends with Shutdown
In the current design, when recovery ends with Shutdown, it will continue to execute commands repeatedly in the loop body, after it sets a "Shutdown" property. That may lead to some competition between the shutdown process and recovery command work, and then cause some problems. So, pause recovery when it ends with Shutdown, like it ending with Reboot. Change-Id: I57dfef70e7b8d600af3a3f2c0199f14d5a0e9916
This commit is contained in:
parent
cd6618b619
commit
aef46f3edd
2 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue