resolve merge conflicts of ad8b5a6 to nyc-mr1-dev-plus-aosp
Change-Id: Ib1453d1bf3c6b83ef47a383d9d171b1059240477
This commit is contained in:
+4
-52
@@ -184,55 +184,10 @@ void WearRecoveryUI::draw_screen_locked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keeps the progress bar updated, even when the process is otherwise busy.
|
// TODO merge drawing routines with screen_ui
|
||||||
void* WearRecoveryUI::progress_thread(void *cookie) {
|
void WearRecoveryUI::update_progress_locked() {
|
||||||
self->progress_loop();
|
draw_screen_locked();
|
||||||
return NULL;
|
gr_flip();
|
||||||
}
|
|
||||||
|
|
||||||
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(static_cast<useconds_t>(delay * 1000000));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WearRecoveryUI::InitTextParams() {
|
void WearRecoveryUI::InitTextParams() {
|
||||||
@@ -253,9 +208,6 @@ void WearRecoveryUI::Init() {
|
|||||||
backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
|
backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
|
||||||
LoadBitmap("icon_error", &backgroundIcon[ERROR]);
|
LoadBitmap("icon_error", &backgroundIcon[ERROR]);
|
||||||
backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
|
backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
|
||||||
|
|
||||||
pthread_create(&progress_t, NULL, progress_thread, NULL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WearRecoveryUI::SetStage(int current, int max)
|
void WearRecoveryUI::SetStage(int current, int max)
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ class WearRecoveryUI : public ScreenRecoveryUI {
|
|||||||
|
|
||||||
void InitTextParams() override;
|
void InitTextParams() override;
|
||||||
|
|
||||||
|
void update_progress_locked() override;
|
||||||
|
|
||||||
void PrintV(const char*, bool, va_list) override;
|
void PrintV(const char*, bool, va_list) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -74,8 +76,6 @@ class WearRecoveryUI : public ScreenRecoveryUI {
|
|||||||
void draw_screen_locked() override;
|
void draw_screen_locked() override;
|
||||||
void draw_progress_locked();
|
void draw_progress_locked();
|
||||||
|
|
||||||
static void* progress_thread(void* cookie);
|
|
||||||
void progress_loop();
|
|
||||||
void PutChar(char);
|
void PutChar(char);
|
||||||
void ClearText();
|
void ClearText();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user