blob: 362aab443247730fe7703f784bea86925b501e1e [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>
22
Sen Jiangd5304492016-12-09 16:20:49 -080023#include "ui.h"
24
25// Stub implementation of RecoveryUI for devices without screen.
26class StubRecoveryUI : public RecoveryUI {
27 public:
28 StubRecoveryUI() = default;
29
Tao Bao99f0d9e2016-10-13 12:46:38 -070030 void SetBackground(Icon /* icon */) override {}
31 void SetSystemUpdateText(bool /* security_update */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080032
33 // progress indicator
Tao Bao99f0d9e2016-10-13 12:46:38 -070034 void SetProgressType(ProgressType /* type */) override {}
35 void ShowProgress(float /* portion */, float /* seconds */) override {}
36 void SetProgress(float /* fraction */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080037
Tao Bao99f0d9e2016-10-13 12:46:38 -070038 void SetStage(int /* current */, int /* max */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080039
40 // text log
Tao Bao99f0d9e2016-10-13 12:46:38 -070041 void ShowText(bool /* visible */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080042 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 Bao99f0d9e2016-10-13 12:46:38 -070056 void PrintOnScreenOnly(const char* /* fmt */, ...) override {}
Tao Bao1d156b92018-05-02 12:43:18 -070057 void ShowFile(const std::string& /* filename */) override {}
Sen Jiangd5304492016-12-09 16:20:49 -080058
59 // menu display
Tao Bao3aec6962018-04-20 09:24:58 -070060 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 Jiangd5304492016-12-09 16:20:49 -080064 }
Sen Jiangd5304492016-12-09 16:20:49 -080065};
66
67#endif // RECOVERY_STUB_UI_H