aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-03-07 01:53:16 -0600
committerTao Bao2017-03-07 01:53:16 -0600
commitdb7e8980802b16aab20871c1a87350558df7754d (patch)
tree9991ce9a86cfc8245f75df06595e328e01e65955 /recovery.cpp
parenta2e7a07031d72e617ddf082897d76f8b83fc52e3 (diff)
downloadplatform-bootable-recovery-db7e8980802b16aab20871c1a87350558df7754d.tar.gz
platform-bootable-recovery-db7e8980802b16aab20871c1a87350558df7754d.tar.xz
platform-bootable-recovery-db7e8980802b16aab20871c1a87350558df7754d.zip
recovery: Add SetStage() into 'Run graphics test'.
This allows a quicker test for stage UI. Bug: 27804510 Test: 'Run graphices test' with the new recovery image. Change-Id: I47689ae8e4cac6d7e5d1f6a10b9e393d50d713f3
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp62
1 files changed, 37 insertions, 25 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 5c60ce65..ff808998 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -985,35 +985,47 @@ static void choose_recovery_file(Device* device) {
985 } 985 }
986} 986}
987 987
988static void run_graphics_test(Device* device) { 988static void run_graphics_test() {
989 // Switch to graphics screen. 989 // Switch to graphics screen.
990 ui->ShowText(false); 990 ui->ShowText(false);
991 991
992 ui->SetProgressType(RecoveryUI::INDETERMINATE); 992 ui->SetProgressType(RecoveryUI::INDETERMINATE);
993 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE); 993 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
994 sleep(1); 994 sleep(1);
995
996 ui->SetBackground(RecoveryUI::ERROR);
997 sleep(1);
998
999 ui->SetBackground(RecoveryUI::NO_COMMAND);
1000 sleep(1);
1001 995
1002 ui->SetBackground(RecoveryUI::ERASING); 996 ui->SetBackground(RecoveryUI::ERROR);
1003 sleep(1); 997 sleep(1);
1004 998
1005 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE); 999 ui->SetBackground(RecoveryUI::NO_COMMAND);
1000 sleep(1);
1006 1001
1007 ui->SetProgressType(RecoveryUI::DETERMINATE); 1002 ui->SetBackground(RecoveryUI::ERASING);
1008 ui->ShowProgress(1.0, 10.0); 1003 sleep(1);
1009 float fraction = 0.0; 1004
1010 for (size_t i = 0; i < 100; ++i) { 1005 // Calling SetBackground() after SetStage() to trigger a redraw.
1011 fraction += .01; 1006 ui->SetStage(1, 3);
1012 ui->SetProgress(fraction); 1007 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
1013 usleep(100000); 1008 sleep(1);
1014 } 1009 ui->SetStage(2, 3);
1010 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
1011 sleep(1);
1012 ui->SetStage(3, 3);
1013 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
1014 sleep(1);
1015
1016 ui->SetStage(-1, -1);
1017 ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
1018
1019 ui->SetProgressType(RecoveryUI::DETERMINATE);
1020 ui->ShowProgress(1.0, 10.0);
1021 float fraction = 0.0;
1022 for (size_t i = 0; i < 100; ++i) {
1023 fraction += .01;
1024 ui->SetProgress(fraction);
1025 usleep(100000);
1026 }
1015 1027
1016 ui->ShowText(true); 1028 ui->ShowText(true);
1017} 1029}
1018 1030
1019// How long (in seconds) we wait for the fuse-provided package file to 1031// How long (in seconds) we wait for the fuse-provided package file to
@@ -1181,7 +1193,7 @@ prompt_and_wait(Device* device, int status) {
1181 break; 1193 break;
1182 1194
1183 case Device::RUN_GRAPHICS_TEST: 1195 case Device::RUN_GRAPHICS_TEST:
1184 run_graphics_test(device); 1196 run_graphics_test();
1185 break; 1197 break;
1186 1198
1187 case Device::MOUNT_SYSTEM: 1199 case Device::MOUNT_SYSTEM: