Print with newline for ui_print.
Currently the ui_print command between the recovery and updater doesn't append newline. Updater has to send an extra "ui_print" command without any argument to get the line break. This looks unnecessary. And not all the callers (including the ones in bootable/recovery) are following this protocol when sending the ui_print command. This CL simplifies the protocol to always print with a newline for ui_print command. When updating from an old recovery with the new updater, all the ui_print'd strings would appear in one line as a side effect. But a) it would only affect the text-mode UI, which won't be shown to users; b) log files won't be affected. Bug: 32305035 Test: Apply an update with the new updater on top of an old and new recovery image respectively. Change-Id: I305a0ffc6f180daf60919cf99d24d1495d68749b
This commit is contained in:
parent
e78ca37656
commit
f013642477
3 changed files with 1 additions and 7 deletions
|
@ -420,11 +420,7 @@ static int try_update_binary(const char* path, ZipArchiveHandle zip, bool* wipe_
|
||||||
LOG(ERROR) << "invalid \"set_progress\" parameters: " << line;
|
LOG(ERROR) << "invalid \"set_progress\" parameters: " << line;
|
||||||
}
|
}
|
||||||
} else if (command == "ui_print") {
|
} else if (command == "ui_print") {
|
||||||
if (!args.empty()) {
|
ui->PrintOnScreenOnly("%s\n", args.c_str());
|
||||||
ui->PrintOnScreenOnly("%s", args.c_str());
|
|
||||||
} else {
|
|
||||||
ui->PrintOnScreenOnly("\n");
|
|
||||||
}
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
} else if (command == "wipe_cache") {
|
} else if (command == "wipe_cache") {
|
||||||
*wipe_cache = true;
|
*wipe_cache = true;
|
||||||
|
|
|
@ -76,7 +76,6 @@ static void uiPrint(State* state, const std::string& buffer) {
|
||||||
for (auto& line : lines) {
|
for (auto& line : lines) {
|
||||||
if (!line.empty()) {
|
if (!line.empty()) {
|
||||||
fprintf(ui->cmd_pipe, "ui_print %s\n", line.c_str());
|
fprintf(ui->cmd_pipe, "ui_print %s\n", line.c_str());
|
||||||
fprintf(ui->cmd_pipe, "ui_print\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,6 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
fprintf(cmd_pipe, "ui_print %s\n", line.c_str());
|
fprintf(cmd_pipe, "ui_print %s\n", line.c_str());
|
||||||
}
|
}
|
||||||
fprintf(cmd_pipe, "ui_print\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.error_code != kNoError) {
|
if (state.error_code != kNoError) {
|
||||||
|
|
Loading…
Reference in a new issue