aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashant Malani2016-03-09 21:40:20 -0600
committerPrashant Malani2016-03-09 21:40:20 -0600
commitf7f9e50528761022989c4f0cac6a92716b54674f (patch)
tree8f428bb0debeb61b70cfbf5e9b43b58cf5935465 /wear_ui.cpp
parent1c7b2230d8aac9f064f68c48b6aa26aca000cc9d (diff)
downloadplatform-bootable-recovery-f7f9e50528761022989c4f0cac6a92716b54674f.tar.gz
platform-bootable-recovery-f7f9e50528761022989c4f0cac6a92716b54674f.tar.xz
platform-bootable-recovery-f7f9e50528761022989c4f0cac6a92716b54674f.zip
Revert "recovery: More refactoring of WearUI"
This reverts commit 1c7b2230d8aac9f064f68c48b6aa26aca000cc9d. This change can lead to the derived class indirectly (and incorrectly) calling some functions from the base class, which can lead to unpredictable behavior. Bug: 27407422 Change-Id: I126a7489b0787dc195e942e2ceea6769de20d70c
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index ef48b788..65bcd849 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -59,6 +59,7 @@ WearRecoveryUI::WearRecoveryUI() :
59 intro_frames(22), 59 intro_frames(22),
60 loop_frames(60), 60 loop_frames(60),
61 animation_fps(30), 61 animation_fps(30),
62 currentIcon(NONE),
62 intro_done(false), 63 intro_done(false),
63 current_frame(0), 64 current_frame(0),
64 rtl_locale(false), 65 rtl_locale(false),
@@ -365,6 +366,57 @@ void WearRecoveryUI::Init()
365 RecoveryUI::Init(); 366 RecoveryUI::Init();
366} 367}
367 368
369void WearRecoveryUI::SetBackground(Icon icon)
370{
371 pthread_mutex_lock(&updateMutex);
372 currentIcon = icon;
373 update_screen_locked();
374 pthread_mutex_unlock(&updateMutex);
375}
376
377void WearRecoveryUI::SetProgressType(ProgressType type)
378{
379 pthread_mutex_lock(&updateMutex);
380 if (progressBarType != type) {
381 progressBarType = type;
382 }
383 progressScopeStart = 0;
384 progressScopeSize = 0;
385 progress = 0;
386 update_screen_locked();
387 pthread_mutex_unlock(&updateMutex);
388}
389
390void WearRecoveryUI::ShowProgress(float portion, float seconds)
391{
392 pthread_mutex_lock(&updateMutex);
393 progressBarType = DETERMINATE;
394 progressScopeStart += progressScopeSize;
395 progressScopeSize = portion;
396 progressScopeTime = now();
397 progressScopeDuration = seconds;
398 progress = 0;
399 update_screen_locked();
400 pthread_mutex_unlock(&updateMutex);
401}
402
403void WearRecoveryUI::SetProgress(float fraction)
404{
405 pthread_mutex_lock(&updateMutex);
406 if (fraction < 0.0) fraction = 0.0;
407 if (fraction > 1.0) fraction = 1.0;
408 if (progressBarType == DETERMINATE && fraction > progress) {
409 // Skip updates that aren't visibly different.
410 int width = progress_bar_width;
411 float scale = width * progressScopeSize;
412 if ((int) (progress * scale) != (int) (fraction * scale)) {
413 progress = fraction;
414 update_screen_locked();
415 }
416 }
417 pthread_mutex_unlock(&updateMutex);
418}
419
368void WearRecoveryUI::SetStage(int current, int max) 420void WearRecoveryUI::SetStage(int current, int max)
369{ 421{
370} 422}
@@ -447,6 +499,16 @@ int WearRecoveryUI::SelectMenu(int sel) {
447 return sel; 499 return sel;
448} 500}
449 501
502void WearRecoveryUI::EndMenu() {
503 int i;
504 pthread_mutex_lock(&updateMutex);
505 if (show_menu > 0 && text_rows > 0 && text_cols > 0) {
506 show_menu = 0;
507 update_screen_locked();
508 }
509 pthread_mutex_unlock(&updateMutex);
510}
511
450bool WearRecoveryUI::IsTextVisible() 512bool WearRecoveryUI::IsTextVisible()
451{ 513{
452 pthread_mutex_lock(&updateMutex); 514 pthread_mutex_lock(&updateMutex);
@@ -477,6 +539,13 @@ void WearRecoveryUI::ShowText(bool visible)
477 pthread_mutex_unlock(&updateMutex); 539 pthread_mutex_unlock(&updateMutex);
478} 540}
479 541
542void WearRecoveryUI::Redraw()
543{
544 pthread_mutex_lock(&updateMutex);
545 update_screen_locked();
546 pthread_mutex_unlock(&updateMutex);
547}
548
480void WearRecoveryUI::ShowFile(FILE* fp) { 549void WearRecoveryUI::ShowFile(FILE* fp) {
481 std::vector<long> offsets; 550 std::vector<long> offsets;
482 offsets.push_back(ftell(fp)); 551 offsets.push_back(ftell(fp));