From 54a2747ef305c10d07d8db393125dbcbb461c428 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Mon, 18 Apr 2016 11:30:55 -0700 Subject: Fix google-runtime-int warnings. Bug: 28220065 Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592 --- wear_ui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index 50aeb3849..48278ff21 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -320,7 +320,7 @@ void WearRecoveryUI::progress_loop() { // minimum of 20ms delay between frames double delay = interval - (end-start); if (delay < 0.02) delay = 0.02; - usleep((long)(delay * 1000000)); + usleep(static_cast(delay * 1000000)); } } @@ -573,8 +573,8 @@ void WearRecoveryUI::Redraw() } void WearRecoveryUI::ShowFile(FILE* fp) { - std::vector offsets; - offsets.push_back(ftell(fp)); + std::vector offsets; + offsets.push_back(ftello(fp)); ClearText(); struct stat sb; @@ -584,7 +584,7 @@ void WearRecoveryUI::ShowFile(FILE* fp) { while (true) { if (show_prompt) { Print("--(%d%% of %d bytes)--", - static_cast(100 * (double(ftell(fp)) / double(sb.st_size))), + static_cast(100 * (double(ftello(fp)) / double(sb.st_size))), static_cast(sb.st_size)); Redraw(); while (show_prompt) { @@ -603,7 +603,7 @@ void WearRecoveryUI::ShowFile(FILE* fp) { if (feof(fp)) { return; } - offsets.push_back(ftell(fp)); + offsets.push_back(ftello(fp)); } } ClearText(); -- cgit v1.2.3 From cb22040c6303144a42a90f424f29a267e43bef74 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 23 Sep 2016 15:30:55 -0700 Subject: Switch to . Bug: http://b/23102347 Test: boot into recovery. Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e --- wear_ui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index e078134ce..17889076a 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -30,7 +30,7 @@ #include "common.h" #include "device.h" #include "wear_ui.h" -#include "cutils/properties.h" +#include "android-base/properties.h" #include "android-base/strings.h" #include "android-base/stringprintf.h" @@ -160,8 +160,8 @@ void WearRecoveryUI::draw_screen_locked() int y = outer_height; int x = outer_width; if (show_menu) { - char recovery_fingerprint[PROPERTY_VALUE_MAX]; - property_get("ro.bootimage.build.fingerprint", recovery_fingerprint, ""); + std::string recovery_fingerprint = + android::base::GetProperty("ro.bootimage.build.fingerprint", ""); SetColor(HEADER); DrawTextLine(x + 4, &y, "Android Recovery", true); for (auto& chunk: android::base::Split(recovery_fingerprint, ":")) { -- cgit v1.2.3 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 From 825b6b0c0b4c4ff93e926db78e9b7acca3b993c5 Mon Sep 17 00:00:00 2001 From: Tim Kryger Date: Tue, 29 Nov 2016 13:33:29 -0800 Subject: Remove outdated reference to icon_installing.png The Wear recovery UI doesn't draw the installing icon but it was still trying to open it. Ever since these images were removed eight months ago, this has resulted in an error printing to the screen at runtime. Since the image wasn't really used, the lines to open it can simply be removed. Bug: 33203397 Change-Id: Id820f6d75e316c51d19b6095df407ecd61c0410e (cherry picked from commit 48be23c8ed0bcceda1abd80e1df4d1abc20f042f) --- wear_ui.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index 11e5a7168..bdb0ef009 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -209,10 +209,12 @@ bool WearRecoveryUI::Init() { return false; } - LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]); - backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; + + // This leaves backgroundIcon[INSTALLING_UPDATE] and backgroundIcon[ERASING] + // as NULL which is fine since draw_background_locked() doesn't use them. + return true; } -- cgit v1.2.3 From 736d59c56754b86135d9156208645b8b1814fba1 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 3 Jan 2017 10:15:33 -0800 Subject: recovery: Fix the broken UI text. UI text is broken (doesn't show any text during FDR) due to commit d530449e54bd327e9c26209ffa0490c6508afe6c, which reordered the calls to RecoveryUI::SetLocale() and RecoveryUI::Init(). Because Init() uses the locale info to load the localized texts (from images), the locale must be set prior to that via SetLocale(). This CL refactors Init() to take the locale parameter, and removes the odd SetLocale() API. Bug: 34029338 Test: 'Run graphics test' under recovery. Change-Id: I620394a3d4e3705e9af5a1f6299285d143ae1b01 --- wear_ui.cpp | 71 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index bdb0ef009..b4c63a5ae 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include "wear_ui.h" + #include #include #include @@ -25,11 +27,11 @@ #include #include +#include #include #include "common.h" #include "device.h" -#include "wear_ui.h" #include "android-base/properties.h" #include "android-base/strings.h" #include "android-base/stringprintf.h" @@ -204,51 +206,48 @@ bool WearRecoveryUI::InitTextParams() { return true; } -bool WearRecoveryUI::Init() { - if (!ScreenRecoveryUI::Init()) { - return false; - } +bool WearRecoveryUI::Init(const std::string& locale) { + if (!ScreenRecoveryUI::Init(locale)) { + return false; + } - LoadBitmap("icon_error", &backgroundIcon[ERROR]); - backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; + LoadBitmap("icon_error", &backgroundIcon[ERROR]); + backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; - // This leaves backgroundIcon[INSTALLING_UPDATE] and backgroundIcon[ERASING] - // as NULL which is fine since draw_background_locked() doesn't use them. + // This leaves backgroundIcon[INSTALLING_UPDATE] and backgroundIcon[ERASING] + // as NULL which is fine since draw_background_locked() doesn't use them. - return true; + return true; } -void WearRecoveryUI::SetStage(int current, int max) -{ -} +void WearRecoveryUI::SetStage(int current, int max) {} -void WearRecoveryUI::Print(const char *fmt, ...) -{ - char buf[256]; - va_list ap; - va_start(ap, fmt); - vsnprintf(buf, 256, fmt, ap); - va_end(ap); +void WearRecoveryUI::Print(const char* fmt, ...) { + char buf[256]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, 256, fmt, ap); + va_end(ap); - fputs(buf, stdout); + fputs(buf, stdout); - // This can get called before ui_init(), so be careful. - pthread_mutex_lock(&updateMutex); - if (text_rows_ > 0 && text_cols_ > 0) { - char *ptr; - for (ptr = buf; *ptr != '\0'; ++ptr) { - if (*ptr == '\n' || text_col_ >= text_cols_) { - text_[text_row_][text_col_] = '\0'; - text_col_ = 0; - text_row_ = (text_row_ + 1) % text_rows_; - if (text_row_ == text_top_) text_top_ = (text_top_ + 1) % text_rows_; - } - if (*ptr != '\n') text_[text_row_][text_col_++] = *ptr; - } + // This can get called before ui_init(), so be careful. + pthread_mutex_lock(&updateMutex); + if (text_rows_ > 0 && text_cols_ > 0) { + char* ptr; + for (ptr = buf; *ptr != '\0'; ++ptr) { + if (*ptr == '\n' || text_col_ >= text_cols_) { text_[text_row_][text_col_] = '\0'; - update_screen_locked(); + text_col_ = 0; + text_row_ = (text_row_ + 1) % text_rows_; + if (text_row_ == text_top_) text_top_ = (text_top_ + 1) % text_rows_; + } + if (*ptr != '\n') text_[text_row_][text_col_++] = *ptr; } - pthread_mutex_unlock(&updateMutex); + text_[text_row_][text_col_] = '\0'; + update_screen_locked(); + } + pthread_mutex_unlock(&updateMutex); } void WearRecoveryUI::StartMenu(const char* const * headers, const char* const * items, -- cgit v1.2.3 From 0ecbd76b220ba6f3d02fa028b9c6481f7fb5c089 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Mon, 16 Jan 2017 21:16:58 -0800 Subject: minui: Export minui/minui.h. For libminui static and shared libraries. Test: build Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16 --- wear_ui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index b4c63a5ae..6c0286558 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -30,11 +30,13 @@ #include #include +#include +#include +#include +#include + #include "common.h" #include "device.h" -#include "android-base/properties.h" -#include "android-base/strings.h" -#include "android-base/stringprintf.h" // There's only (at most) one of these objects, and global callbacks // (for pthread_create, and the input event system) need to find it, -- cgit v1.2.3