summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-06-21 03:11:21 +0200
committerTao Bao <tbao@google.com>2017-06-23 18:45:28 +0200
commit855eaffff674f0c90cf6fe107f8d10b50efc3965 (patch)
tree3321376f646731706c186ea61884ee342e1b96f6
parentscreen_ui: Allow setting screen margin space. (diff)
downloadandroid_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.tar
android_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.tar.gz
android_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.tar.bz2
android_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.tar.lz
android_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.tar.xz
android_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.tar.zst
android_bootable_recovery-855eaffff674f0c90cf6fe107f8d10b50efc3965.zip
Diffstat (limited to '')
-rw-r--r--Android.mk12
-rw-r--r--screen_ui.cpp16
-rw-r--r--screen_ui.h10
3 files changed, 25 insertions, 13 deletions
diff --git a/Android.mk b/Android.mk
index e619db031..5f3a8a45d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -92,6 +92,18 @@ endif
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
LOCAL_CFLAGS += -Wno-unused-parameter -Werror
+ifneq ($(TARGET_RECOVERY_UI_MARGIN_HEIGHT),)
+LOCAL_CFLAGS += -DRECOVERY_UI_MARGIN_HEIGHT=$(TARGET_RECOVERY_UI_MARGIN_HEIGHT)
+else
+LOCAL_CFLAGS += -DRECOVERY_UI_MARGIN_HEIGHT=0
+endif
+
+ifneq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
+LOCAL_CFLAGS += -DRECOVERY_UI_MARGIN_WIDTH=$(TARGET_RECOVERY_UI_MARGIN_WIDTH)
+else
+LOCAL_CFLAGS += -DRECOVERY_UI_MARGIN_WIDTH=0
+endif
+
LOCAL_C_INCLUDES += \
system/vold \
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 10e56dec4..4ca96a9b2 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -51,7 +51,9 @@ static double now() {
}
ScreenRecoveryUI::ScreenRecoveryUI()
- : density_(static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f),
+ : kMarginWidth(RECOVERY_UI_MARGIN_WIDTH),
+ kMarginHeight(RECOVERY_UI_MARGIN_HEIGHT),
+ density_(static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f),
currentIcon(NONE),
progressBarType(EMPTY),
progressScopeStart(0),
@@ -78,8 +80,6 @@ ScreenRecoveryUI::ScreenRecoveryUI()
animation_fps(30), // TODO: there's currently no way to infer this.
stage(-1),
max_stage(-1),
- margin_width_(0),
- margin_height_(0),
updateMutex(PTHREAD_MUTEX_INITIALIZER) {}
GRSurface* ScreenRecoveryUI::GetCurrentFrame() {
@@ -292,8 +292,8 @@ void ScreenRecoveryUI::draw_screen_locked() {
gr_clear();
static constexpr int TEXT_INDENT = 4;
- int x = TEXT_INDENT + margin_width_;
- int y = margin_height_;
+ int x = TEXT_INDENT + kMarginWidth;
+ int y = kMarginHeight;
if (show_menu) {
std::string recovery_fingerprint =
android::base::GetProperty("ro.bootimage.build.fingerprint", "");
@@ -333,7 +333,7 @@ void ScreenRecoveryUI::draw_screen_locked() {
SetColor(LOG);
int row = (text_top_ + text_rows_ - 1) % text_rows_;
size_t count = 0;
- for (int ty = gr_fb_height() - margin_height_ - char_height_;
+ for (int ty = gr_fb_height() - kMarginHeight - char_height_;
ty >= y && count < text_rows_; ty -= char_height_, ++count) {
gr_text(gr_sys_font(), 0, ty, text_[row], false);
--row;
@@ -453,8 +453,8 @@ bool ScreenRecoveryUI::InitTextParams() {
}
gr_font_size(gr_sys_font(), &char_width_, &char_height_);
- text_rows_ = (gr_fb_height() - margin_height_ * 2) / char_height_;
- text_cols_ = (gr_fb_width() - margin_width_ * 2) / char_width_;
+ text_rows_ = (gr_fb_height() - kMarginHeight * 2) / char_height_;
+ text_cols_ = (gr_fb_width() - kMarginWidth * 2) / char_width_;
return true;
}
diff --git a/screen_ui.h b/screen_ui.h
index 86cbd5cd3..58032d80b 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -72,6 +72,11 @@ class ScreenRecoveryUI : public RecoveryUI {
void SetColor(UIElement e);
protected:
+ // The margin that we don't want to use for showing texts (e.g. round screen, or screen with
+ // rounded corners).
+ const int kMarginWidth;
+ const int kMarginHeight;
+
// The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi.
const float density_;
@@ -137,11 +142,6 @@ class ScreenRecoveryUI : public RecoveryUI {
int char_width_;
int char_height_;
- // The margin that we don't want to use for showing texts (e.g. round screen, or screen with
- // rounded corners).
- int margin_width_;
- int margin_height_;
-
pthread_mutex_t updateMutex;
virtual bool InitTextParams();