aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSen Jiang2016-12-09 18:20:49 -0600
committerSen Jiang2016-12-13 15:29:33 -0600
commitd530449e54bd327e9c26209ffa0490c6508afe6c (patch)
tree0b1d25af5cad4e0e4b1035b5dad3a86c06835e0a /wear_ui.cpp
parentd6a5005fcb1f2ea6cfbdcb424497b626aeab7e16 (diff)
downloadplatform-bootable-recovery-d530449e54bd327e9c26209ffa0490c6508afe6c.tar.gz
platform-bootable-recovery-d530449e54bd327e9c26209ffa0490c6508afe6c.tar.xz
platform-bootable-recovery-d530449e54bd327e9c26209ffa0490c6508afe6c.zip
Add a stub recovery UI.
This allows recovery to work on devices without screen. The stub recovery UI does nothing except print to stdout. Test: write 'recovery\n--wipe_data\n--reason=wipe_data_from_ota\n' to misc and boot to recovery on a device without screen. Bug: 33175036 Change-Id: Icde698aa2e2e29f4b3d0532dfd3c6a939ac2bc63
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 0918ac45..11e5a716 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -190,8 +190,10 @@ void WearRecoveryUI::update_progress_locked() {
190 gr_flip(); 190 gr_flip();
191} 191}
192 192
193void WearRecoveryUI::InitTextParams() { 193bool WearRecoveryUI::InitTextParams() {
194 ScreenRecoveryUI::InitTextParams(); 194 if (!ScreenRecoveryUI::InitTextParams()) {
195 return false;
196 }
195 197
196 text_cols_ = (gr_fb_width() - (outer_width * 2)) / char_width_; 198 text_cols_ = (gr_fb_width() - (outer_width * 2)) / char_width_;
197 199
@@ -199,15 +201,19 @@ void WearRecoveryUI::InitTextParams() {
199 if (text_cols_ > kMaxCols) text_cols_ = kMaxCols; 201 if (text_cols_ > kMaxCols) text_cols_ = kMaxCols;
200 202
201 visible_text_rows = (gr_fb_height() - (outer_height * 2)) / char_height_; 203 visible_text_rows = (gr_fb_height() - (outer_height * 2)) / char_height_;
204 return true;
202} 205}
203 206
204void WearRecoveryUI::Init() { 207bool WearRecoveryUI::Init() {
205 ScreenRecoveryUI::Init(); 208 if (!ScreenRecoveryUI::Init()) {
209 return false;
210 }
206 211
207 LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]); 212 LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]);
208 backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; 213 backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
209 LoadBitmap("icon_error", &backgroundIcon[ERROR]); 214 LoadBitmap("icon_error", &backgroundIcon[ERROR]);
210 backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; 215 backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
216 return true;
211} 217}
212 218
213void WearRecoveryUI::SetStage(int current, int max) 219void WearRecoveryUI::SetStage(int current, int max)