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 /wear_ui.cpp
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
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp33
1 files changed, 33 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}