summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-09-03 10:12:11 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-09-03 10:12:11 +0200
commitbf97fce541a76405ff1ffac71044f18f4674dbcb (patch)
tree2e0391630bbed7622f4f6c79828c215bb229af2c
parentrelease-request-48587b2e-b0d9-4e33-ae5f-05bd16bc9d6f-for-git_pi-release-4308806 snap-temp-L91400000098269614 (diff)
parentMerge "wear_ui: Remove PrintOnScreenOnly() and PrintV()." am: 8c753f6253 am: 0cada4da99 am: 0f7d56fe81 (diff)
downloadandroid_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.tar
android_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.tar.gz
android_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.tar.bz2
android_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.tar.lz
android_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.tar.xz
android_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.tar.zst
android_bootable_recovery-bf97fce541a76405ff1ffac71044f18f4674dbcb.zip
-rw-r--r--wear_ui.cpp74
-rw-r--r--wear_ui.h11
2 files changed, 9 insertions, 76 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 85c8f835d..670050a0b 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -32,8 +32,8 @@
#include <vector>
#include <android-base/properties.h>
-#include <android-base/strings.h>
#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
#include <minui/minui.h>
#include "common.h"
@@ -50,8 +50,6 @@ WearRecoveryUI::WearRecoveryUI()
loop_frames = 60;
touch_screen_allowed_ = true;
-
- for (size_t i = 0; i < 5; i++) backgroundIcon[i] = NULL;
}
int WearRecoveryUI::GetProgressBaseline() const {
@@ -67,24 +65,12 @@ void WearRecoveryUI::draw_background_locked() {
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
if (currentIcon != NONE) {
- GRSurface* surface;
- if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) {
- if (!intro_done) {
- surface = introFrames[current_frame];
- } else {
- surface = loopFrames[current_frame];
- }
- } else {
- surface = backgroundIcon[currentIcon];
- }
-
- int width = gr_get_width(surface);
- int height = gr_get_height(surface);
-
- int x = (gr_fb_width() - width) / 2;
- int y = (gr_fb_height() - height) / 2;
-
- gr_blit(surface, 0, 0, width, height, x, y);
+ GRSurface* frame = GetCurrentFrame();
+ int frame_width = gr_get_width(frame);
+ int frame_height = gr_get_height(frame);
+ int frame_x = (gr_fb_width() - frame_width) / 2;
+ int frame_y = (gr_fb_height() - frame_height) / 2;
+ gr_blit(frame, 0, 0, frame_width, frame_height, frame_x, frame_y);
}
}
@@ -177,20 +163,6 @@ void WearRecoveryUI::update_progress_locked() {
gr_flip();
}
-bool WearRecoveryUI::Init(const std::string& locale) {
- if (!ScreenRecoveryUI::Init(locale)) {
- return false;
- }
-
- LoadBitmap("icon_error", &backgroundIcon[ERROR]);
- backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
-
- // This leaves backgroundIcon[INSTALLING_UPDATE] and backgroundIcon[ERASING]
- // as NULL which is fine since draw_background_locked() doesn't use them.
-
- return true;
-}
-
void WearRecoveryUI::SetStage(int current, int max) {
}
@@ -340,35 +312,3 @@ void WearRecoveryUI::ShowFile(const char* filename) {
ShowFile(fp);
fclose(fp);
}
-
-void WearRecoveryUI::PrintOnScreenOnly(const char *fmt, ...) {
- va_list ap;
- va_start(ap, fmt);
- PrintV(fmt, false, ap);
- va_end(ap);
-}
-
-void WearRecoveryUI::PrintV(const char* fmt, bool copy_to_stdout, va_list ap) {
- std::string str;
- android::base::StringAppendV(&str, fmt, ap);
-
- if (copy_to_stdout) {
- fputs(str.c_str(), stdout);
- }
-
- pthread_mutex_lock(&updateMutex);
- if (text_rows_ > 0 && text_cols_ > 0) {
- for (const char* ptr = str.c_str(); *ptr != '\0'; ++ptr) {
- if (*ptr == '\n' || text_col_ >= text_cols_) {
- text_[text_row_][text_col_] = '\0';
- text_col_ = 0;
- text_row_ = (text_row_ + 1) % text_rows_;
- if (text_row_ == text_top_) text_top_ = (text_top_ + 1) % text_rows_;
- }
- if (*ptr != '\n') text_[text_row_][text_col_++] = *ptr;
- }
- text_[text_row_][text_col_] = '\0';
- update_screen_locked();
- }
- pthread_mutex_unlock(&updateMutex);
-}
diff --git a/wear_ui.h b/wear_ui.h
index 9731f4161..92ef813f3 100644
--- a/wear_ui.h
+++ b/wear_ui.h
@@ -25,13 +25,10 @@ class WearRecoveryUI : public ScreenRecoveryUI {
public:
WearRecoveryUI();
- bool Init(const std::string& locale) override;
-
void SetStage(int current, int max) override;
// printing messages
void Print(const char* fmt, ...) override;
- void PrintOnScreenOnly(const char* fmt, ...) override __printflike(2, 3);
void ShowFile(const char* filename) override;
void ShowFile(FILE* fp) override;
@@ -52,17 +49,13 @@ class WearRecoveryUI : public ScreenRecoveryUI {
void update_progress_locked() override;
- void PrintV(const char*, bool, va_list) override;
-
private:
- GRSurface* backgroundIcon[5];
-
- int menu_start, menu_end;
-
void draw_background_locked() override;
void draw_screen_locked() override;
void PutChar(char);
+
+ int menu_start, menu_end;
};
#endif // RECOVERY_WEAR_UI_H