aboutsummaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorTao Bao2017-06-24 00:47:03 -0500
committerTao Bao2017-06-24 01:06:01 -0500
commit99b2d774751041a5cfb5a48ac93292bb92acef98 (patch)
treecf0e859e660be2b9f2a3384c65c67492728ae190 /ui.h
parent5d2e3bd109539282d1829e3579c1f762a9486382 (diff)
downloadplatform-bootable-recovery-99b2d774751041a5cfb5a48ac93292bb92acef98.tar.gz
platform-bootable-recovery-99b2d774751041a5cfb5a48ac93292bb92acef98.tar.xz
platform-bootable-recovery-99b2d774751041a5cfb5a48ac93292bb92acef98.zip
Add override specifier and member constness to RecoveryUI classes.
Test: mmma bootable/recovery Change-Id: I66e328614423488a4027d7878f4569fbf3a3721e
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h68
1 files changed, 30 insertions, 38 deletions
diff --git a/ui.h b/ui.h
index ef63e1d7..7eb04aec 100644
--- a/ui.h
+++ b/ui.h
@@ -30,14 +30,14 @@ class RecoveryUI {
30 30
31 virtual ~RecoveryUI() {} 31 virtual ~RecoveryUI() {}
32 32
33 // Initialize the object; called before anything else. UI texts will be 33 // Initializes the object; called before anything else. UI texts will be initialized according to
34 // initialized according to the given locale. Returns true on success. 34 // the given locale. Returns true on success.
35 virtual bool Init(const std::string& locale); 35 virtual bool Init(const std::string& locale);
36 36
37 // Show a stage indicator. Call immediately after Init(). 37 // Shows a stage indicator. Called immediately after Init().
38 virtual void SetStage(int current, int max) = 0; 38 virtual void SetStage(int current, int max) = 0;
39 39
40 // Set the overall recovery state ("background image"). 40 // Sets the overall recovery state ("background image").
41 enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR }; 41 enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
42 virtual void SetBackground(Icon icon) = 0; 42 virtual void SetBackground(Icon icon) = 0;
43 virtual void SetSystemUpdateText(bool security_update) = 0; 43 virtual void SetSystemUpdateText(bool security_update) = 0;
@@ -46,13 +46,13 @@ class RecoveryUI {
46 enum ProgressType { EMPTY, INDETERMINATE, DETERMINATE }; 46 enum ProgressType { EMPTY, INDETERMINATE, DETERMINATE };
47 virtual void SetProgressType(ProgressType determinate) = 0; 47 virtual void SetProgressType(ProgressType determinate) = 0;
48 48
49 // Show a progress bar and define the scope of the next operation: 49 // Shows a progress bar and define the scope of the next operation:
50 // portion - fraction of the progress bar the next operation will use 50 // portion - fraction of the progress bar the next operation will use
51 // seconds - expected time interval (progress bar moves at this minimum rate) 51 // seconds - expected time interval (progress bar moves at this minimum rate)
52 virtual void ShowProgress(float portion, float seconds) = 0; 52 virtual void ShowProgress(float portion, float seconds) = 0;
53 53
54 // Set progress bar position (0.0 - 1.0 within the scope defined 54 // Sets progress bar position (0.0 - 1.0 within the scope defined by the last call to
55 // by the last call to ShowProgress). 55 // ShowProgress).
56 virtual void SetProgress(float fraction) = 0; 56 virtual void SetProgress(float fraction) = 0;
57 57
58 // --- text log --- 58 // --- text log ---
@@ -63,9 +63,8 @@ class RecoveryUI {
63 63
64 virtual bool WasTextEverVisible() = 0; 64 virtual bool WasTextEverVisible() = 0;
65 65
66 // Write a message to the on-screen log (shown if the user has 66 // Writes a message to the on-screen log (shown if the user has toggled on the text display).
67 // toggled on the text display). Print() will also dump the message 67 // Print() will also dump the message to stdout / log file, while PrintOnScreenOnly() not.
68 // to stdout / log file, while PrintOnScreenOnly() not.
69 virtual void Print(const char* fmt, ...) __printflike(2, 3) = 0; 68 virtual void Print(const char* fmt, ...) __printflike(2, 3) = 0;
70 virtual void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3) = 0; 69 virtual void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3) = 0;
71 70
@@ -73,54 +72,48 @@ class RecoveryUI {
73 72
74 // --- key handling --- 73 // --- key handling ---
75 74
76 // Wait for a key and return it. May return -1 after timeout. 75 // Waits for a key and return it. May return -1 after timeout.
77 virtual int WaitKey(); 76 virtual int WaitKey();
78 77
79 virtual bool IsKeyPressed(int key); 78 virtual bool IsKeyPressed(int key);
80 virtual bool IsLongPress(); 79 virtual bool IsLongPress();
81 80
82 // Returns true if you have the volume up/down and power trio typical 81 // Returns true if you have the volume up/down and power trio typical of phones and tablets, false
83 // of phones and tablets, false otherwise. 82 // otherwise.
84 virtual bool HasThreeButtons(); 83 virtual bool HasThreeButtons();
85 84
86 // Erase any queued-up keys. 85 // Erases any queued-up keys.
87 virtual void FlushKeys(); 86 virtual void FlushKeys();
88 87
89 // Called on each key press, even while operations are in progress. 88 // Called on each key press, even while operations are in progress. Return value indicates whether
90 // Return value indicates whether an immediate operation should be 89 // an immediate operation should be triggered (toggling the display, rebooting the device), or if
91 // triggered (toggling the display, rebooting the device), or if
92 // the key should be enqueued for use by the main thread. 90 // the key should be enqueued for use by the main thread.
93 enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE }; 91 enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE };
94 virtual KeyAction CheckKey(int key, bool is_long_press); 92 virtual KeyAction CheckKey(int key, bool is_long_press);
95 93
96 // Called when a key is held down long enough to have been a 94 // Called when a key is held down long enough to have been a long-press (but before the key is
97 // long-press (but before the key is released). This means that 95 // released). This means that if the key is eventually registered (released without any other keys
98 // if the key is eventually registered (released without any other 96 // being pressed in the meantime), CheckKey will be called with 'is_long_press' true.
99 // keys being pressed in the meantime), CheckKey will be called with
100 // 'is_long_press' true.
101 virtual void KeyLongPress(int key); 97 virtual void KeyLongPress(int key);
102 98
103 // Normally in recovery there's a key sequence that triggers 99 // Normally in recovery there's a key sequence that triggers immediate reboot of the device,
104 // immediate reboot of the device, regardless of what recovery is 100 // regardless of what recovery is doing (with the default CheckKey implementation, it's pressing
105 // doing (with the default CheckKey implementation, it's pressing 101 // the power button 7 times in row). Call this to enable or disable that feature. It is enabled by
106 // the power button 7 times in row). Call this to enable or 102 // default.
107 // disable that feature. It is enabled by default.
108 virtual void SetEnableReboot(bool enabled); 103 virtual void SetEnableReboot(bool enabled);
109 104
110 // --- menu display --- 105 // --- menu display ---
111 106
112 // Display some header text followed by a menu of items, which appears 107 // Display some header text followed by a menu of items, which appears at the top of the screen
113 // at the top of the screen (in place of any scrolling ui_print() 108 // (in place of any scrolling ui_print() output, if necessary).
114 // output, if necessary).
115 virtual void StartMenu(const char* const* headers, const char* const* items, 109 virtual void StartMenu(const char* const* headers, const char* const* items,
116 int initial_selection) = 0; 110 int initial_selection) = 0;
117 111
118 // Set the menu highlight to the given index, wrapping if necessary. 112 // Sets the menu highlight to the given index, wrapping if necessary. Returns the actual item
119 // Returns the actual item selected. 113 // selected.
120 virtual int SelectMenu(int sel) = 0; 114 virtual int SelectMenu(int sel) = 0;
121 115
122 // End menu mode, resetting the text overlay so that ui_print() 116 // Ends menu mode, resetting the text overlay so that ui_print() statements will be displayed.
123 // statements will be displayed.
124 virtual void EndMenu() = 0; 117 virtual void EndMenu() = 0;
125 118
126 protected: 119 protected:
@@ -130,10 +123,9 @@ class RecoveryUI {
130 std::string locale_; 123 std::string locale_;
131 bool rtl_locale_; 124 bool rtl_locale_;
132 125
133 // The normal and dimmed brightness percentages (default: 50 and 25, which means 50% and 25% 126 // The normal and dimmed brightness percentages (default: 50 and 25, which means 50% and 25% of
134 // of the max_brightness). Because the absolute values may vary across devices. These two 127 // the max_brightness). Because the absolute values may vary across devices. These two values can
135 // values can be configured via subclassing. Setting brightness_normal_ to 0 to disable 128 // be configured via subclassing. Setting brightness_normal_ to 0 to disable screensaver.
136 // screensaver.
137 unsigned int brightness_normal_; 129 unsigned int brightness_normal_;
138 unsigned int brightness_dimmed_; 130 unsigned int brightness_dimmed_;
139 131