diff options
author | Damien Bargiacchi <drb@google.com> | 2016-09-09 17:18:06 +0200 |
---|---|---|
committer | Damien Bargiacchi <drb@google.com> | 2016-09-09 17:22:49 +0200 |
commit | ad8b5a6c1195b94d8d80671e1bf791c32008fbef (patch) | |
tree | 44e738b6d19769809b69a69b76abbef239a36fab | |
parent | Remove debug log statement; fix build (diff) | |
download | android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.tar android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.tar.gz android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.tar.bz2 android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.tar.lz android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.tar.xz android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.tar.zst android_bootable_recovery-ad8b5a6c1195b94d8d80671e1bf791c32008fbef.zip |
Diffstat (limited to '')
-rw-r--r-- | wear_ui.cpp | 56 | ||||
-rw-r--r-- | wear_ui.h | 4 |
2 files changed, 6 insertions, 54 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp index 3550992ac..bfa7097ea 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -184,55 +184,10 @@ void WearRecoveryUI::draw_screen_locked() } } -// Keeps the progress bar updated, even when the process is otherwise busy. -void* WearRecoveryUI::progress_thread(void *cookie) { - self->progress_loop(); - return NULL; -} - -void WearRecoveryUI::progress_loop() { - double interval = 1.0 / animation_fps; - for (;;) { - double start = now(); - pthread_mutex_lock(&updateMutex); - bool redraw = false; - - if ((currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) - && !show_text) { - if (!intro_done) { - if (current_frame >= intro_frames - 1) { - intro_done = true; - current_frame = 0; - } else { - current_frame++; - } - } else { - current_frame = (current_frame + 1) % loop_frames; - } - redraw = true; - } - - // move the progress bar forward on timed intervals, if configured - int duration = progressScopeDuration; - if (progressBarType == DETERMINATE && duration > 0) { - double elapsed = now() - progressScopeTime; - float p = 1.0 * elapsed / duration; - if (p > 1.0) p = 1.0; - if (p > progress) { - progress = p; - redraw = true; - } - } - - if (redraw) update_screen_locked(); - - pthread_mutex_unlock(&updateMutex); - double end = now(); - // minimum of 20ms delay between frames - double delay = interval - (end-start); - if (delay < 0.02) delay = 0.02; - usleep((long)(delay * 1000000)); - } +// TODO merge drawing routines with screen_ui +void WearRecoveryUI::update_progress_locked() { + draw_screen_locked(); + gr_flip(); } void WearRecoveryUI::InitTextParams() { @@ -253,9 +208,6 @@ void WearRecoveryUI::Init() { backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE]; LoadBitmap("icon_error", &backgroundIcon[ERROR]); backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR]; - - pthread_create(&progress_t, NULL, progress_thread, NULL); - } void WearRecoveryUI::SetStage(int current, int max) @@ -54,6 +54,8 @@ class WearRecoveryUI : public ScreenRecoveryUI { void InitTextParams() override; + void update_progress_locked() override; + void PrintV(const char*, bool, va_list) override; private: @@ -74,8 +76,6 @@ class WearRecoveryUI : public ScreenRecoveryUI { void draw_screen_locked() override; void draw_progress_locked(); - static void* progress_thread(void* cookie); - void progress_loop(); void PutChar(char); void ClearText(); }; |