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