From 5b468fc9305bf3adef681fa1e56364fc51761af8 Mon Sep 17 00:00:00 2001 From: yetta_wu Date: Tue, 25 Jun 2013 15:03:11 +0800 Subject: recovery: init backgroundIcon properly to avoid recovery mode crash We met factory issue that some devices would crash in recovery mode because the backgroundIcon array did not reset to NULL when initializing. Bug: 9568624 Change-Id: I13c7a7cc1053a7ffdbadd71740c1a2b4a2af6bba Signed-off-by: yetta_wu Signed-off-by: Iliyan Malchev --- screen_ui.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'screen_ui.cpp') diff --git a/screen_ui.cpp b/screen_ui.cpp index 222de00ee..93e260936 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -82,6 +82,10 @@ ScreenRecoveryUI::ScreenRecoveryUI() : install_overlay_offset_y(190), overlay_offset_x(-1), overlay_offset_y(-1) { + + for (int i = 0; i < 5; i++) + backgroundIcon[i] = NULL; + pthread_mutex_init(&updateMutex, NULL); self = this; } -- cgit v1.2.3 From c0441d171914e59941ec4f815ae0aabf56d6504f Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 31 Jul 2013 11:28:24 -0700 Subject: notify about pending long press Recovery changes: - add a method to the UI class that is called when a key is held down long enough to be a "long press" (but before it is released). Device-specific subclasses can override this to indicate a long press. - do color selection for ScreenRecoveryUI's menu-and-log drawing function. Subclasses can override this to customize the colors they use for various elements. - Include the value of ro.build.display.id in the menu headers, so you can see on the screen what version of recovery you are running. Change-Id: I426a6daf892b9011638e2035aebfa2831d4f596d --- screen_ui.cpp | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'screen_ui.cpp') diff --git a/screen_ui.cpp b/screen_ui.cpp index 93e260936..6a638582e 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -196,9 +196,29 @@ void ScreenRecoveryUI::draw_progress_locked() } } -#define C_HEADER 247,0,6 -#define C_MENU 0,106,157 -#define C_LOG 249,194,0 +void ScreenRecoveryUI::SetColor(UIElement e) { + switch (e) { + case HEADER: + gr_color(247, 0, 6, 255); + break; + case MENU: + case MENU_SEL_BG: + gr_color(0, 106, 157, 255); + break; + case MENU_SEL_FG: + gr_color(255, 255, 255, 255); + break; + case LOG: + gr_color(249, 194, 0, 255); + break; + case TEXT_FILL: + gr_color(0, 0, 0, 160); + break; + default: + gr_color(255, 255, 255, 255); + break; + } +} // Redraw everything on the screen. Does not flip pages. // Should only be called with updateMutex locked. @@ -208,37 +228,38 @@ void ScreenRecoveryUI::draw_screen_locked() draw_progress_locked(); if (show_text) { - gr_color(0, 0, 0, 160); + SetColor(TEXT_FILL); gr_fill(0, 0, gr_fb_width(), gr_fb_height()); int y = 0; int i = 0; if (show_menu) { - gr_color(C_HEADER, 255); + SetColor(HEADER); for (; i < menu_top + menu_items; ++i) { - if (i == menu_top) gr_color(C_MENU, 255); + if (i == menu_top) SetColor(MENU); if (i == menu_top + menu_sel) { // draw the highlight bar + SetColor(MENU_SEL_BG); gr_fill(0, y-2, gr_fb_width(), y+char_height+2); // white text of selected item - gr_color(255, 255, 255, 255); + SetColor(MENU_SEL_FG); if (menu[i][0]) gr_text(4, y, menu[i], 1); - gr_color(C_MENU, 255); + SetColor(MENU); } else { if (menu[i][0]) gr_text(4, y, menu[i], i < menu_top); } y += char_height+4; } - gr_color(C_MENU, 255); + SetColor(MENU); y += 4; gr_fill(0, y, gr_fb_width(), y+2); y += 4; ++i; } - gr_color(C_LOG, 255); + SetColor(LOG); // display from the bottom up, until we hit the top of the // screen, the bottom of the menu, or we've displayed the @@ -585,3 +606,10 @@ void ScreenRecoveryUI::ShowText(bool visible) update_screen_locked(); pthread_mutex_unlock(&updateMutex); } + +void ScreenRecoveryUI::Redraw() +{ + pthread_mutex_lock(&updateMutex); + update_screen_locked(); + pthread_mutex_unlock(&updateMutex); +} -- cgit v1.2.3 From 239ac6abac4524be93fce710360c0512c6cc2ab3 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 20 Aug 2013 16:03:25 -0700 Subject: recovery: install packages in a known mount environment When installing a package, we should have /tmp and /cache mounted and nothing else. Ensure this is true by explicitly mounting them and unmounting everything else as the first step of every install. Also fix an error in the progress bar that crops up when you do multiple package installs in one instance of recovery. Change-Id: I4837ed707cb419ddd3d9f6188b6355ba1bcfe2b2 --- screen_ui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'screen_ui.cpp') diff --git a/screen_ui.cpp b/screen_ui.cpp index 6a638582e..8376341c3 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -467,10 +467,11 @@ void ScreenRecoveryUI::SetProgressType(ProgressType type) pthread_mutex_lock(&updateMutex); if (progressBarType != type) { progressBarType = type; - update_progress_locked(); } progressScopeStart = 0; + progressScopeSize = 0; progress = 0; + update_progress_locked(); pthread_mutex_unlock(&updateMutex); } -- cgit v1.2.3