aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2017-04-27 17:34:15 -0500
committerGerrit Code Review2017-04-27 17:34:16 -0500
commit0481faef77bf87e1c44b787c4aaf92e57cccf988 (patch)
tree0dd6c82a91f5867046e6c9806b0484b2754165e1 /recovery.cpp
parentc99bb23955a7ca70340057ba325d75263428402d (diff)
parent8706a98aa635236a95795f0a0c122bb3e591a50d (diff)
downloadplatform-bootable-recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.gz
platform-bootable-recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.xz
platform-bootable-recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.zip
Merge "Adding support for quiescent reboot to recovery"
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 58769817..3041d6ca 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -208,6 +208,14 @@ bool is_ro_debuggable() {
208 return android::base::GetBoolProperty("ro.debuggable", false); 208 return android::base::GetBoolProperty("ro.debuggable", false);
209} 209}
210 210
211bool reboot(const std::string& command) {
212 std::string cmd = command;
213 if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
214 cmd += ",quiescent";
215 }
216 return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
217}
218
211static void redirect_stdio(const char* filename) { 219static void redirect_stdio(const char* filename) {
212 int pipefd[2]; 220 int pipefd[2];
213 if (pipe(pipefd) == -1) { 221 if (pipe(pipefd) == -1) {
@@ -1448,12 +1456,18 @@ int main(int argc, char **argv) {
1448 printf("reason is [%s]\n", reason); 1456 printf("reason is [%s]\n", reason);
1449 1457
1450 Device* device = make_device(); 1458 Device* device = make_device();
1451 ui = device->GetUI(); 1459 if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
1460 printf("Quiescent recovery mode.\n");
1461 ui = new StubRecoveryUI();
1462 } else {
1463 ui = device->GetUI();
1452 1464
1453 if (!ui->Init(locale)) { 1465 if (!ui->Init(locale)) {
1454 printf("Failed to initialize UI, use stub UI instead."); 1466 printf("Failed to initialize UI, use stub UI instead.\n");
1455 ui = new StubRecoveryUI(); 1467 ui = new StubRecoveryUI();
1468 }
1456 } 1469 }
1470
1457 // Set background string to "installing security update" for security update, 1471 // Set background string to "installing security update" for security update,
1458 // otherwise set it to "installing system update". 1472 // otherwise set it to "installing system update".
1459 ui->SetSystemUpdateText(security_update); 1473 ui->SetSystemUpdateText(security_update);
@@ -1525,7 +1539,7 @@ int main(int argc, char **argv) {
1525 ui->Print("Retry attempt %d\n", retry_count); 1539 ui->Print("Retry attempt %d\n", retry_count);
1526 1540
1527 // Reboot and retry the update 1541 // Reboot and retry the update
1528 if (!android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,recovery")) { 1542 if (!reboot("reboot,recovery")) {
1529 ui->Print("Reboot failed\n"); 1543 ui->Print("Reboot failed\n");
1530 } else { 1544 } else {
1531 while (true) { 1545 while (true) {
@@ -1630,7 +1644,7 @@ int main(int argc, char **argv) {
1630 1644
1631 default: 1645 default:
1632 ui->Print("Rebooting...\n"); 1646 ui->Print("Rebooting...\n");
1633 android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,"); 1647 reboot("reboot,");
1634 break; 1648 break;
1635 } 1649 }
1636 while (true) { 1650 while (true) {