summaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2013-07-31 20:28:24 +0200
committerDoug Zongker <dougz@android.com>2013-07-31 20:35:12 +0200
commitc0441d171914e59941ec4f815ae0aabf56d6504f (patch)
tree2382931433409feae532e7a7fb4ac05016336196 /ui.h
parentMerge "start healthd in recovery" (diff)
downloadandroid_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.gz
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.bz2
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.lz
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.xz
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.zst
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.zip
Diffstat (limited to '')
-rw-r--r--ui.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/ui.h b/ui.h
index aca7b7b87..6c8987a33 100644
--- a/ui.h
+++ b/ui.h
@@ -80,8 +80,17 @@ class RecoveryUI {
enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE };
virtual KeyAction CheckKey(int key);
+ // Called immediately before each call to CheckKey(), tell you if
+ // the key was long-pressed.
virtual void NextCheckKeyIsLong(bool is_long_press);
+ // Called when a key is held down long enough to have been a
+ // long-press (but before the key is released). This means that
+ // if the key is eventually registered (released without any other
+ // keys being pressed in the meantime), NextCheckKeyIsLong() will
+ // be called with "true".
+ virtual void KeyLongPress(int key);
+
// --- menu display ---
// Display some header text followed by a menu of items, which appears
@@ -108,15 +117,25 @@ 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
+ bool key_long_press; // under key_queue_mutex
+ int key_down_count; // under key_queue_mutex
int rel_sum;
+ typedef struct {
+ RecoveryUI* ui;
+ int key_code;
+ int count;
+ } key_timer_t;
+
pthread_t input_t;
static void* input_thread(void* cookie);
static int input_callback(int fd, short revents, void* data);
void process_key(int key_code, int updown);
bool usb_connected();
+
+ static void* time_key_helper(void* cookie);
+ void time_key(int key_code, int count);
};
#endif // RECOVERY_UI_H