summaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-09-11 20:25:23 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-09-11 20:25:23 +0200
commitbd9ef0ad1acaf0cece1cdb0666ef4be43ed24781 (patch)
tree8fd8964cc96ecc6ad4a27e5ac156d5f874d891d8 /ui.h
parentMerge "wear_ui: Remove Print()/ShowFile()/PutChar()." am: fa4f014063 (diff)
parentMerge "ui: Refactor the declaration orders." (diff)
downloadandroid_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.tar
android_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.tar.gz
android_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.tar.bz2
android_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.tar.lz
android_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.tar.xz
android_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.tar.zst
android_bootable_recovery-bd9ef0ad1acaf0cece1cdb0666ef4be43ed24781.zip
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h72
1 files changed, 49 insertions, 23 deletions
diff --git a/ui.h b/ui.h
index 3d9afece0..c6d6d6b52 100644
--- a/ui.h
+++ b/ui.h
@@ -26,6 +26,27 @@
// Abstract class for controlling the user interface during recovery.
class RecoveryUI {
public:
+ enum Icon {
+ NONE,
+ INSTALLING_UPDATE,
+ ERASING,
+ NO_COMMAND,
+ ERROR
+ };
+
+ enum ProgressType {
+ EMPTY,
+ INDETERMINATE,
+ DETERMINATE
+ };
+
+ enum KeyAction {
+ ENQUEUE,
+ TOGGLE,
+ REBOOT,
+ IGNORE
+ };
+
RecoveryUI();
virtual ~RecoveryUI() {}
@@ -38,12 +59,10 @@ class RecoveryUI {
virtual void SetStage(int current, int max) = 0;
// Sets the overall recovery state ("background image").
- enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
virtual void SetBackground(Icon icon) = 0;
virtual void SetSystemUpdateText(bool security_update) = 0;
// --- progress indicator ---
- enum ProgressType { EMPTY, INDETERMINATE, DETERMINATE };
virtual void SetProgressType(ProgressType determinate) = 0;
// Shows a progress bar and define the scope of the next operation:
@@ -94,7 +113,6 @@ class RecoveryUI {
// Called on each key press, even while operations are in progress. Return value indicates whether
// an immediate operation should be triggered (toggling the display, rebooting the device), or if
// the key should be enqueued for use by the main thread.
- enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE };
virtual KeyAction CheckKey(int key, bool is_long_press);
// Called when a key is held down long enough to have been a long-press (but before the key is
@@ -139,10 +157,37 @@ class RecoveryUI {
bool touch_screen_allowed_;
private:
+ enum class ScreensaverState {
+ DISABLED,
+ NORMAL,
+ DIMMED,
+ OFF
+ };
+
+ struct key_timer_t {
+ RecoveryUI* ui;
+ int key_code;
+ int count;
+ };
+
// The sensitivity when detecting a swipe.
const int kTouchLowThreshold;
const int kTouchHighThreshold;
+ void OnKeyDetected(int key_code);
+ void OnTouchDetected(int dx, int dy);
+ int OnInputEvent(int fd, uint32_t epevents);
+ void ProcessKey(int key_code, int updown);
+
+ bool IsUsbConnected();
+
+ static void* time_key_helper(void* cookie);
+ void time_key(int key_code, int count);
+
+ void SetLocale(const std::string&);
+
+ bool InitScreensaver();
+
// Key event input queue
pthread_mutex_t key_queue_mutex;
pthread_cond_t key_queue_cond;
@@ -172,33 +217,14 @@ class RecoveryUI {
bool touch_swiping_;
bool is_bootreason_recovery_ui_;
- struct key_timer_t {
- RecoveryUI* ui;
- int key_code;
- int count;
- };
-
pthread_t input_thread_;
- void OnKeyDetected(int key_code);
- void OnTouchDetected(int dx, int dy);
- int OnInputEvent(int fd, uint32_t epevents);
- void ProcessKey(int key_code, int updown);
-
- bool IsUsbConnected();
-
- static void* time_key_helper(void* cookie);
- void time_key(int key_code, int count);
-
- void SetLocale(const std::string&);
-
- enum class ScreensaverState { DISABLED, NORMAL, DIMMED, OFF };
ScreensaverState screensaver_state_;
+
// The following two contain the absolute values computed from brightness_normal_ and
// brightness_dimmed_ respectively.
unsigned int brightness_normal_value_;
unsigned int brightness_dimmed_value_;
- bool InitScreensaver();
};
#endif // RECOVERY_UI_H