summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-05-19 16:01:32 +0200
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-19 16:01:32 +0200
commite7ab043c3cc76d40f47601a4e74f46fca0de5c25 (patch)
tree76e984bb20d115bcb6d4e3b0b4c839ef1da41b4d
parentMerge "Add EthernetDevice to manage ethernet connection." am: 78c41b6414 am: f9712d6d40 am: e4ea6a9a3f am: 7610edbcf6 (diff)
parentMerge "recovery: fastbootd: retry opening graphics" am: 082bea6325 am: 0608d71169 am: 5e7b0704e4 (diff)
downloadandroid_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.tar
android_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.tar.gz
android_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.tar.bz2
android_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.tar.lz
android_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.tar.xz
android_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.tar.zst
android_bootable_recovery-e7ab043c3cc76d40f47601a4e74f46fca0de5c25.zip
-rw-r--r--recovery_ui/screen_ui.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index 6dcb161fa..b2c828f34 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -37,6 +37,7 @@
#include <unordered_map>
#include <vector>
+#include <android-base/chrono_utils.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@@ -881,10 +882,28 @@ bool ScreenRecoveryUI::LoadWipeDataMenuText() {
return true;
}
+static bool InitGraphics() {
+ // Timeout is same as init wait for file default of 5 seconds and is arbitrary
+ const unsigned timeout = 500; // 10ms increments
+ for (auto retry = timeout; retry > 0; --retry) {
+ if (gr_init() == 0) {
+ if (retry < timeout) {
+ // Log message like init wait for file completion log for consistency.
+ LOG(WARNING) << "wait for 'graphics' took " << ((timeout - retry) * 10) << "ms";
+ }
+ return true;
+ }
+ std::this_thread::sleep_for(10ms);
+ }
+ // Log message like init wait for file timeout log for consistency.
+ LOG(ERROR) << "timeout wait for 'graphics' took " << (timeout * 10) << "ms";
+ return false;
+}
+
bool ScreenRecoveryUI::Init(const std::string& locale) {
RecoveryUI::Init(locale);
- if (gr_init() == -1) {
+ if (!InitGraphics()) {
return false;
}