recovery: Add ability to set title lines

Add the ability to change the contents of
the title lines, displayed at the top of
the screen. Once set, the same lines are
displayed for all menus until changed again.

Test: Recovery works
Bug: 78793464
Change-Id: I7ef5594b0d76dbbd2e01ad7508863af1270b2a2a
This commit is contained in:
Jerry Zhang
2018-05-07 11:21:10 -07:00
parent 901f0c3516
commit 0e577ee424
5 changed files with 19 additions and 5 deletions

View File

@@ -496,6 +496,10 @@ int ScreenRecoveryUI::DrawWrappedTextLines(int x, int y,
return offset;
}
void ScreenRecoveryUI::SetTitle(const std::vector<std::string>& lines) {
title_lines_ = lines;
}
// Redraws everything on the screen. Does not flip pages. Should only be called with updateMutex
// locked.
void ScreenRecoveryUI::draw_screen_locked() {
@@ -529,11 +533,9 @@ void ScreenRecoveryUI::draw_menu_and_text_buffer_locked(
int x = kMarginWidth + kMenuIndent;
SetColor(INFO);
y += DrawTextLine(x, y, "Android Recovery", true);
std::string recovery_fingerprint =
android::base::GetProperty("ro.bootimage.build.fingerprint", "");
for (const auto& chunk : android::base::Split(recovery_fingerprint, ":")) {
y += DrawTextLine(x, y, chunk, false);
for (size_t i = 0; i < title_lines_.size(); i++) {
y += DrawTextLine(x, y, title_lines_[i], i == 0);
}
y += DrawTextLines(x, y, help_message);