summaryrefslogtreecommitdiffstats
path: root/ui.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-08-16 20:48:50 +0200
committerTao Bao <tbao@google.com>2018-08-16 20:54:01 +0200
commit53be3327110be6bd52d01cea22223914634dd9fa (patch)
treeb4b4573a3356f8159b494f4d0679c6b6d48dfb04 /ui.cpp
parentMerge "tests: Add the missing tests in applypatch_modes_test.cpp." (diff)
downloadandroid_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.tar
android_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.tar.gz
android_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.tar.bz2
android_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.tar.lz
android_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.tar.xz
android_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.tar.zst
android_bootable_recovery-53be3327110be6bd52d01cea22223914634dd9fa.zip
Diffstat (limited to 'ui.cpp')
-rw-r--r--ui.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/ui.cpp b/ui.cpp
index f1e30f500..14b5b0941 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -454,8 +454,7 @@ int RecoveryUI::WaitKey() {
return static_cast<int>(KeyError::INTERRUPTED);
}
- // Time out after UI_WAIT_KEY_TIMEOUT_SEC, unless a USB cable is
- // plugged in.
+ // Time out after UI_WAIT_KEY_TIMEOUT_SEC, unless a USB cable is plugged in.
do {
bool rc = key_queue_cond.wait_for(lk, std::chrono::seconds(UI_WAIT_KEY_TIMEOUT_SEC), [this] {
return this->key_queue_len != 0 || key_interrupted_;
@@ -466,13 +465,13 @@ int RecoveryUI::WaitKey() {
}
if (screensaver_state_ != ScreensaverState::DISABLED) {
if (!rc) {
- // Lower the brightness level: NORMAL -> DIMMED; DIMMED -> OFF.
+ // Must be after a timeout. Lower the brightness level: NORMAL -> DIMMED; DIMMED -> OFF.
if (screensaver_state_ == ScreensaverState::NORMAL) {
SetScreensaverState(ScreensaverState::DIMMED);
} else if (screensaver_state_ == ScreensaverState::DIMMED) {
SetScreensaverState(ScreensaverState::OFF);
}
- } else {
+ } else if (screensaver_state_ != ScreensaverState::NORMAL) {
// Drop the first key if it's changing from OFF to NORMAL.
if (screensaver_state_ == ScreensaverState::OFF) {
if (key_queue_len > 0) {