diff options
author | Elliott Hughes <enh@google.com> | 2015-04-10 15:00:34 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-04-10 15:14:35 -0700 |
commit | 4af215b2c35b41e983753256ad6dbebbf879c982 (patch) | |
tree | f327758d07cdb58a8e4a06f236f82f8df9515992 /ui.cpp | |
parent | 51697d2781501c30d8db6d2a8e6c2becebcffad8 (diff) | |
download | bootable_recovery-4af215b2c35b41e983753256ad6dbebbf879c982.zip bootable_recovery-4af215b2c35b41e983753256ad6dbebbf879c982.tar.gz bootable_recovery-4af215b2c35b41e983753256ad6dbebbf879c982.tar.bz2 |
Auto-detect whether to use the long-press UI.
Change-Id: Ie77a5584e301467c6a5e164d2c62d6f036b2c0c0
Diffstat (limited to 'ui.cpp')
-rw-r--r-- | ui.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -278,6 +278,10 @@ bool RecoveryUI::IsLongPress() { return result; } +bool RecoveryUI::HasThreeButtons() { + return has_power_key && has_up_key && has_down_key; +} + void RecoveryUI::FlushKeys() { pthread_mutex_lock(&key_queue_mutex); key_queue_len = 0; @@ -290,7 +294,7 @@ RecoveryUI::KeyAction RecoveryUI::CheckKey(int key, bool is_long_press) { pthread_mutex_unlock(&key_queue_mutex); // If we have power and volume up keys, that chord is the signal to toggle the text display. - if (has_power_key && has_up_key) { + if (HasThreeButtons()) { if (key == KEY_VOLUMEUP && IsKeyPressed(KEY_POWER)) { return TOGGLE; } |