From c049163234003ef463bca018920622bc8269c69b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 6 May 2015 12:40:05 -0700 Subject: Add an alternate screen for viewing recovery logs. This makes it easier to go back and forth without losing current output. Also make the display more like regular more(1). Bug: http://b/20834540 Change-Id: Icc5703e9c8a378cc7072d8ebb79e34451267ee1b --- screen_ui.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 46165d90c..ea05bf15f 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -89,18 +89,23 @@ class ScreenRecoveryUI : public RecoveryUI { // true when both graphics pages are the same (except for the progress bar). bool pagesIdentical; + size_t text_cols_, text_rows_; + // Log text overlay, displayed when a magic key is pressed. - char** text; - size_t text_cols, text_rows; - size_t text_col, text_row, text_top; + char** text_; + size_t text_col_, text_row_, text_top_; + bool show_text; bool show_text_ever; // has show_text ever been true? - char** menu; - const char* const* menu_headers; + char** menu_; + const char* const* menu_headers_; bool show_menu; int menu_items, menu_sel; + // An alternate text screen, swapped with 'text_' when we're viewing a log file. + char** file_viewer_text_; + pthread_t progress_thread_; int animation_fps; -- cgit v1.2.3 From b6918c7c433054ac4352d5f7746f7c2bf2971083 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 19 May 2015 17:02:16 -0700 Subject: Log update outputs in order Although stdout and stderr are both redirected to log file with no buffering, we are seeing some outputs are mixed in random order. This is because ui_print commands from the updater are passed to the recovery binary via a pipe, which may interleave with other outputs that go to stderr directly. In recovery, adding ui::PrintOnScreenOnly() function to handle ui_print command, which skips printing to stdout. Meanwhile, updater prints the contents to stderr in addition to piping them to recovery. Change-Id: Idda93ea940d2e23a0276bb8ead4aa70a3cb97700 --- screen_ui.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index ea05bf15f..8e18864d7 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -49,6 +49,7 @@ class ScreenRecoveryUI : public RecoveryUI { // printing messages void Print(const char* fmt, ...) __printflike(2, 3); + void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3); void ShowFile(const char* filename); // menu display @@ -125,6 +126,7 @@ class ScreenRecoveryUI : public RecoveryUI { void ProgressThreadLoop(); void ShowFile(FILE*); + void PrintV(const char*, bool, va_list); void PutChar(char); void ClearText(); -- cgit v1.2.3 From b723f4f38f53a38502abb1a63165ac0749bc9cd9 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Fri, 11 Dec 2015 15:18:51 -0800 Subject: res: Embed FPS into icon_installing.png. We allow vendor-specific icon installing image but have defined private animation_fps that can't be overridden. This CL changes the image generator to optionally embed FPS (otherwise use the default value of 20) into the generated image. For wear devices, they are using individual images instead of the interlaced one. Change the animation_fps from private to protected so that it can be customized. Bug: 26009230 Change-Id: I9fbf64ec717029d4c54f72316f6cb079e8dbfb5e --- screen_ui.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 8e18864d7..08a5f44a9 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -109,6 +109,8 @@ class ScreenRecoveryUI : public RecoveryUI { pthread_t progress_thread_; + // The following two are parsed from the image file + // (e.g. '/res/images/icon_installing.png'). int animation_fps; int installing_frames; @@ -135,7 +137,7 @@ class ScreenRecoveryUI : public RecoveryUI { void DrawTextLines(int* y, const char* const* lines); void LoadBitmap(const char* filename, GRSurface** surface); - void LoadBitmapArray(const char* filename, int* frames, GRSurface*** surface); + void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface); void LoadLocalizedBitmap(const char* filename, GRSurface** surface); }; -- cgit v1.2.3 From 1c7b2230d8aac9f064f68c48b6aa26aca000cc9d Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Tue, 8 Mar 2016 15:23:51 -0800 Subject: recovery: More refactoring of WearUI This patch performs the following modifications: - Remove setBackground function, and currentIcon member variable. - Remove common Progress*, Redraw and EndMenu functions. Bug: 27407422 Change-Id: Ic3c0e16b67941484c3bc1d04c9b61288e8896808 Signed-off-by: Prashant Malani --- screen_ui.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 08a5f44a9..386deac2d 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -68,7 +68,6 @@ class ScreenRecoveryUI : public RecoveryUI { void SetColor(UIElement e); private: - Icon currentIcon; int installingFrame; const char* locale; bool rtl_locale; @@ -139,6 +138,8 @@ class ScreenRecoveryUI : public RecoveryUI { void LoadBitmap(const char* filename, GRSurface** surface); void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface); void LoadLocalizedBitmap(const char* filename, GRSurface** surface); + protected: + Icon currentIcon; }; #endif // RECOVERY_UI_H -- cgit v1.2.3 From f7f9e50528761022989c4f0cac6a92716b54674f Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Thu, 10 Mar 2016 03:40:20 +0000 Subject: Revert "recovery: More refactoring of WearUI" This reverts commit 1c7b2230d8aac9f064f68c48b6aa26aca000cc9d. This change can lead to the derived class indirectly (and incorrectly) calling some functions from the base class, which can lead to unpredictable behavior. Bug: 27407422 Change-Id: I126a7489b0787dc195e942e2ceea6769de20d70c --- screen_ui.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 386deac2d..08a5f44a9 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -68,6 +68,7 @@ class ScreenRecoveryUI : public RecoveryUI { void SetColor(UIElement e); private: + Icon currentIcon; int installingFrame; const char* locale; bool rtl_locale; @@ -138,8 +139,6 @@ class ScreenRecoveryUI : public RecoveryUI { void LoadBitmap(const char* filename, GRSurface** surface); void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface); void LoadLocalizedBitmap(const char* filename, GRSurface** surface); - protected: - Icon currentIcon; }; #endif // RECOVERY_UI_H -- cgit v1.2.3 From 0ba21cff07ceafeaa43e17aa26e341d961f6f29f Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Thu, 10 Mar 2016 14:51:25 -0800 Subject: recovery: Remove duplicate variables and functions The function that modifies rtl_locale exists only in the base class, and so the variable should not have a duplicate in the derived class, otherwise there may be incosistent values when it is read by the derived class (the thinking being that invoking the function will modify the base class version of the variable, and not the derived class version). Remove the updateMutex variable, and instead re-use the one in the base class. Also remove LoadBitmap from WearUI since it is identical to the one in ScreenRecoveryUI. Bug: 27407422 Change-Id: Idd823fa93dfa16d7b2c9c7160f8d0c2559d28731 --- screen_ui.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 08a5f44a9..6d1191087 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -71,9 +71,7 @@ class ScreenRecoveryUI : public RecoveryUI { Icon currentIcon; int installingFrame; const char* locale; - bool rtl_locale; - pthread_mutex_t updateMutex; GRSurface* backgroundIcon[5]; GRSurface* backgroundText[5]; GRSurface** installation; @@ -136,9 +134,12 @@ class ScreenRecoveryUI : public RecoveryUI { void DrawTextLine(int* y, const char* line, bool bold); void DrawTextLines(int* y, const char* const* lines); - void LoadBitmap(const char* filename, GRSurface** surface); void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface); void LoadLocalizedBitmap(const char* filename, GRSurface** surface); + protected: + pthread_mutex_t updateMutex; + bool rtl_locale; + void LoadBitmap(const char* filename, GRSurface** surface); }; #endif // RECOVERY_UI_H -- cgit v1.2.3 From 7a491225bbbb24593a4eda5dabe2fc1850d60dd1 Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Fri, 11 Mar 2016 10:00:55 -0800 Subject: recovery: Remove SetColor, and other refactoring for WearUI The only difference from SetColor in ScreenRecoveryUI is the that the LOG messages have slightly different colors. That's not enough to warrant a duplicate function. So this patch removes SetColor and uses the parent class version. This patch also moves the DrawTextLine* functions into ScreenRecoveryUI since they're mostly the same. It also moves char_width and char_height into the class instead of keeping them as static variables. Bug: 27407422 Change-Id: I30428c9433baab8410cf710a01c9b1c44c217bf1 --- screen_ui.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 6d1191087..9e1b2dfa1 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -131,15 +131,17 @@ class ScreenRecoveryUI : public RecoveryUI { void ClearText(); void DrawHorizontalRule(int* y); - void DrawTextLine(int* y, const char* line, bool bold); - void DrawTextLines(int* y, const char* const* lines); void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface); void LoadLocalizedBitmap(const char* filename, GRSurface** surface); protected: + int char_width_; + int char_height_; pthread_mutex_t updateMutex; bool rtl_locale; void LoadBitmap(const char* filename, GRSurface** surface); + void DrawTextLine(int x, int* y, const char* line, bool bold); + void DrawTextLines(int x, int* y, const char* const* lines); }; #endif // RECOVERY_UI_H -- cgit v1.2.3 From 498cda6ef6c610efb055221d6c689185d49447bb Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 14 Apr 2016 16:49:04 -0700 Subject: Update the system update animation. Switch to a Wear-like intro/loop system. We don't have an intro yet, but hopefully this will let Wear delete more code when they move to N. Unlike them, we don't hard-code the number of frames: we just look to see what we have available. We do hard-code the fps though. Also add a graphics test mode so you can see a demo of the UI components without having to actually apply an OTA. Also fix a bug where default locale is null rather than en-US: it's more useful to show _some_ text if we don't have a locale (which should only be during development anyway). Bug: http://b/26548285 Change-Id: I63422e3fef3c41109f924d96fb5ded0b3ae7815d --- screen_ui.h | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 9e1b2dfa1..233ff55e6 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -67,14 +67,23 @@ class ScreenRecoveryUI : public RecoveryUI { }; void SetColor(UIElement e); - private: + protected: Icon currentIcon; - int installingFrame; + const char* locale; + bool intro_done; + int current_frame; + + GRSurface* error_icon; + + GRSurface* erasing_text; + GRSurface* error_text; + GRSurface* installing_text; + GRSurface* no_command_text; + + GRSurface** introFrames; + GRSurface** loopFrames; - GRSurface* backgroundIcon[5]; - GRSurface* backgroundText[5]; - GRSurface** installation; GRSurface* progressBarEmpty; GRSurface* progressBarFill; GRSurface* stageMarkerEmpty; @@ -107,21 +116,31 @@ class ScreenRecoveryUI : public RecoveryUI { pthread_t progress_thread_; - // The following two are parsed from the image file - // (e.g. '/res/images/icon_installing.png'). + // Number of intro frames and loop frames in the animation. + int intro_frames; + int loop_frames; + + // Number of frames per sec (default: 30) for both parts of the animation. int animation_fps; - int installing_frames; int iconX, iconY; int stage, max_stage; - void draw_background_locked(Icon icon); + int char_width_; + int char_height_; + pthread_mutex_t updateMutex; + bool rtl_locale; + + void draw_background_locked(); void draw_progress_locked(); void draw_screen_locked(); void update_screen_locked(); void update_progress_locked(); + GRSurface* GetCurrentFrame(); + GRSurface* GetCurrentText(); + static void* ProgressThreadStartRoutine(void* data); void ProgressThreadLoop(); @@ -130,16 +149,11 @@ class ScreenRecoveryUI : public RecoveryUI { void PutChar(char); void ClearText(); - void DrawHorizontalRule(int* y); - - void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface); - void LoadLocalizedBitmap(const char* filename, GRSurface** surface); - protected: - int char_width_; - int char_height_; - pthread_mutex_t updateMutex; - bool rtl_locale; + void LoadAnimation(); void LoadBitmap(const char* filename, GRSurface** surface); + void LoadLocalizedBitmap(const char* filename, GRSurface** surface); + + void DrawHorizontalRule(int* y); void DrawTextLine(int x, int* y, const char* line, bool bold); void DrawTextLines(int x, int* y, const char* const* lines); }; -- cgit v1.2.3 From faf36e04ed6f7e7b92a90ce7fc4ecc113eee4993 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 20 Apr 2016 17:22:16 -0700 Subject: Update recovery UI. * Use new animation. * Use new non-holo progress bars. * Use recommended spacing for recovery UI. Bug: http://b/26548285 Change-Id: I8411e89d6a6a9ce638b8645e19e5082d0d968cee --- screen_ui.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 233ff55e6..d8ac85bea 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -74,6 +74,11 @@ class ScreenRecoveryUI : public RecoveryUI { bool intro_done; int current_frame; + // The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi. + float density_; + // True if we should use the large layout. + bool is_large_; + GRSurface* error_icon; GRSurface* erasing_text; @@ -123,8 +128,6 @@ class ScreenRecoveryUI : public RecoveryUI { // Number of frames per sec (default: 30) for both parts of the animation. int animation_fps; - int iconX, iconY; - int stage, max_stage; int char_width_; @@ -133,7 +136,7 @@ class ScreenRecoveryUI : public RecoveryUI { bool rtl_locale; void draw_background_locked(); - void draw_progress_locked(); + void draw_foreground_locked(); void draw_screen_locked(); void update_screen_locked(); void update_progress_locked(); @@ -153,6 +156,11 @@ class ScreenRecoveryUI : public RecoveryUI { void LoadBitmap(const char* filename, GRSurface** surface); void LoadLocalizedBitmap(const char* filename, GRSurface** surface); + int PixelsFromDp(int dp); + int GetAnimationBaseline(); + int GetProgressBaseline(); + int GetTextBaseline(); + void DrawHorizontalRule(int* y); void DrawTextLine(int x, int* y, const char* line, bool bold); void DrawTextLines(int x, int* y, const char* const* lines); -- cgit v1.2.3 From 35926c4b89f9dc51f3e55ef03a61e4da6dcb34be Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 28 Apr 2016 18:06:26 -0700 Subject: Add ability to show "installing security update" Add a new command "--security" to boot commands. If this command is observed as part of BCB, choose a different background text picture for installing stage in recovery UI. As a result, users will see "installing security update" instead of "installing system update" when applying a security update package. Bug: 27837319 Change-Id: I2e2253a124993ecc24804fa1ee0b918ac96837c5 --- screen_ui.h | 1 + 1 file changed, 1 insertion(+) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index d8ac85bea..4319b76ce 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -34,6 +34,7 @@ class ScreenRecoveryUI : public RecoveryUI { // overall recovery state ("background image") void SetBackground(Icon icon); + void SetSystemUpdateText(bool security_update); // progress indicator void SetProgressType(ProgressType type); -- cgit v1.2.3