summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-04-28 00:34:15 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-04-28 00:34:16 +0200
commit0481faef77bf87e1c44b787c4aaf92e57cccf988 (patch)
tree0dd6c82a91f5867046e6c9806b0484b2754165e1 /recovery.cpp
parentMerge "Separate libupdate_verifier module and add testcases." (diff)
parentAdding support for quiescent reboot to recovery (diff)
downloadandroid_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar
android_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.gz
android_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.bz2
android_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.lz
android_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.xz
android_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.tar.zst
android_bootable_recovery-0481faef77bf87e1c44b787c4aaf92e57cccf988.zip
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 587698170..3041d6cac 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -208,6 +208,14 @@ bool is_ro_debuggable() {
return android::base::GetBoolProperty("ro.debuggable", false);
}
+bool reboot(const std::string& command) {
+ std::string cmd = command;
+ if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+ cmd += ",quiescent";
+ }
+ return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
+}
+
static void redirect_stdio(const char* filename) {
int pipefd[2];
if (pipe(pipefd) == -1) {
@@ -1448,12 +1456,18 @@ int main(int argc, char **argv) {
printf("reason is [%s]\n", reason);
Device* device = make_device();
- ui = device->GetUI();
+ if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+ printf("Quiescent recovery mode.\n");
+ ui = new StubRecoveryUI();
+ } else {
+ ui = device->GetUI();
- if (!ui->Init(locale)) {
- printf("Failed to initialize UI, use stub UI instead.");
- ui = new StubRecoveryUI();
+ if (!ui->Init(locale)) {
+ printf("Failed to initialize UI, use stub UI instead.\n");
+ ui = new StubRecoveryUI();
+ }
}
+
// Set background string to "installing security update" for security update,
// otherwise set it to "installing system update".
ui->SetSystemUpdateText(security_update);
@@ -1525,7 +1539,7 @@ int main(int argc, char **argv) {
ui->Print("Retry attempt %d\n", retry_count);
// Reboot and retry the update
- if (!android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,recovery")) {
+ if (!reboot("reboot,recovery")) {
ui->Print("Reboot failed\n");
} else {
while (true) {
@@ -1630,7 +1644,7 @@ int main(int argc, char **argv) {
default:
ui->Print("Rebooting...\n");
- android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,");
+ reboot("reboot,");
break;
}
while (true) {