blob: fddf4e71e16a536f430c9643f7f627c65369516c [file] [log] [blame]
Sen Jiangd5304492016-12-09 16:20:49 -08001/*
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 Bao1d156b92018-05-02 12:43:18 -070020#include <functional>
21#include <string>
Tao Bao1fe1afe2018-05-01 15:56:05 -070022#include <vector>
Tao Bao1d156b92018-05-02 12:43:18 -070023
Sen Jiangd5304492016-12-09 16:20:49 -080024#include "ui.h"
25
26// Stub implementation of RecoveryUI for devices without screen.
27class StubRecoveryUI : public RecoveryUI {
28 public:
29 StubRecoveryUI() = default;
30
Jerry Zhang2dea53e2018-05-02 17:15:03 -070031 std::string GetLocale() override {
32 return "";
33 }
Tao Bao99f0d9e2016-10-13 12:46:38 -070034 void SetBackground(Icon /* icon */) override {}
35 void SetSystemUpdateText(bool /* security_update */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080036
37 // progress indicator
Tao Bao99f0d9e2016-10-13 12:46:38 -070038 void SetProgressType(ProgressType /* type */) override {}
39 void ShowProgress(float /* portion */, float /* seconds */) override {}
40 void SetProgress(float /* fraction */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080041
Tao Bao99f0d9e2016-10-13 12:46:38 -070042 void SetStage(int /* current */, int /* max */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080043
44 // text log
Tao Bao99f0d9e2016-10-13 12:46:38 -070045 void ShowText(bool /* visible */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080046 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 Bao99f0d9e2016-10-13 12:46:38 -070060 void PrintOnScreenOnly(const char* /* fmt */, ...) override {}
Tao Bao1d156b92018-05-02 12:43:18 -070061 void ShowFile(const std::string& /* filename */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080062
63 // menu display
Tao Bao1fe1afe2018-05-01 15:56:05 -070064 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 Bao3aec6962018-04-20 09:24:58 -070068 return initial_selection;
Sen Jiangd5304492016-12-09 16:20:49 -080069 }
Sen Jiangd5304492016-12-09 16:20:49 -080070};
71
72#endif // RECOVERY_STUB_UI_H