summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Plotnikov <dplotnikov@google.com>2017-04-28 01:00:04 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-04-28 01:00:04 +0200
commit8a3d58655cdef731548e7aabae04f33ba30379dc (patch)
treececa0cd014327a085cadb171fce408708b8791e0
parentMerge "Separate libupdate_verifier module and add testcases." am: c99bb23955 am: d8c078d2c6 (diff)
parentMerge "Adding support for quiescent reboot to recovery" am: 0481faef77 (diff)
downloadandroid_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.tar
android_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.tar.gz
android_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.tar.bz2
android_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.tar.lz
android_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.tar.xz
android_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.tar.zst
android_bootable_recovery-8a3d58655cdef731548e7aabae04f33ba30379dc.zip
-rw-r--r--common.h2
-rw-r--r--recovery.cpp26
-rw-r--r--ui.cpp2
-rw-r--r--updater/install.cpp5
4 files changed, 27 insertions, 8 deletions
diff --git a/common.h b/common.h
index bda793599..62fb1324b 100644
--- a/common.h
+++ b/common.h
@@ -43,4 +43,6 @@ void ui_print(const char* format, ...);
bool is_ro_debuggable();
+bool reboot(const std::string& command);
+
#endif // RECOVERY_COMMON_H
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) {
diff --git a/ui.cpp b/ui.cpp
index 9194ae3df..cad744930 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -227,7 +227,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
case RecoveryUI::REBOOT:
if (reboot_enabled) {
- android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,");
+ reboot("reboot,");
while (true) { pause(); }
}
break;
diff --git a/updater/install.cpp b/updater/install.cpp
index 857d7f1e0..888239c83 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -890,7 +890,10 @@ Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique
return StringValue("");
}
- const std::string reboot_cmd = "reboot," + property;
+ std::string reboot_cmd = "reboot," + property;
+ if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+ reboot_cmd += ",quiescent";
+ }
android::base::SetProperty(ANDROID_RB_PROPERTY, reboot_cmd);
sleep(5);