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 class WearRecoveryUI : public ScreenRecoveryUI { 23 public: 24 WearRecoveryUI(); 25 26 void Init() override; 27 28 void SetStage(int current, int max) override; 29 30 // 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; 35 36 // menu display 37 void StartMenu(const char* const * headers, const char* const * items, 38 int initial_selection) override; 39 int SelectMenu(int sel) override; 40 41 protected: 42 // progress bar vertical position, it's centered horizontally 43 int progress_bar_y; 44 45 // outer of window 46 int outer_height, outer_width; 47 48 // Unusable rows when displaying the recovery menu, including the lines 49 // for headers (Android Recovery, build id and etc) and the bottom lines 50 // that may otherwise go out of the screen. 51 int menu_unusable_rows; 52 53 int GetProgressBaseline() override; 54 55 void InitTextParams() override; 56 57 void update_progress_locked() override; 58 59 void PrintV(const char*, bool, va_list) override; 60 61 private: 62 GRSurface* backgroundIcon[5]; 63 64 static const int kMaxCols = 96; 65 static const int kMaxRows = 96; 66 67 // Number of text rows seen on screen 68 int visible_text_rows; 69 70 const char* const* menu_headers_; 71 int menu_start, menu_end; 72 73 pthread_t progress_t; 74 75 void draw_background_locked() override; 76 void draw_screen_locked() override; 77 void draw_progress_locked(); 78 79 void PutChar(char); 80 void ClearText(); 81 }; 82 83 #endif // RECOVERY_WEAR_UI_H 84