diff options
author | Doug Zongker <dougz@android.com> | 2012-12-17 10:52:58 -0800 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2012-12-17 10:52:58 -0800 |
commit | bb01d0c12b29e6ff4a9169c21c95408e7eb882c5 (patch) | |
tree | cb8243d9d034d18d84b66e7ece1435b1069cf2af /ui.h | |
parent | aa0dbb25a0ae51a8e53018fe05bf59164d9804cb (diff) | |
download | bootable_recovery-bb01d0c12b29e6ff4a9169c21c95408e7eb882c5.zip bootable_recovery-bb01d0c12b29e6ff4a9169c21c95408e7eb882c5.tar.gz bootable_recovery-bb01d0c12b29e6ff4a9169c21c95408e7eb882c5.tar.bz2 |
add NextCheckKeyIsLong() and EnqueueKey() methods
NextCheckKeyIsLong() is called right before each call to CheckKey() to
tell the implementation if the key is a long-press or not. (To be
used on devices with few buttons.) It's done as a separate method
(rather than a parameter to CheckKey) to not break existing recovery
UI implementations.
EnqueueKey() can be called from CheckKey() to put arbitrary code codes
in the synchronous queue (to be processed by HandleMenuKey).
Change-Id: If8a83d66efe0bbc9e2dc178e5ebe12acd216324b
Diffstat (limited to 'ui.h')
-rw-r--r-- | ui.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -19,6 +19,7 @@ #include <linux/input.h> #include <pthread.h> +#include <time.h> // Abstract class for controlling the user interface during recovery. class RecoveryUI { @@ -79,6 +80,8 @@ class RecoveryUI { enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE }; virtual KeyAction CheckKey(int key); + virtual void NextCheckKeyIsLong(bool is_long_press); + // --- menu display --- // Display some header text followed by a menu of items, which appears @@ -95,6 +98,9 @@ class RecoveryUI { // statements will be displayed. virtual void EndMenu() = 0; +protected: + void EnqueueKey(int key_code); + private: // Key event input queue pthread_mutex_t key_queue_mutex; @@ -102,6 +108,7 @@ private: int key_queue[256], key_queue_len; char key_pressed[KEY_MAX + 1]; // under key_queue_mutex int key_last_down; // under key_queue_mutex + clock_t key_down_time; // under key_queue_mutex int rel_sum; pthread_t input_t; |