diff options
author | Jerry Zhang <zhangjerry@google.com> | 2018-05-22 02:14:56 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-05-22 02:14:56 +0200 |
commit | 118d6ac3a0394a0dd0ee938631d985d807402c32 (patch) | |
tree | 7940caa0e1a245ecfdb8fb0ae00799b850c8b5a3 | |
parent | Merge "updater: Clean up the header lines computation." am: a5735e9b5f am: 1e29bb6717 (diff) | |
parent | Merge "recovery: Add ability to set title lines" am: cba047f944 (diff) | |
download | android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.tar android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.tar.gz android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.tar.bz2 android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.tar.lz android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.tar.xz android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.tar.zst android_bootable_recovery-118d6ac3a0394a0dd0ee938631d985d807402c32.zip |
-rw-r--r-- | recovery.cpp | 5 | ||||
-rw-r--r-- | screen_ui.cpp | 12 | ||||
-rw-r--r-- | screen_ui.h | 3 | ||||
-rw-r--r-- | stub_ui.h | 2 | ||||
-rw-r--r-- | ui.h | 2 |
5 files changed, 19 insertions, 5 deletions
diff --git a/recovery.cpp b/recovery.cpp index ac3e7c633..69b149906 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -1083,6 +1083,11 @@ 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), "Android Recovery"); + ui->SetTitle(title_lines); + device->StartRecovery(); printf("Command:"); diff --git a/screen_ui.cpp b/screen_ui.cpp index fd7a1bea5..f1b38781a 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -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); diff --git a/screen_ui.h b/screen_ui.h index 2d6b621d5..c90a2cd17 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -141,6 +141,7 @@ class ScreenRecoveryUI : public RecoveryUI { size_t ShowMenu(const std::vector<std::string>& headers, const std::vector<std::string>& items, size_t initial_selection, bool menu_only, const std::function<int(int, bool)>& key_handler) override; + void SetTitle(const std::vector<std::string>& lines) override; void KeyLongPress(int) override; @@ -266,6 +267,8 @@ class ScreenRecoveryUI : public RecoveryUI { bool show_text; bool show_text_ever; // has show_text ever been true? + std::vector<std::string> title_lines_; + bool scrollable_menu_; std::unique_ptr<Menu> menu_; @@ -67,6 +67,8 @@ class StubRecoveryUI : public RecoveryUI { const std::function<int(int, bool)>& /* key_handler */) override { return initial_selection; } + + void SetTitle(const std::vector<std::string>& /* lines */) override {} }; #endif // RECOVERY_STUB_UI_H @@ -134,6 +134,8 @@ class RecoveryUI { // --- menu display --- + virtual void SetTitle(const std::vector<std::string>& lines) = 0; + // Displays a menu with the given 'headers' and 'items'. The supplied 'key_handler' callback, // which is typically bound to Device::HandleMenuKey(), should return the expected action for the // given key code and menu visibility (e.g. to move the cursor or to select an item). Caller sets |