aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-06-24 00:23:50 -0500
committerTao Bao2017-06-24 01:05:56 -0500
commit5d2e3bd109539282d1829e3579c1f762a9486382 (patch)
tree224611c8cb4d143c5df8e91b3f0ddc4ac4be3d1d /screen_ui.h
parent20d40ce53a99d7d5596e76f23921aef130795fc0 (diff)
downloadplatform-bootable-recovery-5d2e3bd109539282d1829e3579c1f762a9486382.tar.gz
platform-bootable-recovery-5d2e3bd109539282d1829e3579c1f762a9486382.tar.xz
platform-bootable-recovery-5d2e3bd109539282d1829e3579c1f762a9486382.zip
Formatting RecoveryUI related files.
All cosmetic changes about indentation reformatting in this CL. Test: mmma bootable/recovery Change-Id: I4539e6244697d1f356b7eb10b961b52d7db561f7
Diffstat (limited to 'screen_ui.h')
-rw-r--r--screen_ui.h216
1 files changed, 111 insertions, 105 deletions
diff --git a/screen_ui.h b/screen_ui.h
index 2500575c..2a3d8c30 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -30,152 +30,158 @@ struct GRSurface;
30// Implementation of RecoveryUI appropriate for devices with a screen 30// Implementation of RecoveryUI appropriate for devices with a screen
31// (shows an icon + a progress bar, text logging, menu, etc.) 31// (shows an icon + a progress bar, text logging, menu, etc.)
32class ScreenRecoveryUI : public RecoveryUI { 32class ScreenRecoveryUI : public RecoveryUI {
33 public: 33 public:
34 ScreenRecoveryUI(); 34 ScreenRecoveryUI();
35 35
36 bool Init(const std::string& locale) override; 36 bool Init(const std::string& locale) override;
37 37
38 // overall recovery state ("background image") 38 // overall recovery state ("background image")
39 void SetBackground(Icon icon); 39 void SetBackground(Icon icon);
40 void SetSystemUpdateText(bool security_update); 40 void SetSystemUpdateText(bool security_update);
41 41
42 // progress indicator 42 // progress indicator
43 void SetProgressType(ProgressType type) override; 43 void SetProgressType(ProgressType type) override;
44 void ShowProgress(float portion, float seconds) override; 44 void ShowProgress(float portion, float seconds) override;
45 void SetProgress(float fraction) override; 45 void SetProgress(float fraction) override;
46 46
47 void SetStage(int current, int max) override; 47 void SetStage(int current, int max) override;
48 48
49 // text log 49 // text log
50 void ShowText(bool visible) override; 50 void ShowText(bool visible) override;
51 bool IsTextVisible() override; 51 bool IsTextVisible() override;
52 bool WasTextEverVisible() override; 52 bool WasTextEverVisible() override;
53 53
54 // printing messages 54 // printing messages
55 void Print(const char* fmt, ...) __printflike(2, 3); 55 void Print(const char* fmt, ...) __printflike(2, 3);
56 void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3); 56 void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3);
57 void ShowFile(const char* filename); 57 void ShowFile(const char* filename);
58 58
59 // menu display 59 // menu display
60 void StartMenu(const char* const * headers, const char* const * items, 60 void StartMenu(const char* const* headers, const char* const* items, int initial_selection);
61 int initial_selection); 61 int SelectMenu(int sel);
62 int SelectMenu(int sel); 62 void EndMenu();
63 void EndMenu();
64 63
65 void KeyLongPress(int); 64 void KeyLongPress(int);
66 65
67 void Redraw(); 66 void Redraw();
68 67
69 enum UIElement { 68 enum UIElement {
70 HEADER, MENU, MENU_SEL_BG, MENU_SEL_BG_ACTIVE, MENU_SEL_FG, LOG, TEXT_FILL, INFO 69 HEADER,
71 }; 70 MENU,
72 void SetColor(UIElement e); 71 MENU_SEL_BG,
72 MENU_SEL_BG_ACTIVE,
73 MENU_SEL_FG,
74 LOG,
75 TEXT_FILL,
76 INFO
77 };
78 void SetColor(UIElement e);
73 79
74 protected: 80 protected:
75 // The margin that we don't want to use for showing texts (e.g. round screen, or screen with 81 // The margin that we don't want to use for showing texts (e.g. round screen, or screen with
76 // rounded corners). 82 // rounded corners).
77 const int kMarginWidth; 83 const int kMarginWidth;
78 const int kMarginHeight; 84 const int kMarginHeight;
79 85
80 // The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi. 86 // The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi.
81 const float density_; 87 const float density_;
82 88
83 Icon currentIcon; 89 Icon currentIcon;
84 90
85 // The layout to use. 91 // The layout to use.
86 int layout_; 92 int layout_;
87 93
88 GRSurface* error_icon; 94 GRSurface* error_icon;
89 95
90 GRSurface* erasing_text; 96 GRSurface* erasing_text;
91 GRSurface* error_text; 97 GRSurface* error_text;
92 GRSurface* installing_text; 98 GRSurface* installing_text;
93 GRSurface* no_command_text; 99 GRSurface* no_command_text;
94 100
95 GRSurface** introFrames; 101 GRSurface** introFrames;
96 GRSurface** loopFrames; 102 GRSurface** loopFrames;
97 103
98 GRSurface* progressBarEmpty; 104 GRSurface* progressBarEmpty;
99 GRSurface* progressBarFill; 105 GRSurface* progressBarFill;
100 GRSurface* stageMarkerEmpty; 106 GRSurface* stageMarkerEmpty;
101 GRSurface* stageMarkerFill; 107 GRSurface* stageMarkerFill;
102 108
103 ProgressType progressBarType; 109 ProgressType progressBarType;
104 110
105 float progressScopeStart, progressScopeSize, progress; 111 float progressScopeStart, progressScopeSize, progress;
106 double progressScopeTime, progressScopeDuration; 112 double progressScopeTime, progressScopeDuration;
107 113
108 // true when both graphics pages are the same (except for the progress bar). 114 // true when both graphics pages are the same (except for the progress bar).
109 bool pagesIdentical; 115 bool pagesIdentical;
110 116
111 size_t text_cols_, text_rows_; 117 size_t text_cols_, text_rows_;
112 118
113 // Log text overlay, displayed when a magic key is pressed. 119 // Log text overlay, displayed when a magic key is pressed.
114 char** text_; 120 char** text_;
115 size_t text_col_, text_row_, text_top_; 121 size_t text_col_, text_row_, text_top_;
116 122
117 bool show_text; 123 bool show_text;
118 bool show_text_ever; // has show_text ever been true? 124 bool show_text_ever; // has show_text ever been true?
119 125
120 char** menu_; 126 char** menu_;
121 const char* const* menu_headers_; 127 const char* const* menu_headers_;
122 bool show_menu; 128 bool show_menu;
123 int menu_items, menu_sel; 129 int menu_items, menu_sel;
124 130
125 // An alternate text screen, swapped with 'text_' when we're viewing a log file. 131 // An alternate text screen, swapped with 'text_' when we're viewing a log file.
126 char** file_viewer_text_; 132 char** file_viewer_text_;
127 133
128 pthread_t progress_thread_; 134 pthread_t progress_thread_;
129 135
130 // Number of intro frames and loop frames in the animation. 136 // Number of intro frames and loop frames in the animation.
131 size_t intro_frames; 137 size_t intro_frames;
132 size_t loop_frames; 138 size_t loop_frames;
133 139
134 size_t current_frame; 140 size_t current_frame;
135 bool intro_done; 141 bool intro_done;
136 142
137 // Number of frames per sec (default: 30) for both parts of the animation. 143 // Number of frames per sec (default: 30) for both parts of the animation.
138 int animation_fps; 144 int animation_fps;
139 145
140 int stage, max_stage; 146 int stage, max_stage;
141 147
142 int char_width_; 148 int char_width_;
143 int char_height_; 149 int char_height_;
144 150
145 pthread_mutex_t updateMutex; 151 pthread_mutex_t updateMutex;
146 152
147 virtual bool InitTextParams(); 153 virtual bool InitTextParams();
148 154
149 virtual void draw_background_locked(); 155 virtual void draw_background_locked();
150 virtual void draw_foreground_locked(); 156 virtual void draw_foreground_locked();
151 virtual void draw_screen_locked(); 157 virtual void draw_screen_locked();
152 virtual void update_screen_locked(); 158 virtual void update_screen_locked();
153 virtual void update_progress_locked(); 159 virtual void update_progress_locked();
154 160
155 GRSurface* GetCurrentFrame(); 161 GRSurface* GetCurrentFrame();
156 GRSurface* GetCurrentText(); 162 GRSurface* GetCurrentText();
157 163
158 static void* ProgressThreadStartRoutine(void* data); 164 static void* ProgressThreadStartRoutine(void* data);
159 void ProgressThreadLoop(); 165 void ProgressThreadLoop();
160 166
161 virtual void ShowFile(FILE*); 167 virtual void ShowFile(FILE*);
162 virtual void PrintV(const char*, bool, va_list); 168 virtual void PrintV(const char*, bool, va_list);
163 void PutChar(char); 169 void PutChar(char);
164 void ClearText(); 170 void ClearText();
165 171
166 void LoadAnimation(); 172 void LoadAnimation();
167 void LoadBitmap(const char* filename, GRSurface** surface); 173 void LoadBitmap(const char* filename, GRSurface** surface);
168 void LoadLocalizedBitmap(const char* filename, GRSurface** surface); 174 void LoadLocalizedBitmap(const char* filename, GRSurface** surface);
169 175
170 int PixelsFromDp(int dp) const; 176 int PixelsFromDp(int dp) const;
171 virtual int GetAnimationBaseline(); 177 virtual int GetAnimationBaseline();
172 virtual int GetProgressBaseline(); 178 virtual int GetProgressBaseline();
173 virtual int GetTextBaseline(); 179 virtual int GetTextBaseline();
174 180
175 virtual void DrawHorizontalRule(int* y); 181 virtual void DrawHorizontalRule(int* y);
176 virtual void DrawHighlightBar(int x, int y, int width, int height) const; 182 virtual void DrawHighlightBar(int x, int y, int width, int height) const;
177 virtual void DrawTextLine(int x, int* y, const char* line, bool bold) const; 183 virtual void DrawTextLine(int x, int* y, const char* line, bool bold) const;
178 void DrawTextLines(int x, int* y, const char* const* lines) const; 184 void DrawTextLines(int x, int* y, const char* const* lines) const;
179}; 185};
180 186
181#endif // RECOVERY_UI_H 187#endif // RECOVERY_UI_H