Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 739b5760 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-946c768b-83eb-4b7b-83e7-5737856fa8ec-for-git_oc-mr1-release-43...

release-request-946c768b-83eb-4b7b-83e7-5737856fa8ec-for-git_oc-mr1-release-4326576 snap-temp-L80300000101054689

Change-Id: Ie2b658ebaabe2fdfb39b9443cd1d1b544a573faa
parents 3a3ccf8b 17fa5c7c
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ ScreenRecoveryUI::ScreenRecoveryUI()
      text_top_(0),
      show_text(false),
      show_text_ever(false),
      menu_(nullptr),
      menu_headers_(nullptr),
      show_menu(false),
      menu_items(0),
      menu_sel(0),
@@ -356,10 +356,10 @@ void ScreenRecoveryUI::draw_screen_locked() {
        DrawHighlightBar(0, y - 2, gr_fb_width(), char_height_ + 4);
        // Bold white text for the selected item.
        SetColor(MENU_SEL_FG);
        y += DrawTextLine(x, y, menu_[i], true);
        y += DrawTextLine(x, y, menu_[i].c_str(), true);
        SetColor(MENU);
      } else {
        y += DrawTextLine(x, y, menu_[i], false);
        y += DrawTextLine(x, y, menu_[i].c_str(), false);
      }
    }
    y += DrawHorizontalRule(y);
@@ -508,7 +508,6 @@ bool ScreenRecoveryUI::Init(const std::string& locale) {

  text_ = Alloc2d(text_rows_, text_cols_ + 1);
  file_viewer_text_ = Alloc2d(text_rows_, text_cols_ + 1);
  menu_ = Alloc2d(text_rows_, text_cols_ + 1);

  text_col_ = text_row_ = 0;
  text_top_ = 1;
@@ -771,12 +770,11 @@ void ScreenRecoveryUI::StartMenu(const char* const* headers, const char* const*
  pthread_mutex_lock(&updateMutex);
  if (text_rows_ > 0 && text_cols_ > 0) {
    menu_headers_ = headers;
    size_t i = 0;
    for (; i < text_rows_ && items[i] != nullptr; ++i) {
      strncpy(menu_[i], items[i], text_cols_ - 1);
      menu_[i][text_cols_ - 1] = '\0';
    menu_.clear();
    for (size_t i = 0; i < text_rows_ && items[i] != nullptr; ++i) {
      menu_.emplace_back(std::string(items[i], strnlen(items[i], text_cols_ - 1)));
    }
    menu_items = i;
    menu_items = static_cast<int>(menu_.size());
    show_menu = true;
    menu_sel = initial_selection;
    update_screen_locked();
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <stdio.h>

#include <string>
#include <vector>

#include "ui.h"

@@ -127,7 +128,7 @@ class ScreenRecoveryUI : public RecoveryUI {
  bool show_text;
  bool show_text_ever;  // has show_text ever been true?

  char** menu_;
  std::vector<std::string> menu_;
  const char* const* menu_headers_;
  bool show_menu;
  int menu_items, menu_sel;
+6 −7
Original line number Diff line number Diff line
@@ -154,11 +154,11 @@ void WearRecoveryUI::draw_screen_locked() {
          // white text of selected item
          SetColor(MENU_SEL_FG);
          if (menu_[i][0]) {
            gr_text(gr_sys_font(), x + 4, y, menu_[i], 1);
            gr_text(gr_sys_font(), x + 4, y, menu_[i].c_str(), 1);
          }
          SetColor(MENU);
        } else if (menu_[i][0]) {
          gr_text(gr_sys_font(), x + 4, y, menu_[i], 0);
          gr_text(gr_sys_font(), x + 4, y, menu_[i].c_str(), 0);
        }
        y += char_height_ + 4;
      }
@@ -255,17 +255,16 @@ void WearRecoveryUI::StartMenu(const char* const* headers, const char* const* it
  pthread_mutex_lock(&updateMutex);
  if (text_rows_ > 0 && text_cols_ > 0) {
    menu_headers_ = headers;
    size_t i = 0;
    menu_.clear();
    // "i < text_rows_" is removed from the loop termination condition,
    // which is different from the one in ScreenRecoveryUI::StartMenu().
    // Because WearRecoveryUI supports scrollable menu, it's fine to have
    // more entries than text_rows_. The menu may be truncated otherwise.
    // Bug: 23752519
    for (; items[i] != nullptr; i++) {
      strncpy(menu_[i], items[i], text_cols_ - 1);
      menu_[i][text_cols_ - 1] = '\0';
    for (size_t i = 0; items[i] != nullptr; i++) {
      menu_.emplace_back(std::string(items[i], strnlen(items[i], text_cols_ - 1)));
    }
    menu_items = i;
    menu_items = static_cast<int>(menu_.size());
    show_menu = true;
    menu_sel = initial_selection;
    menu_start = 0;