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

Commit 076aba3d authored by Tao Bao's avatar Tao Bao Committed by android-build-merger
Browse files

Merge "Formatting RecoveryUI related files."

am: 8e7db8f4

Change-Id: I81e0e1e088da045f217aff957c7c5730d09cabbe
parents 170aa1c9 8e7db8f4
Loading
Loading
Loading
Loading
+381 −377
Original line number Diff line number Diff line
@@ -91,11 +91,16 @@ GRSurface* ScreenRecoveryUI::GetCurrentFrame() {

GRSurface* ScreenRecoveryUI::GetCurrentText() {
  switch (currentIcon) {
        case ERASING: return erasing_text;
        case ERROR: return error_text;
        case INSTALLING_UPDATE: return installing_text;
        case NO_COMMAND: return no_command_text;
        case NONE: abort();
    case ERASING:
      return erasing_text;
    case ERROR:
      return error_text;
    case INSTALLING_UPDATE:
      return installing_text;
    case NO_COMMAND:
      return no_command_text;
    case NONE:
      abort();
  }
}

@@ -128,8 +133,7 @@ static constexpr int kLayouts[LAYOUT_MAX][DIMENSION_MAX] = {
};

int ScreenRecoveryUI::GetAnimationBaseline() {
    return GetTextBaseline() - PixelsFromDp(kLayouts[layout_][ICON]) -
            gr_get_height(loopFrames[0]);
  return GetTextBaseline() - PixelsFromDp(kLayouts[layout_][ICON]) - gr_get_height(loopFrames[0]);
}

int ScreenRecoveryUI::GetTextBaseline() {
@@ -336,8 +340,8 @@ void ScreenRecoveryUI::draw_screen_locked() {
  SetColor(LOG);
  int row = (text_top_ + text_rows_ - 1) % text_rows_;
  size_t count = 0;
  for (int ty = gr_fb_height() - kMarginHeight - char_height_;
       ty >= y && count < text_rows_; ty -= char_height_, ++count) {
  for (int ty = gr_fb_height() - kMarginHeight - char_height_; ty >= y && count < text_rows_;
       ty -= char_height_, ++count) {
    int temp_y = ty;
    DrawTextLine(x, &temp_y, text_[row], false);
    --row;
+111 −105
Original line number Diff line number Diff line
@@ -57,8 +57,7 @@ class ScreenRecoveryUI : public RecoveryUI {
  void ShowFile(const char* filename);

  // menu display
    void StartMenu(const char* const * headers, const char* const * items,
                   int initial_selection);
  void StartMenu(const char* const* headers, const char* const* items, int initial_selection);
  int SelectMenu(int sel);
  void EndMenu();

@@ -67,7 +66,14 @@ class ScreenRecoveryUI : public RecoveryUI {
  void Redraw();

  enum UIElement {
        HEADER, MENU, MENU_SEL_BG, MENU_SEL_BG_ACTIVE, MENU_SEL_FG, LOG, TEXT_FILL, INFO
    HEADER,
    MENU,
    MENU_SEL_BG,
    MENU_SEL_BG_ACTIVE,
    MENU_SEL_FG,
    LOG,
    TEXT_FILL,
    INFO
  };
  void SetColor(UIElement e);

+165 −165
Original line number Diff line number Diff line
@@ -228,7 +228,9 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
      case RecoveryUI::REBOOT:
        if (reboot_enabled) {
          reboot("reboot,");
                while (true) { pause(); }
          while (true) {
            pause();
          }
        }
        break;

@@ -332,8 +334,7 @@ int RecoveryUI::WaitKey() {
bool RecoveryUI::IsUsbConnected() {
  int fd = open("/sys/class/android_usb/android0/state", O_RDONLY);
  if (fd < 0) {
        printf("failed to open /sys/class/android_usb/android0/state: %s\n",
               strerror(errno));
    printf("failed to open /sys/class/android_usb/android0/state: %s\n", strerror(errno));
    return 0;
  }

@@ -341,8 +342,7 @@ bool RecoveryUI::IsUsbConnected() {
  // USB is connected if android_usb state is CONNECTED or CONFIGURED.
  int connected = (TEMP_FAILURE_RETRY(read(fd, &buf, 1)) == 1) && (buf == 'C');
  if (close(fd) < 0) {
        printf("failed to close /sys/class/android_usb/android0/state: %s\n",
               strerror(errno));
    printf("failed to close /sys/class/android_usb/android0/state: %s\n", strerror(errno));
  }
  return connected;
}
+247 −256
Original line number Diff line number Diff line
@@ -50,17 +50,13 @@ static double now() {
  return tv.tv_sec + tv.tv_usec / 1000000.0;
}

WearRecoveryUI::WearRecoveryUI() :
    progress_bar_y(259),
    outer_height(0),
    outer_width(0),
    menu_unusable_rows(0) {
WearRecoveryUI::WearRecoveryUI()
    : progress_bar_y(259), outer_height(0), outer_width(0), menu_unusable_rows(0) {
  intro_frames = 22;
  loop_frames = 60;
  animation_fps = 30;

    for (size_t i = 0; i < 5; i++)
        backgroundIcon[i] = NULL;
  for (size_t i = 0; i < 5; i++) backgroundIcon[i] = NULL;

  self = this;
}
@@ -72,8 +68,7 @@ int WearRecoveryUI::GetProgressBaseline() {
// Draw background frame on the screen.  Does not flip pages.
// Should only be called with updateMutex locked.
// TODO merge drawing routines with screen_ui
void WearRecoveryUI::draw_background_locked()
{
void WearRecoveryUI::draw_background_locked() {
  pagesIdentical = false;
  gr_color(0, 0, 0, 255);
  gr_fill(0, 0, gr_fb_width(), gr_fb_height());
@@ -86,8 +81,7 @@ void WearRecoveryUI::draw_background_locked()
      } else {
        surface = loopFrames[current_frame];
      }
        }
        else {
    } else {
      surface = backgroundIcon[currentIcon];
    }

@@ -109,8 +103,7 @@ static const char* HEADERS[] = {
};

// TODO merge drawing routines with screen_ui
void WearRecoveryUI::draw_screen_locked()
{
void WearRecoveryUI::draw_screen_locked() {
  char cur_selection_str[50];

  draw_background_locked();
@@ -148,7 +141,6 @@ void WearRecoveryUI::draw_screen_locked()
      SetColor(MENU);

      for (int i = menu_start; i < menu_end; ++i) {

        if (i == menu_sel) {
          // draw the highlight bar
          SetColor(MENU_SEL_BG);
@@ -178,8 +170,7 @@ void WearRecoveryUI::draw_screen_locked()
    int ty;
    int row = (text_top_ + text_rows_ - 1) % text_rows_;
    size_t count = 0;
        for (int ty = gr_fb_height() - char_height_ - outer_height;
             ty > y + 2 && count < text_rows_;
    for (int ty = gr_fb_height() - char_height_ - outer_height; ty > y + 2 && count < text_rows_;
         ty -= char_height_, ++count) {
      gr_text(gr_sys_font(), x + 4, ty, text_[row], 0);
      --row;
@@ -222,7 +213,8 @@ bool WearRecoveryUI::Init(const std::string& locale) {
  return true;
}

void WearRecoveryUI::SetStage(int current, int max) {}
void WearRecoveryUI::SetStage(int current, int max) {
}

void WearRecoveryUI::Print(const char* fmt, ...) {
  char buf[256];
@@ -272,8 +264,7 @@ void WearRecoveryUI::StartMenu(const char* const * headers, const char* const *
    menu_sel = initial_selection;
    menu_start = 0;
    menu_end = visible_text_rows - 1 - menu_unusable_rows;
        if (menu_items <= menu_end)
          menu_end = menu_items;
    if (menu_items <= menu_end) menu_end = menu_items;
    update_screen_locked();
  }
  pthread_mutex_unlock(&updateMutex);
+148 −148

File changed.

Contains only whitespace changes.

+8 −8

File changed.

Contains only whitespace changes.

+40 −40

File changed.

Contains only whitespace changes.

Loading