aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Plotnikov2017-04-18 10:28:26 -0500
committerDmitri Plotnikov2017-04-19 16:43:08 -0500
commit8706a98aa635236a95795f0a0c122bb3e591a50d (patch)
tree133e90784e5115282067ed38c1e5919a3a033b7c /recovery.cpp
parentba3f078f6f00ce4dd4070741fc4e05b58e1d918b (diff)
downloadplatform-bootable-recovery-8706a98aa635236a95795f0a0c122bb3e591a50d.tar.gz
platform-bootable-recovery-8706a98aa635236a95795f0a0c122bb3e591a50d.tar.xz
platform-bootable-recovery-8706a98aa635236a95795f0a0c122bb3e591a50d.zip
Adding support for quiescent reboot to recovery
Bug: 37401320 Test: build and push OTA and hit adb reboot recovery,quiescent. The screen should remain off throughout the upgrade process. Change-Id: Ibed3795c09e26c4fa73684d40b94e40c78394d3f
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 b24efa96..173baac1 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -209,6 +209,14 @@ bool is_ro_debuggable() {
209 return android::base::GetBoolProperty("ro.debuggable", false); 209 return android::base::GetBoolProperty("ro.debuggable", false);
210} 210}
211 211
212bool reboot(const std::string& command) {
213 std::string cmd = command;
214 if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
215 cmd += ",quiescent";
216 }
217 return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
218}
219
212static void redirect_stdio(const char* filename) { 220static void redirect_stdio(const char* filename) {
213 int pipefd[2]; 221 int pipefd[2];
214 if (pipe(pipefd) == -1) { 222 if (pipe(pipefd) == -1) {
@@ -1449,12 +1457,18 @@ int main(int argc, char **argv) {
1449 printf("reason is [%s]\n", reason); 1457 printf("reason is [%s]\n", reason);
1450 1458
1451 Device* device = make_device(); 1459 Device* device = make_device();
1452 ui = device->GetUI(); 1460 if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
1461 printf("Quiescent recovery mode.\n");
1462 ui = new StubRecoveryUI();
1463 } else {
1464 ui = device->GetUI();
1453 1465
1454 if (!ui->Init(locale)) { 1466 if (!ui->Init(locale)) {
1455 printf("Failed to initialize UI, use stub UI instead."); 1467 printf("Failed to initialize UI, use stub UI instead.\n");
1456 ui = new StubRecoveryUI(); 1468 ui = new StubRecoveryUI();
1469 }
1457 } 1470 }
1471
1458 // Set background string to "installing security update" for security update, 1472 // Set background string to "installing security update" for security update,
1459 // otherwise set it to "installing system update". 1473 // otherwise set it to "installing system update".
1460 ui->SetSystemUpdateText(security_update); 1474 ui->SetSystemUpdateText(security_update);
@@ -1526,7 +1540,7 @@ int main(int argc, char **argv) {
1526 ui->Print("Retry attempt %d\n", retry_count); 1540 ui->Print("Retry attempt %d\n", retry_count);
1527 1541
1528 // Reboot and retry the update 1542 // Reboot and retry the update
1529 if (!android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,recovery")) { 1543 if (!reboot("reboot,recovery")) {
1530 ui->Print("Reboot failed\n"); 1544 ui->Print("Reboot failed\n");
1531 } else { 1545 } else {
1532 while (true) { 1546 while (true) {
@@ -1623,7 +1637,7 @@ int main(int argc, char **argv) {
1623 1637
1624 default: 1638 default:
1625 ui->Print("Rebooting...\n"); 1639 ui->Print("Rebooting...\n");
1626 android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,"); 1640 reboot("reboot,");
1627 break; 1641 break;
1628 } 1642 }
1629 while (true) { 1643 while (true) {