aboutsummaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorTao Bao2017-01-03 12:15:33 -0600
committerTao Bao2017-01-04 00:40:03 -0600
commit736d59c56754b86135d9156208645b8b1814fba1 (patch)
treeb34e26851aaea9d8958f818d32c7d0e15196fa27 /ui.h
parent71633ebfb00103dd95a82cd813824dbddd9b905d (diff)
downloadplatform-bootable-recovery-736d59c56754b86135d9156208645b8b1814fba1.tar.gz
platform-bootable-recovery-736d59c56754b86135d9156208645b8b1814fba1.tar.xz
platform-bootable-recovery-736d59c56754b86135d9156208645b8b1814fba1.zip
recovery: Fix the broken UI text.
UI text is broken (doesn't show any text during FDR) due to commit d530449e54bd327e9c26209ffa0490c6508afe6c, which reordered the calls to RecoveryUI::SetLocale() and RecoveryUI::Init(). Because Init() uses the locale info to load the localized texts (from images), the locale must be set prior to that via SetLocale(). This CL refactors Init() to take the locale parameter, and removes the odd SetLocale() API. Bug: 34029338 Test: 'Run graphics test' under recovery. Change-Id: I620394a3d4e3705e9af5a1f6299285d143ae1b01
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/ui.h b/ui.h
index be95a4e2..8493c6f0 100644
--- a/ui.h
+++ b/ui.h
@@ -21,6 +21,8 @@
21#include <pthread.h> 21#include <pthread.h>
22#include <time.h> 22#include <time.h>
23 23
24#include <string>
25
24// Abstract class for controlling the user interface during recovery. 26// Abstract class for controlling the user interface during recovery.
25class RecoveryUI { 27class RecoveryUI {
26 public: 28 public:
@@ -28,14 +30,13 @@ class RecoveryUI {
28 30
29 virtual ~RecoveryUI() { } 31 virtual ~RecoveryUI() { }
30 32
31 // Initialize the object; called before anything else. Returns true on success. 33 // Initialize the object; called before anything else. UI texts will be
32 virtual bool Init(); 34 // initialized according to the given locale. Returns true on success.
35 virtual bool Init(const std::string& locale);
36
33 // Show a stage indicator. Call immediately after Init(). 37 // Show a stage indicator. Call immediately after Init().
34 virtual void SetStage(int current, int max) = 0; 38 virtual void SetStage(int current, int max) = 0;
35 39
36 // After calling Init(), you can tell the UI what locale it is operating in.
37 virtual void SetLocale(const char* locale) = 0;
38
39 // Set the overall recovery state ("background image"). 40 // Set the overall recovery state ("background image").
40 enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR }; 41 enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
41 virtual void SetBackground(Icon icon) = 0; 42 virtual void SetBackground(Icon icon) = 0;
@@ -122,10 +123,14 @@ class RecoveryUI {
122 // statements will be displayed. 123 // statements will be displayed.
123 virtual void EndMenu() = 0; 124 virtual void EndMenu() = 0;
124 125
125protected: 126 protected:
126 void EnqueueKey(int key_code); 127 void EnqueueKey(int key_code);
127 128
128private: 129 // The locale that's used to show the rendered texts.
130 std::string locale_;
131 bool rtl_locale_;
132
133 private:
129 // Key event input queue 134 // Key event input queue
130 pthread_mutex_t key_queue_mutex; 135 pthread_mutex_t key_queue_mutex;
131 pthread_cond_t key_queue_cond; 136 pthread_cond_t key_queue_cond;
@@ -162,6 +167,8 @@ private:
162 167
163 static void* time_key_helper(void* cookie); 168 static void* time_key_helper(void* cookie);
164 void time_key(int key_code, int count); 169 void time_key(int key_code, int count);
170
171 void SetLocale(const std::string&);
165}; 172};
166 173
167#endif // RECOVERY_UI_H 174#endif // RECOVERY_UI_H