summaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-05-10 01:32:02 +0200
committerJerry Zhang <zhangjerry@google.com>2018-05-22 01:37:07 +0200
commit26ea9591bcb90c5ac201fce7ce2f0e1e092c703e (patch)
tree81c9c2816f8023a2477a07266a5b075afaa0033f /ui.h
parentrecovery: Add ability to set title lines (diff)
downloadandroid_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.tar
android_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.tar.gz
android_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.tar.bz2
android_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.tar.lz
android_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.tar.xz
android_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.tar.zst
android_bootable_recovery-26ea9591bcb90c5ac201fce7ce2f0e1e092c703e.zip
Diffstat (limited to '')
-rw-r--r--ui.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/ui.h b/ui.h
index a74b14f85..75390d83c 100644
--- a/ui.h
+++ b/ui.h
@@ -17,12 +17,13 @@
#ifndef RECOVERY_UI_H
#define RECOVERY_UI_H
-#include <linux/input.h>
+#include <linux/input.h> // KEY_MAX
#include <pthread.h>
-#include <time.h>
+#include <atomic>
#include <functional>
#include <string>
+#include <thread>
#include <vector>
// Abstract class for controlling the user interface during recovery.
@@ -51,7 +52,7 @@ class RecoveryUI {
RecoveryUI();
- virtual ~RecoveryUI() {}
+ virtual ~RecoveryUI();
// Initializes the object; called before anything else. UI texts will be initialized according to
// the given locale. Returns true on success.
@@ -172,12 +173,6 @@ class RecoveryUI {
OFF
};
- struct key_timer_t {
- RecoveryUI* ui;
- int key_code;
- int count;
- };
-
// The sensitivity when detecting a swipe.
const int kTouchLowThreshold;
const int kTouchHighThreshold;
@@ -186,12 +181,10 @@ class RecoveryUI {
void OnTouchDetected(int dx, int dy);
int OnInputEvent(int fd, uint32_t epevents);
void ProcessKey(int key_code, int updown);
+ void TimeKey(int key_code, int count);
bool IsUsbConnected();
- static void* time_key_helper(void* cookie);
- void time_key(int key_code, int count);
-
bool InitScreensaver();
// Key event input queue
@@ -223,7 +216,8 @@ class RecoveryUI {
bool touch_swiping_;
bool is_bootreason_recovery_ui_;
- pthread_t input_thread_;
+ std::thread input_thread_;
+ std::atomic<bool> input_thread_stopped_{ false };
ScreensaverState screensaver_state_;