aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastboot/fastboot.cpp2
-rw-r--r--recovery.cpp15
-rw-r--r--recovery_ui/screen_ui.cpp47
3 files changed, 33 insertions, 31 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 14f5e4bd..f64d6229 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -39,7 +39,7 @@ static const std::vector<std::pair<std::string, Device::BuiltinAction>> kFastboo
Device::BuiltinAction StartFastboot(Device* device, const std::vector<std::string>& /* args */) {
RecoveryUI* ui = device->GetUI();
- std::vector<std::string> title_lines = { "Android Fastboot" };
+ std::vector<std::string> title_lines;
title_lines.push_back("Product name - " + android::base::GetProperty("ro.product.device", ""));
title_lines.push_back("Bootloader version - " + android::base::GetProperty("ro.bootloader", ""));
title_lines.push_back("Baseband version - " +
diff --git a/recovery.cpp b/recovery.cpp
index 60553b7f..72f000b8 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -33,6 +33,7 @@
#include <algorithm>
#include <functional>
#include <memory>
+#include <regex>
#include <string>
#include <vector>
@@ -938,9 +939,17 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
ui->SetStage(st_cur, st_max);
}
- std::vector<std::string> title_lines =
- android::base::Split(android::base::GetProperty("ro.bootimage.build.fingerprint", ""), ":");
- title_lines.insert(std::begin(title_lines), "Lineage Recovery");
+ // Extract the YYYYMMDD date from the full version string. Assume
+ // the first instance of "-[0-9]{8}-" (if any) has the desired date.
+ std::string ver = android::base::GetProperty("ro.lineage.version", "");
+ std::smatch ver_date_match;
+ std::regex_search(ver, ver_date_match, std::regex("-(\\d{8})-"));
+ std::string ver_date = ver_date_match.str(1); // Empty if no match.
+
+ std::vector<std::string> title_lines = {
+ "Version " + android::base::GetProperty("ro.lineage.build.version", "(unknown)") +
+ " (" + ver_date + ")",
+ };
ui->SetTitle(title_lines);
ui->ResetKeyInterruptStatus();
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index 691fa1b7..b8b78735 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -822,33 +822,27 @@ void ScreenRecoveryUI::draw_menu_and_text_buffer_locked(
int y = margin_height_;
if (menu_) {
- int x = margin_width_ + kMenuIndent;
-
- SetColor(UIElement::INFO);
-
auto& logo = fastbootd_logo_enabled_ ? fastbootd_logo_ : lineage_logo_;
- if (logo && back_icon_) {
- auto logo_width = gr_get_width(logo.get());
- auto logo_height = gr_get_height(logo.get());
- auto centered_x = ScreenWidth() / 2 - logo_width / 2;
- DrawSurface(logo.get(), 0, 0, logo_width, logo_height, centered_x, y);
- y += logo_height;
-
- if (!menu_->IsMain()) {
- auto icon_w = gr_get_width(back_icon_.get());
- auto icon_h = gr_get_height(back_icon_.get());
- auto icon_x = centered_x / 2 - icon_w / 2;
- auto icon_y = y - logo_height / 2 - icon_h / 2;
- gr_blit(back_icon_sel_ && menu_->selection() == -1 ? back_icon_sel_.get() : back_icon_.get(),
- 0, 0, icon_w, icon_h, icon_x, icon_y);
- }
- y += MenuItemPadding();
- } else {
- for (size_t i = 0; i < title_lines_.size(); i++) {
- y += DrawTextLine(x, y, title_lines_[i], i == 0);
- }
+ auto logo_width = gr_get_width(logo.get());
+ auto logo_height = gr_get_height(logo.get());
+ auto centered_x = ScreenWidth() / 2 - logo_width / 2;
+ DrawSurface(logo.get(), 0, 0, logo_width, logo_height, centered_x, y);
+ y += logo_height;
+
+ if (!menu_->IsMain()) {
+ auto icon_w = gr_get_width(back_icon_.get());
+ auto icon_h = gr_get_height(back_icon_.get());
+ auto icon_x = centered_x / 2 - icon_w / 2;
+ auto icon_y = y - logo_height / 2 - icon_h / 2;
+ gr_blit(back_icon_sel_ && menu_->selection() == -1 ? back_icon_sel_.get() : back_icon_.get(),
+ 0, 0, icon_w, icon_h, icon_x, icon_y);
}
+ int x = margin_width_ + kMenuIndent;
+ if (!title_lines_.empty()) {
+ SetColor(UIElement::INFO);
+ y += DrawTextLines(x, y, title_lines_);
+ }
y += menu_->DrawHeader(x, y);
menu_start_y_ = y + 12; // Skip horizontal rule and some margin
y += menu_->DrawItems(x, y, ScreenWidth(), IsLongPress());
@@ -1316,9 +1310,8 @@ std::unique_ptr<Menu> ScreenRecoveryUI::CreateMenu(const std::vector<std::string
size_t initial_selection) const {
int menu_char_width = MenuCharWidth();
int menu_char_height = MenuCharHeight();
- int menu_item_padding = MenuItemPadding();
- int menu_rows = (ScreenHeight() - margin_height_*2 - gr_get_height(lineage_logo_.get()))
- / (menu_char_height + 2 * menu_item_padding) - text_headers.size();
+ int menu_rows = (ScreenHeight() - margin_height_*2 - gr_get_height(lineage_logo_.get())
+ - menu_char_height*title_lines_.size()) / MenuItemHeight() - text_headers.size();
int menu_cols = (ScreenWidth() - margin_width_*2 - kMenuIndent) / menu_char_width;
return std::make_unique<TextMenu>(scrollable_menu_, menu_rows, menu_cols, text_headers, text_items,
initial_selection, menu_char_height, *menu_draw_funcs_);