From d530449e54bd327e9c26209ffa0490c6508afe6c Mon Sep 17 00:00:00 2001 From: Sen Jiang Date: Fri, 9 Dec 2016 16:20:49 -0800 Subject: 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 --- wear_ui.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index 0918ac457..11e5a7168 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -190,8 +190,10 @@ void WearRecoveryUI::update_progress_locked() { gr_flip(); } -void WearRecoveryUI::InitTextParams() { - ScreenRecoveryUI::InitTextParams(); +bool WearRecoveryUI::InitTextParams() { + if (!ScreenRecoveryUI::InitTextParams()) { + return false; + } text_cols_ = (gr_fb_width() - (outer_width * 2)) / char_width_; @@ -199,15 +201,19 @@ void WearRecoveryUI::InitTextParams() { if (text_cols_ > kMaxCols) text_cols_ = kMaxCols; visible_text_rows = (gr_fb_height() - (outer_height * 2)) / char_height_; + return true; } -void WearRecoveryUI::Init() { - ScreenRecoveryUI::Init(); +bool WearRecoveryUI::Init() { + if (!ScreenRecoveryUI::Init()) { + return false; + } LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]); backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; + return true; } void WearRecoveryUI::SetStage(int current, int max) -- cgit v1.2.3