fix timed progress bars in recovery

They're completely broken and have been for months because this code
makes no sense.

Change-Id: Ibabcd3dbe5a004a45b341e4a5215aa3df77e1861
This commit is contained in:
Doug Zongker 2012-04-26 14:37:53 -07:00
parent f69d40afa1
commit 69f4b6732c

View file

@ -122,6 +122,8 @@ void ScreenRecoveryUI::draw_background_locked(Icon icon)
// Should only be called with updateMutex locked. // Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_progress_locked() void ScreenRecoveryUI::draw_progress_locked()
{ {
if (currentIcon == ERROR) return;
if (currentIcon == INSTALLING) { if (currentIcon == INSTALLING) {
draw_install_overlay_locked(installingFrame); draw_install_overlay_locked(installingFrame);
} }
@ -255,10 +257,10 @@ void ScreenRecoveryUI::progress_loop() {
int duration = progressScopeDuration; int duration = progressScopeDuration;
if (progressBarType == DETERMINATE && duration > 0) { if (progressBarType == DETERMINATE && duration > 0) {
double elapsed = now() - progressScopeTime; double elapsed = now() - progressScopeTime;
float progress = 1.0 * elapsed / duration; float p = 1.0 * elapsed / duration;
if (progress > 1.0) progress = 1.0; if (p > 1.0) p = 1.0;
if (progress > progress) { if (p > progress) {
progress = progress; progress = p;
redraw = 1; redraw = 1;
} }
} }
@ -351,6 +353,8 @@ void ScreenRecoveryUI::SetProgressType(ProgressType type)
progressBarType = type; progressBarType = type;
update_progress_locked(); update_progress_locked();
} }
progressScopeStart = 0;
progress = 0;
pthread_mutex_unlock(&updateMutex); pthread_mutex_unlock(&updateMutex);
} }