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