No Description

stub_ui.h 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #ifndef RECOVERY_STUB_UI_H
  17. #define RECOVERY_STUB_UI_H
  18. #include "ui.h"
  19. // Stub implementation of RecoveryUI for devices without screen.
  20. class StubRecoveryUI : public RecoveryUI {
  21. public:
  22. StubRecoveryUI() = default;
  23. void SetBackground(Icon /* icon */) override {}
  24. void SetSystemUpdateText(bool /* security_update */) override {}
  25. // progress indicator
  26. void SetProgressType(ProgressType /* type */) override {}
  27. void ShowProgress(float /* portion */, float /* seconds */) override {}
  28. void SetProgress(float /* fraction */) override {}
  29. void SetStage(int /* current */, int /* max */) override {}
  30. // text log
  31. void ShowText(bool /* visible */) override {}
  32. bool IsTextVisible() override {
  33. return false;
  34. }
  35. bool WasTextEverVisible() override {
  36. return false;
  37. }
  38. // printing messages
  39. void Print(const char* fmt, ...) override {
  40. va_list ap;
  41. va_start(ap, fmt);
  42. vprintf(fmt, ap);
  43. va_end(ap);
  44. }
  45. void PrintOnScreenOnly(const char* /* fmt */, ...) override {}
  46. int ShowFile(const char* /* filename */) override { return -1; }
  47. void Redraw() override {}
  48. // menu display
  49. void StartMenu(bool /* is_main */,
  50. menu_type_t /* type */,
  51. const char* const* /* headers */,
  52. const MenuItemVector& /* items */,
  53. int /* initial_selection */) override {}
  54. int SelectMenu(int sel) override {
  55. return sel;
  56. }
  57. int SelectMenu(const Point& /* point */) override {
  58. return 0;
  59. }
  60. void EndMenu() override {}
  61. bool MenuShowing() const { return true; }
  62. bool MenuScrollable() const { return true; }
  63. int MenuItemStart() const { return 0; }
  64. int MenuItemHeight() const { return 1; }
  65. };
  66. #endif // RECOVERY_STUB_UI_H