blob: e228f9fb5711b04d63a0f06905a34d9be43f638c [file] [log] [blame]
Tao Bao337db142015-08-20 14:52:57 -07001/*
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
Prashant Malani7d9fd962016-03-08 13:18:45 -080020#include "screen_ui.h"
Tao Bao337db142015-08-20 14:52:57 -070021
Tao Bao736d59c2017-01-03 10:15:33 -080022#include <string>
23
Prashant Malani7d9fd962016-03-08 13:18:45 -080024class WearRecoveryUI : public ScreenRecoveryUI {
Tao Bao5d2e3bd2017-06-23 22:23:50 -070025 public:
26 WearRecoveryUI();
Tao Bao337db142015-08-20 14:52:57 -070027
Tao Bao5d2e3bd2017-06-23 22:23:50 -070028 bool Init(const std::string& locale) override;
Prashant Malanif7f9e502016-03-10 03:40:20 +000029
Tao Bao5d2e3bd2017-06-23 22:23:50 -070030 void SetStage(int current, int max) override;
Tao Bao337db142015-08-20 14:52:57 -070031
Tao Bao5d2e3bd2017-06-23 22:23:50 -070032 // 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;
Tao Bao337db142015-08-20 14:52:57 -070037
Tao Bao5d2e3bd2017-06-23 22:23:50 -070038 // menu display
39 void StartMenu(const char* const* headers, const char* const* items,
40 int initial_selection) override;
41 int SelectMenu(int sel) override;
Tao Bao337db142015-08-20 14:52:57 -070042
Tao Bao5d2e3bd2017-06-23 22:23:50 -070043 protected:
44 // progress bar vertical position, it's centered horizontally
45 int progress_bar_y;
Tao Bao337db142015-08-20 14:52:57 -070046
Tao Bao5d2e3bd2017-06-23 22:23:50 -070047 // outer of window
48 int outer_height, outer_width;
Tao Bao337db142015-08-20 14:52:57 -070049
Tao Bao5d2e3bd2017-06-23 22:23:50 -070050 // Unusable rows when displaying the recovery menu, including the lines
51 // for headers (Android Recovery, build id and etc) and the bottom lines
52 // that may otherwise go out of the screen.
53 int menu_unusable_rows;
Tao Bao337db142015-08-20 14:52:57 -070054
Tao Bao5d2e3bd2017-06-23 22:23:50 -070055 int GetProgressBaseline() override;
Tao Bao337db142015-08-20 14:52:57 -070056
Tao Bao5d2e3bd2017-06-23 22:23:50 -070057 bool InitTextParams() override;
Damien Bargiacchi5e7cfb92016-08-24 18:28:43 -070058
Tao Bao5d2e3bd2017-06-23 22:23:50 -070059 void update_progress_locked() override;
Damien Bargiacchiad8b5a62016-09-09 08:18:06 -070060
Tao Bao5d2e3bd2017-06-23 22:23:50 -070061 void PrintV(const char*, bool, va_list) override;
Tao Baob723f4f2015-12-11 15:18:51 -080062
Tao Bao5d2e3bd2017-06-23 22:23:50 -070063 private:
64 GRSurface* backgroundIcon[5];
Tao Bao337db142015-08-20 14:52:57 -070065
Tao Bao5d2e3bd2017-06-23 22:23:50 -070066 static const int kMaxCols = 96;
67 static const int kMaxRows = 96;
Tao Bao337db142015-08-20 14:52:57 -070068
Tao Bao5d2e3bd2017-06-23 22:23:50 -070069 // Number of text rows seen on screen
70 int visible_text_rows;
Tao Bao337db142015-08-20 14:52:57 -070071
Tao Bao5d2e3bd2017-06-23 22:23:50 -070072 const char* const* menu_headers_;
73 int menu_start, menu_end;
Tao Bao337db142015-08-20 14:52:57 -070074
Tao Bao5d2e3bd2017-06-23 22:23:50 -070075 pthread_t progress_t;
Tao Bao337db142015-08-20 14:52:57 -070076
Tao Bao5d2e3bd2017-06-23 22:23:50 -070077 void draw_background_locked() override;
78 void draw_screen_locked() override;
79 void draw_progress_locked();
Damien Bargiacchi5e7cfb92016-08-24 18:28:43 -070080
Tao Bao5d2e3bd2017-06-23 22:23:50 -070081 void PutChar(char);
82 void ClearText();
Tao Bao337db142015-08-20 14:52:57 -070083};
84
85#endif // RECOVERY_WEAR_UI_H