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