summaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-06-01 11:31:14 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-06-01 11:31:14 +0200
commit6611560b8c828874738e537a4e1f787fc34db783 (patch)
tree863032ef175cf97c713f7cb16d2a3d8efe38c654 /ui.h
parentSnap for 4806815 from e76ed816b94f1e89be3f965152ea83dd48f67b51 to qt-release (diff)
parentMerge "recovery: add --fsck_unshare_blocks option for adb remount" am: bda4495176 am: b0d9b3594b (diff)
downloadandroid_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.gz
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.bz2
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.lz
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.xz
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.zst
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.zip
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h27
1 files changed, 11 insertions, 16 deletions
diff --git a/ui.h b/ui.h
index a74b14f85..32e28099e 100644
--- a/ui.h
+++ b/ui.h
@@ -17,12 +17,14 @@
#ifndef RECOVERY_UI_H
#define RECOVERY_UI_H
-#include <linux/input.h>
-#include <pthread.h>
-#include <time.h>
+#include <linux/input.h> // KEY_MAX
+#include <atomic>
+#include <condition_variable>
#include <functional>
+#include <mutex>
#include <string>
+#include <thread>
#include <vector>
// Abstract class for controlling the user interface during recovery.
@@ -51,7 +53,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 +174,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,17 +182,15 @@ 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
- pthread_mutex_t key_queue_mutex;
- pthread_cond_t key_queue_cond;
+ std::mutex key_queue_mutex;
+ std::condition_variable key_queue_cond;
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
@@ -223,7 +217,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_;