Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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_STUB_UI_H |
| 18 | #define RECOVERY_STUB_UI_H |
| 19 | |
| 20 | #include "ui.h" |
| 21 | |
| 22 | // Stub implementation of RecoveryUI for devices without screen. |
| 23 | class StubRecoveryUI : public RecoveryUI { |
| 24 | public: |
| 25 | StubRecoveryUI() = default; |
| 26 | |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 27 | void SetBackground(Icon /* icon */) override {} |
| 28 | void SetSystemUpdateText(bool /* security_update */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 29 | |
| 30 | // progress indicator |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 31 | void SetProgressType(ProgressType /* type */) override {} |
| 32 | void ShowProgress(float /* portion */, float /* seconds */) override {} |
| 33 | void SetProgress(float /* fraction */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 34 | |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 35 | void SetStage(int /* current */, int /* max */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 36 | |
| 37 | // text log |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 38 | void ShowText(bool /* visible */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 39 | bool IsTextVisible() override { |
| 40 | return false; |
| 41 | } |
| 42 | bool WasTextEverVisible() override { |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | // printing messages |
| 47 | void Print(const char* fmt, ...) override { |
| 48 | va_list ap; |
| 49 | va_start(ap, fmt); |
| 50 | vprintf(fmt, ap); |
| 51 | va_end(ap); |
| 52 | } |
Tao Bao | 99f0d9e | 2016-10-13 12:46:38 -0700 | [diff] [blame] | 53 | void PrintOnScreenOnly(const char* /* fmt */, ...) override {} |
| 54 | void ShowFile(const char* /* filename */) override {} |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 55 | |
| 56 | // menu display |
Tao Bao | 3aec696 | 2018-04-20 09:24:58 -0700 | [diff] [blame^] | 57 | int ShowMenu(const char* const* /* headers */, const char* const* /* items */, |
| 58 | int initial_selection, bool /* menu_only */, |
| 59 | const std::function<int(int, bool)>& /* key_handler */) override { |
| 60 | return initial_selection; |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 61 | } |
Sen Jiang | d530449 | 2016-12-09 16:20:49 -0800 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | #endif // RECOVERY_STUB_UI_H |