Merge "Adding support for quiescent reboot to recovery" am: 0481faef77 am: 5b27cd1093
am: 533ad31cc1
Change-Id: Ia5505643eb1206ae333371a42aa47f81fdbc8d18
This commit is contained in:
@@ -43,4 +43,6 @@ void ui_print(const char* format, ...);
|
|||||||
|
|
||||||
bool is_ro_debuggable();
|
bool is_ro_debuggable();
|
||||||
|
|
||||||
|
bool reboot(const std::string& command);
|
||||||
|
|
||||||
#endif // RECOVERY_COMMON_H
|
#endif // RECOVERY_COMMON_H
|
||||||
|
|||||||
+20
-6
@@ -208,6 +208,14 @@ bool is_ro_debuggable() {
|
|||||||
return android::base::GetBoolProperty("ro.debuggable", false);
|
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) {
|
static void redirect_stdio(const char* filename) {
|
||||||
int pipefd[2];
|
int pipefd[2];
|
||||||
if (pipe(pipefd) == -1) {
|
if (pipe(pipefd) == -1) {
|
||||||
@@ -1448,12 +1456,18 @@ int main(int argc, char **argv) {
|
|||||||
printf("reason is [%s]\n", reason);
|
printf("reason is [%s]\n", reason);
|
||||||
|
|
||||||
Device* device = make_device();
|
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)) {
|
if (!ui->Init(locale)) {
|
||||||
printf("Failed to initialize UI, use stub UI instead.");
|
printf("Failed to initialize UI, use stub UI instead.\n");
|
||||||
ui = new StubRecoveryUI();
|
ui = new StubRecoveryUI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set background string to "installing security update" for security update,
|
// Set background string to "installing security update" for security update,
|
||||||
// otherwise set it to "installing system update".
|
// otherwise set it to "installing system update".
|
||||||
ui->SetSystemUpdateText(security_update);
|
ui->SetSystemUpdateText(security_update);
|
||||||
@@ -1525,7 +1539,7 @@ int main(int argc, char **argv) {
|
|||||||
ui->Print("Retry attempt %d\n", retry_count);
|
ui->Print("Retry attempt %d\n", retry_count);
|
||||||
|
|
||||||
// Reboot and retry the update
|
// Reboot and retry the update
|
||||||
if (!android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,recovery")) {
|
if (!reboot("reboot,recovery")) {
|
||||||
ui->Print("Reboot failed\n");
|
ui->Print("Reboot failed\n");
|
||||||
} else {
|
} else {
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -1630,7 +1644,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ui->Print("Rebooting...\n");
|
ui->Print("Rebooting...\n");
|
||||||
android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,");
|
reboot("reboot,");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
|
|||||||
|
|
||||||
case RecoveryUI::REBOOT:
|
case RecoveryUI::REBOOT:
|
||||||
if (reboot_enabled) {
|
if (reboot_enabled) {
|
||||||
android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,");
|
reboot("reboot,");
|
||||||
while (true) { pause(); }
|
while (true) { pause(); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+4
-1
@@ -890,7 +890,10 @@ Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique
|
|||||||
return StringValue("");
|
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);
|
android::base::SetProperty(ANDROID_RB_PROPERTY, reboot_cmd);
|
||||||
|
|
||||||
sleep(5);
|
sleep(5);
|
||||||
|
|||||||
Reference in New Issue
Block a user