aboutsummaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorDoug Zongker2012-12-17 12:52:58 -0600
committerDoug Zongker2012-12-17 12:52:58 -0600
commitbb01d0c12b29e6ff4a9169c21c95408e7eb882c5 (patch)
treecb8243d9d034d18d84b66e7ece1435b1069cf2af /ui.h
parentaa0dbb25a0ae51a8e53018fe05bf59164d9804cb (diff)
downloadplatform-bootable-recovery-bb01d0c12b29e6ff4a9169c21c95408e7eb882c5.tar.gz
platform-bootable-recovery-bb01d0c12b29e6ff4a9169c21c95408e7eb882c5.tar.xz
platform-bootable-recovery-bb01d0c12b29e6ff4a9169c21c95408e7eb882c5.zip
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.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui.h b/ui.h
index acb57663..aca7b7b8 100644
--- a/ui.h
+++ b/ui.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/input.h> 20#include <linux/input.h>
21#include <pthread.h> 21#include <pthread.h>
22#include <time.h>
22 23
23// Abstract class for controlling the user interface during recovery. 24// Abstract class for controlling the user interface during recovery.
24class RecoveryUI { 25class RecoveryUI {
@@ -79,6 +80,8 @@ class RecoveryUI {
79 enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE }; 80 enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE };
80 virtual KeyAction CheckKey(int key); 81 virtual KeyAction CheckKey(int key);
81 82
83 virtual void NextCheckKeyIsLong(bool is_long_press);
84
82 // --- menu display --- 85 // --- menu display ---
83 86
84 // Display some header text followed by a menu of items, which appears 87 // Display some header text followed by a menu of items, which appears
@@ -95,6 +98,9 @@ class RecoveryUI {
95 // statements will be displayed. 98 // statements will be displayed.
96 virtual void EndMenu() = 0; 99 virtual void EndMenu() = 0;
97 100
101protected:
102 void EnqueueKey(int key_code);
103
98private: 104private:
99 // Key event input queue 105 // Key event input queue
100 pthread_mutex_t key_queue_mutex; 106 pthread_mutex_t key_queue_mutex;
@@ -102,6 +108,7 @@ private:
102 int key_queue[256], key_queue_len; 108 int key_queue[256], key_queue_len;
103 char key_pressed[KEY_MAX + 1]; // under key_queue_mutex 109 char key_pressed[KEY_MAX + 1]; // under key_queue_mutex
104 int key_last_down; // under key_queue_mutex 110 int key_last_down; // under key_queue_mutex
111 clock_t key_down_time; // under key_queue_mutex
105 int rel_sum; 112 int rel_sum;
106 113
107 pthread_t input_t; 114 pthread_t input_t;