• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef RECOVERY_WEAR_UI_H
18 #define RECOVERY_WEAR_UI_H
19 
20 #include "screen_ui.h"
21 
22 #include <string>
23 
24 class WearRecoveryUI : public ScreenRecoveryUI {
25  public:
26   WearRecoveryUI();
27 
28   bool Init(const std::string& locale) override;
29 
30   void SetStage(int current, int max) override;
31 
32   // printing messages
33   void Print(const char* fmt, ...) override;
34   void PrintOnScreenOnly(const char* fmt, ...) override __printflike(2, 3);
35   void ShowFile(const char* filename) override;
36   void ShowFile(FILE* fp) override;
37 
38   // menu display
39   void StartMenu(const char* const* headers, const char* const* items,
40                  int initial_selection) override;
41   int SelectMenu(int sel) override;
42 
43  protected:
44   // progress bar vertical position, it's centered horizontally
45   const int kProgressBarBaseline;
46 
47   // Unusable rows when displaying the recovery menu, including the lines for headers (Android
48   // Recovery, build id and etc) and the bottom lines that may otherwise go out of the screen.
49   const int kMenuUnusableRows;
50 
51   int GetProgressBaseline() const override;
52 
53   bool InitTextParams() override;
54 
55   void update_progress_locked() override;
56 
57   void PrintV(const char*, bool, va_list) override;
58 
59  private:
60   GRSurface* backgroundIcon[5];
61 
62   static const int kMaxCols = 96;
63   static const int kMaxRows = 96;
64 
65   // Number of text rows seen on screen
66   int visible_text_rows;
67 
68   const char* const* menu_headers_;
69   int menu_start, menu_end;
70 
71   pthread_t progress_t;
72 
73   void draw_background_locked() override;
74   void draw_screen_locked() override;
75 
76   void PutChar(char);
77 };
78 
79 #endif  // RECOVERY_WEAR_UI_H
80