void ScreenRecoveryUI::Init() { gr_init(); gr_set_font("log"); gr_font_size(&log_char_width, &log_char_height); gr_set_font("menu"); gr_font_size(&char_width, &char_height); log_text_rows = gr_fb_height() / log_char_height; log_text_cols = gr_fb_width() / log_char_width; text_col = text_row = 0; text_rows = gr_fb_height() / char_height; if (max_menu_rows > kMaxMenuRows) max_menu_rows = kMaxMenuRows; if (text_rows > kMaxRows) text_rows = kMaxRows; text_top = 1; text_cols = gr_fb_width() / char_width; if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1; ScreenRecoveryUI::InitIcons(); text_first_row = (header_height / char_height) + 1; menu_item_start = text_first_row * char_height; max_menu_rows = (text_rows - text_first_row) / 3; pthread_create(&progress_t, NULL, progress_thread, NULL); RecoveryUI::Init(); }
void ScreenRecoveryUI::Init() { gr_init(); gr_set_font("log"); gr_font_size(&log_char_width, &log_char_height); gr_set_font("menu"); gr_font_size(&char_width, &char_height); log_text_rows = gr_fb_height() / log_char_height; log_text_cols = gr_fb_width() / log_char_width; text_col = text_row = 0; text_rows = gr_fb_height() / char_height; if (max_menu_rows > kMaxMenuRows) max_menu_rows = kMaxMenuRows; if (text_rows > kMaxRows) text_rows = kMaxRows; text_top = 1; text_cols = gr_fb_width() / char_width; if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1; LoadBitmap("icon_header", &headerIcon); header_height = gr_get_height(headerIcon); header_width = gr_get_width(headerIcon); text_first_row = (header_height / char_height) + 1; menu_item_start = text_first_row * char_height; max_menu_rows = (text_rows - text_first_row) / 3; backgroundIcon[NONE] = NULL; LoadBitmapArray("icon_installing", &installing_frames, &installation); backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : NULL; backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_info", &backgroundIcon[INFO]); LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = NULL; LoadBitmap("icon_headless", &backgroundIcon[HEADLESS]); LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadBitmap("stage_empty", &stageMarkerEmpty); LoadBitmap("stage_fill", &stageMarkerFill); LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]); LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]); LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]); LoadLocalizedBitmap("error_text", &backgroundText[ERROR]); pthread_create(&progress_t, NULL, progress_thread, NULL); RecoveryUI::Init(); }
void ScreenRecoveryUI::Init() { gr_init(); gr_font_size(&char_width, &char_height); text_rows_ = gr_fb_height() / char_height; text_cols_ = gr_fb_width() / char_width; 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; backgroundIcon[NONE] = nullptr; LoadBitmapArray("icon_installing", &installing_frames, &installation); backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : nullptr; backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadBitmap("stage_empty", &stageMarkerEmpty); LoadBitmap("stage_fill", &stageMarkerFill); LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]); LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]); LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]); LoadLocalizedBitmap("error_text", &backgroundText[ERROR]); pthread_create(&progress_thread_, nullptr, ProgressThreadStartRoutine, this); RecoveryUI::Init(); }
void ScreenRecoveryUI::draw_dialog() { int x, y, w, h; if (dialog_icon == HEADLESS) { return; } draw_header_icon(); int iconHeight = gr_get_height(backgroundIcon[dialog_icon]); x = (gr_fb_width()/2 - (char_width*strlen(dialog_text))/2); if (dialog_show_log) { y = gr_get_height(headerIcon) + char_height; } else { y = (gr_fb_height()/2 + iconHeight/2); } SetColor(ERROR_TEXT); gr_text(x, y, dialog_text, 0); y += char_height+2; if (dialog_show_log) { int cx, cy; gr_set_font("log"); gr_font_size(&cx, &cy); int row; for (row = 0; row < log_text_rows; ++row) { gr_text(4, y, text[row], 0); y += cy+2; } gr_set_font("menu"); } if (dialog_icon == ERROR) { /* * This could be improved... * * Draw rect around text "Okay". * Text is centered horizontally. * Bottom of text is 4 lines from bottom of screen. * Rect width 4px * Rect padding 8px */ w = char_width*4; h = char_height; x = gr_fb_width()/2 - w/2; y = gr_fb_height() - h - 4*char_height; SetColor(HEADER); gr_fill(x-(4+8), y-(4+8), x+w+(4+8), y+h+(4+8)); SetColor(MENU_SEL_BG); gr_fill(x-8, y-8, x+w+8, y+h+8); SetColor(MENU_SEL_FG); gr_text(x, y, "Okay", 0); } }
void ScreenRecoveryUI::Init() { gr_init(); gr_font_size(&char_width, &char_height); text_col = text_row = 0; text_rows = gr_fb_height() / char_height; if (text_rows > kMaxRows) text_rows = kMaxRows; text_top = 1; text_cols = gr_fb_width() / char_width; if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1; LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]); backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]); LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]); LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]); LoadLocalizedBitmap("error_text", &backgroundText[ERROR]); int i; progressBarIndeterminate = (gr_surface*)malloc(indeterminate_frames * sizeof(gr_surface)); for (i = 0; i < indeterminate_frames; ++i) { char filename[40]; // "indeterminate01.png", "indeterminate02.png", ... sprintf(filename, "indeterminate%02d", i+1); LoadBitmap(filename, progressBarIndeterminate+i); } if (installing_frames > 0) { installationOverlay = (gr_surface*)malloc(installing_frames * sizeof(gr_surface)); for (i = 0; i < installing_frames; ++i) { char filename[40]; // "icon_installing_overlay01.png", // "icon_installing_overlay02.png", ... sprintf(filename, "icon_installing_overlay%02d", i+1); LoadBitmap(filename, installationOverlay+i); } } else { installationOverlay = NULL; } pthread_create(&progress_t, NULL, progress_thread, NULL); RecoveryUI::Init(); }
// Redraw everything on the screen. Does not flip pages. // Should only be called with updateMutex locked. void ScreenRecoveryUI::draw_screen_locked() { draw_background_locked(currentIcon); if (DialogShowing()) { draw_dialog(); return; } SetColor(MENU); if (show_text) { if (currentIcon != ERASING && currentIcon != INSTALLING_UPDATE) draw_header_icon(); if (currentIcon == ERASING || currentIcon == INSTALLING_UPDATE || currentIcon == VIEWING_LOG) { int y = currentIcon == INSTALLING_UPDATE ? gr_fb_height() / 4 : header_height + 4; SetColor(LOG); int cx, cy; gr_set_font("log"); gr_font_size(&cx, &cy); // display from the bottom up, until we hit the top of the // screen or we've displayed the entire text buffer. int row = (text_first_row+log_text_rows-1) % log_text_rows; for (int ty = gr_fb_height() - cy, count = 0; ty > y+2 && count < log_text_rows; ty -= (cy+2), ++count) { gr_text(4, ty, text[row], 0); --row; if (row < 0) row = log_text_rows-1; } return; } if (show_menu) { gr_set_font("menu"); int nr_items = menu_items - menu_show_start; if (nr_items > max_menu_rows) nr_items = max_menu_rows; for (int i = 0; i < nr_items; ++i) { draw_menu_item(text_first_row + 3*i, menu[menu_show_start+i], ((menu_show_start+i) == menu_sel)); } } } }
void healthd_board_mode_charger_draw_battery( struct android::BatteryProperties *batt_prop) { char cap_str[STR_LEN]; int x, y; int str_len_px; static int char_height = -1, char_width = -1; if (char_height == -1 && char_width == -1) gr_font_size(gr_sys_font(), &char_width, &char_height); snprintf(cap_str, (STR_LEN - 1), "%d%%", batt_prop->batteryLevel); str_len_px = gr_measure(gr_sys_font(), cap_str); x = (gr_fb_width() - str_len_px) / 2; y = (gr_fb_height() + char_height) / 2; gr_color(0, 0, 0, 255); gr_text(gr_sys_font(), x, y, cap_str, 0); }
void ScreenRecoveryUI::Init() { gr_init(); gr_font_size(&char_width, &char_height); #ifdef MTK_WEARABLE_PLATFORM text_rows_ = gr_fb_height() / char_height; #else //tony.kuo 2013-12-23: Subtract some rows so screen could support number of text_rows text_rows_ = ((gr_fb_height() / char_height) - 10) ; #endif text_cols_ = gr_fb_width() / char_width; 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; backgroundIcon[NONE] = nullptr; LoadBitmapArray("icon_installing", &installing_frames, &installation); backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : nullptr; backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadBitmap("stage_empty", &stageMarkerEmpty); LoadBitmap("stage_fill", &stageMarkerFill); LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]); LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]); LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]); LoadLocalizedBitmap("error_text", &backgroundText[ERROR]); pthread_create(&progress_thread_, nullptr, ProgressThreadStartRoutine, this); RecoveryUI::Init(); }
void ScreenRecoveryUI::Init() { gr_init(); density_ = static_cast<float>(property_get_int32("ro.sf.lcd_density", 160)) / 160.f; is_large_ = gr_fb_height() > PixelsFromDp(800); gr_font_size(&char_width_, &char_height_); text_rows_ = gr_fb_height() / char_height_; text_cols_ = gr_fb_width() / char_width_; 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; LoadBitmap("icon_error", &error_icon); LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadBitmap("stage_empty", &stageMarkerEmpty); LoadBitmap("stage_fill", &stageMarkerFill); // Background text for "installing_update" could be "installing update" // or "installing security update". It will be set after UI init according // to commands in BCB. installing_text = nullptr; LoadLocalizedBitmap("erasing_text", &erasing_text); LoadLocalizedBitmap("no_command_text", &no_command_text); LoadLocalizedBitmap("error_text", &error_text); LoadAnimation(); pthread_create(&progress_thread_, nullptr, ProgressThreadStartRoutine, this); RecoveryUI::Init(); }
void ScreenRecoveryUI::Init() { gr_init(); gr_font_size(&char_width, &char_height); text_col = text_row = 0; //tony.kuo 2013-12-23: Subtract some rows so screen could support number of text_rows text_rows = ((gr_fb_height() / char_height) - 10) ; if (text_rows > kMaxRows) text_rows = kMaxRows; text_top = 1; text_cols = gr_fb_width() / char_width; if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1; backgroundIcon[NONE] = NULL; LoadBitmapArray("icon_installing", &installing_frames, &installation); backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : NULL; backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadBitmap("stage_empty", &stageMarkerEmpty); LoadBitmap("stage_fill", &stageMarkerFill); LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]); LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]); LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]); LoadLocalizedBitmap("error_text", &backgroundText[ERROR]); pthread_create(&progress_t, NULL, progress_thread, NULL); RecoveryUI::Init(); }
void ScreenRecoveryUI::Init() { gr_init(); gr_font_size(&char_width, &char_height); text_col = text_row = 0; text_rows = gr_fb_height() / char_height; if (text_rows > kMaxRows) text_rows = kMaxRows; text_top = 1; text_cols = gr_fb_width() / char_width; if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1; backgroundIcon[NONE] = NULL; LoadBitmapArray("icon_installing", &installing_frames, &installation); backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : NULL; backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; LoadBitmap("progress_empty", &progressBarEmpty); LoadBitmap("progress_fill", &progressBarFill); LoadBitmap("stage_empty", &stageMarkerEmpty); LoadBitmap("stage_fill", &stageMarkerFill); LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]); LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]); LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]); LoadLocalizedBitmap("error_text", &backgroundText[ERROR]); // MStar Android Patch Begin //load title/tip bitmaps ,added by mstar semiconductor LoadBitmap("title_not_power_off",&titleNotPowerOff); LoadBitmap("title_not_unplug",&titleNotUnplug); LoadBitmap("tip_error", &tipTitle[TIP_TITLE_ERROR]); LoadBitmap("tip_ready", &tipTitle[TIP_TITLE_READY]); LoadBitmap("tip_success", &tipTitle[TIP_TITLE_SUCCESS]); LoadBitmap("tip_wipe_cache", &tipTitle[TIP_TITLE_WIPE_CACHE]); LoadBitmap("tip_wipe_data", &tipTitle[TIP_TITLE_WIPE_DATA]); LoadBitmap("tip_install_package", &tipTitle[TIP_TITLE_INSTALL_PACKAGE]); LoadBitmap("tip_backup_system", &tipTitle[TIP_TITLE_BACKUP_SYSTEM]); LoadBitmap("tip_restore_system", &tipTitle[TIP_TITLE_RESTORE_SYSTEM]); LoadBitmap("tip_blank_screen", &tipTitle[TIP_TITLE_BLANK_SCREEN]); // init exit recovery tip picture int j=0; char tipFileNmae[40]; exitRecoveryTipTitle = (gr_surface*)malloc(exitRecoveryTipTitleNum * sizeof(gr_surface)); for (j = 0;j < exitRecoveryTipTitleNum;++j) { // "tip_exit_recovery_1.png", "tip_exit_recovery_2.png", ... sprintf(tipFileNmae, "tip_exit_recovery_%d", j+1); LoadBitmap(tipFileNmae, exitRecoveryTipTitle+j); } // MStar Android Patch End pthread_create(&progress_t, NULL, progress_thread, NULL); RecoveryUI::Init(); }