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 
SetBackground(Icon icon)27   void SetBackground(Icon icon) override {}
SetSystemUpdateText(bool security_update)28   void SetSystemUpdateText(bool security_update) override {}
29 
30   // progress indicator
SetProgressType(ProgressType type)31   void SetProgressType(ProgressType type) override {}
ShowProgress(float portion,float seconds)32   void ShowProgress(float portion, float seconds) override {}
SetProgress(float fraction)33   void SetProgress(float fraction) override {}
34 
SetStage(int current,int max)35   void SetStage(int current, int max) override {}
36 
37   // text log
ShowText(bool visible)38   void ShowText(bool visible) override {}
IsTextVisible()39   bool IsTextVisible() override {
40     return false;
41   }
WasTextEverVisible()42   bool WasTextEverVisible() override {
43     return false;
44   }
45 
46   // printing messages
Print(const char * fmt,...)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   }
PrintOnScreenOnly(const char * fmt,...)53   void PrintOnScreenOnly(const char* fmt, ...) override {}
ShowFile(const char * filename)54   void ShowFile(const char* filename) override {}
55 
56   // menu display
StartMenu(const char * const * headers,const char * const * items,int initial_selection)57   void StartMenu(const char* const* headers, const char* const* items,
58                  int initial_selection) override {}
SelectMenu(int sel)59   int SelectMenu(int sel) override {
60     return sel;
61   }
EndMenu()62   void EndMenu() override {}
63 };
64 
65 #endif  // RECOVERY_STUB_UI_H
66