Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
Tom Marshall | 820517b | 2019-01-14 14:28:55 -0800 | [diff] [blame] | 3 | * Copyright (C) 2019 The LineageOS Project |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef RECOVERY_STUB_UI_H |
| 19 | #define RECOVERY_STUB_UI_H |
| 20 | |
| 21 | #include "ui.h" |
| 22 | |
| 23 | // Stub implementation of RecoveryUI for devices without screen. |
| 24 | class StubRecoveryUI : public RecoveryUI { |
| 25 | public: |
| 26 | StubRecoveryUI() = default; |
| 27 | |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 28 | void SetBackground(Icon /* icon */) override {} |
| 29 | void SetSystemUpdateText(bool /* security_update */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 30 | |
| 31 | // progress indicator |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 32 | void SetProgressType(ProgressType /* type */) override {} |
| 33 | void ShowProgress(float /* portion */, float /* seconds */) override {} |
| 34 | void SetProgress(float /* fraction */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 35 | |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 36 | void SetStage(int /* current */, int /* max */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 37 | |
| 38 | // text log |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 39 | void ShowText(bool /* visible */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 40 | bool IsTextVisible() override { |
| 41 | return false; |
| 42 | } |
| 43 | bool WasTextEverVisible() override { |
| 44 | return false; |
| 45 | } |
Alessandro Astone | 20c8d41 | 2019-04-01 11:11:33 +0200 | [diff] [blame] | 46 | void UpdateScreenOnPrint(bool /* update */) override{}; |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 47 | |
| 48 | // printing messages |
| 49 | void Print(const char* fmt, ...) override { |
| 50 | va_list ap; |
| 51 | va_start(ap, fmt); |
| 52 | vprintf(fmt, ap); |
| 53 | va_end(ap); |
| 54 | } |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 55 | void PrintOnScreenOnly(const char* /* fmt */, ...) override {} |
Tom Marshall | 820517b | 2019-01-14 14:28:55 -0800 | [diff] [blame] | 56 | int ShowFile(const char* /* filename */) override { |
| 57 | return -1; |
| 58 | } |
Tom Marshall | f780f1c | 2018-03-01 23:51:51 +0100 | [diff] [blame] | 59 | void Redraw() override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 60 | |
| 61 | // menu display |
Tom Marshall | 820517b | 2019-01-14 14:28:55 -0800 | [diff] [blame] | 62 | void StartMenu(bool /* is_main */, menu_type_t /* type */, const char* const* /* headers */, |
| 63 | const MenuItemVector& /* items */, int /* initial_selection */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 64 | int SelectMenu(int sel) override { |
| 65 | return sel; |
| 66 | } |
Tom Marshall | 820517b | 2019-01-14 14:28:55 -0800 | [diff] [blame] | 67 | int SelectMenu(const Point& /* point */) override { |
| 68 | return 0; |
| 69 | } |
Alessandro Astone | d6eb74e | 2019-03-28 22:02:02 +0100 | [diff] [blame] | 70 | int ScrollMenu(int /* updown */) override { |
| 71 | return 0; |
| 72 | } |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 73 | void EndMenu() override {} |
Tom Marshall | 820517b | 2019-01-14 14:28:55 -0800 | [diff] [blame] | 74 | |
| 75 | bool MenuShowing() const { |
| 76 | return true; |
| 77 | } |
| 78 | bool MenuScrollable() const { |
| 79 | return true; |
| 80 | } |
| 81 | int MenuItemStart() const { |
| 82 | return 0; |
| 83 | } |
| 84 | int MenuItemHeight() const { |
| 85 | return 1; |
| 86 | } |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | #endif // RECOVERY_STUB_UI_H |