aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashant Malani2016-02-25 20:27:03 -0600
committerPrashant Malani2016-02-26 19:01:37 -0600
commit0eb41c3f370e89ff40cf1a3bd17e7b785b74641e (patch)
tree6897046ab6238e1879afeb16be5397787099b672
parent661f8a69f2b12f3244deed664ab69a9d2efad7fb (diff)
downloadplatform-bootable-recovery-0eb41c3f370e89ff40cf1a3bd17e7b785b74641e.tar.gz
platform-bootable-recovery-0eb41c3f370e89ff40cf1a3bd17e7b785b74641e.tar.xz
platform-bootable-recovery-0eb41c3f370e89ff40cf1a3bd17e7b785b74641e.zip
Fixes to wear recovery for N
Bug: 27336841 Change-Id: If4632e9791cce2c39590a4012687271f59a60af1
-rw-r--r--wear_ui.cpp33
-rw-r--r--wear_ui.h2
2 files changed, 35 insertions, 0 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 50aeb384..8a57cfff 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -36,6 +36,7 @@
36#include "ui.h" 36#include "ui.h"
37#include "cutils/properties.h" 37#include "cutils/properties.h"
38#include "android-base/strings.h" 38#include "android-base/strings.h"
39#include "android-base/stringprintf.h"
39 40
40static int char_width; 41static int char_width;
41static int char_height; 42static int char_height;
@@ -653,3 +654,35 @@ void WearRecoveryUI::ClearText() {
653 } 654 }
654 pthread_mutex_unlock(&updateMutex); 655 pthread_mutex_unlock(&updateMutex);
655} 656}
657
658void WearRecoveryUI::PrintOnScreenOnly(const char *fmt, ...) {
659 va_list ap;
660 va_start(ap, fmt);
661 PrintV(fmt, false, ap);
662 va_end(ap);
663}
664
665void WearRecoveryUI::PrintV(const char* fmt, bool copy_to_stdout, va_list ap) {
666 std::string str;
667 android::base::StringAppendV(&str, fmt, ap);
668
669 if (copy_to_stdout) {
670 fputs(str.c_str(), stdout);
671 }
672
673 pthread_mutex_lock(&updateMutex);
674 if (text_rows > 0 && text_cols > 0) {
675 for (const char* ptr = str.c_str(); *ptr != '\0'; ++ptr) {
676 if (*ptr == '\n' || text_col >= text_cols) {
677 text[text_row][text_col] = '\0';
678 text_col = 0;
679 text_row = (text_row + 1) % text_rows;
680 if (text_row == text_top) text_top = (text_top + 1) % text_rows;
681 }
682 if (*ptr != '\n') text[text_row][text_col++] = *ptr;
683 }
684 text[text_row][text_col] = '\0';
685 update_screen_locked();
686 }
687 pthread_mutex_unlock(&updateMutex);
688}
diff --git a/wear_ui.h b/wear_ui.h
index 63c1b6e6..768141cc 100644
--- a/wear_ui.h
+++ b/wear_ui.h
@@ -47,6 +47,7 @@ class WearRecoveryUI : public RecoveryUI {
47 47
48 // printing messages 48 // printing messages
49 void Print(const char* fmt, ...); 49 void Print(const char* fmt, ...);
50 void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3);
50 void ShowFile(const char* filename); 51 void ShowFile(const char* filename);
51 void ShowFile(FILE* fp); 52 void ShowFile(FILE* fp);
52 53
@@ -133,6 +134,7 @@ class WearRecoveryUI : public RecoveryUI {
133 void ClearText(); 134 void ClearText();
134 void DrawTextLine(int x, int* y, const char* line, bool bold); 135 void DrawTextLine(int x, int* y, const char* line, bool bold);
135 void DrawTextLines(int x, int* y, const char* const* lines); 136 void DrawTextLines(int x, int* y, const char* const* lines);
137 void PrintV(const char*, bool, va_list);
136}; 138};
137 139
138#endif // RECOVERY_WEAR_UI_H 140#endif // RECOVERY_WEAR_UI_H