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 <functional> 21 #include <string> 22 #include <vector> 23 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 GetLocale()31 std::string GetLocale() const override { 32 return ""; 33 } SetBackground(Icon)34 void SetBackground(Icon /* icon */) override {} SetSystemUpdateText(bool)35 void SetSystemUpdateText(bool /* security_update */) override {} 36 37 // progress indicator SetProgressType(ProgressType)38 void SetProgressType(ProgressType /* type */) override {} ShowProgress(float,float)39 void ShowProgress(float /* portion */, float /* seconds */) override {} SetProgress(float)40 void SetProgress(float /* fraction */) override {} 41 SetStage(int,int)42 void SetStage(int /* current */, int /* max */) override {} 43 44 // text log ShowText(bool)45 void ShowText(bool /* visible */) override {} IsTextVisible()46 bool IsTextVisible() override { 47 return false; 48 } WasTextEverVisible()49 bool WasTextEverVisible() override { 50 return false; 51 } 52 53 // printing messages Print(const char * fmt,...)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 } PrintOnScreenOnly(const char *,...)60 void PrintOnScreenOnly(const char* /* fmt */, ...) override {} ShowFile(const std::string &)61 void ShowFile(const std::string& /* filename */) override {} 62 63 // menu display 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; 68 ShowPromptWipeDataMenu(const std::vector<std::string> &,const std::vector<std::string> &,const std::function<int (int,bool)> &)69 size_t ShowPromptWipeDataMenu(const std::vector<std::string>& /* backup_headers */, 70 const std::vector<std::string>& /* backup_items */, 71 const std::function<int(int, bool)>& /* key_handle */) override { 72 return 0; 73 } 74 ShowPromptWipeDataConfirmationMenu(const std::vector<std::string> &,const std::vector<std::string> &,const std::function<int (int,bool)> &)75 size_t ShowPromptWipeDataConfirmationMenu( 76 const std::vector<std::string>& /* backup_headers */, 77 const std::vector<std::string>& /* backup_items */, 78 const std::function<int(int, bool)>& /* key_handle */) override { 79 return 0; 80 } 81 SetTitle(const std::vector<std::string> &)82 void SetTitle(const std::vector<std::string>& /* lines */) override {} 83 }; 84 85 #endif // RECOVERY_STUB_UI_H 86