blob: e97598bb11fca5f67772d149e74fe40285f411c2 [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 void SetStage(int current, int max) override;
Tao Bao337db142015-08-20 14:52:57 -070029
Tao Bao5d2e3bd2017-06-23 22:23:50 -070030 // printing messages
31 void Print(const char* fmt, ...) override;
32 void PrintOnScreenOnly(const char* fmt, ...) override __printflike(2, 3);
33 void ShowFile(const char* filename) override;
34 void ShowFile(FILE* fp) override;
Tao Bao337db142015-08-20 14:52:57 -070035
Tao Bao5d2e3bd2017-06-23 22:23:50 -070036 // menu display
37 void StartMenu(const char* const* headers, const char* const* items,
38 int initial_selection) override;
39 int SelectMenu(int sel) override;
Tao Bao337db142015-08-20 14:52:57 -070040
Tao Bao5d2e3bd2017-06-23 22:23:50 -070041 protected:
42 // progress bar vertical position, it's centered horizontally
Tao Bao0470cee2017-08-02 17:11:04 -070043 const int kProgressBarBaseline;
Tao Bao337db142015-08-20 14:52:57 -070044
Tao Bao99b2d772017-06-23 22:47:03 -070045 // Unusable rows when displaying the recovery menu, including the lines for headers (Android
46 // Recovery, build id and etc) and the bottom lines that may otherwise go out of the screen.
Tao Baoeea3af32017-08-11 13:50:24 -070047 const int kMenuUnusableRows;
Tao Bao337db142015-08-20 14:52:57 -070048
Tao Bao99b2d772017-06-23 22:47:03 -070049 int GetProgressBaseline() const override;
Tao Bao337db142015-08-20 14:52:57 -070050
Tao Bao5d2e3bd2017-06-23 22:23:50 -070051 void update_progress_locked() override;
Damien Bargiacchiad8b5a62016-09-09 08:18:06 -070052
Tao Bao5d2e3bd2017-06-23 22:23:50 -070053 void PrintV(const char*, bool, va_list) override;
Tao Baob723f4f2015-12-11 15:18:51 -080054
Tao Bao5d2e3bd2017-06-23 22:23:50 -070055 private:
Tao Bao5d2e3bd2017-06-23 22:23:50 -070056 void draw_background_locked() override;
57 void draw_screen_locked() override;
Damien Bargiacchi5e7cfb92016-08-24 18:28:43 -070058
Tao Bao5d2e3bd2017-06-23 22:23:50 -070059 void PutChar(char);
Tao Bao79127102017-08-30 15:23:34 -070060
61 int menu_start, menu_end;
Tao Bao337db142015-08-20 14:52:57 -070062};
63
64#endif // RECOVERY_WEAR_UI_H