Merge changes Icb6f7466,Ibf6238c9 am: eef231567c am: d1fa3c2380
am: 2eb2c0b276
Change-Id: I228c3ccfa659b1d81e841eb66b9e446d665dd8ce
This commit is contained in:
+12
@@ -93,6 +93,18 @@ endif
|
|||||||
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
|
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
|
||||||
LOCAL_CFLAGS += -Wno-unused-parameter -Werror
|
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 += \
|
LOCAL_C_INCLUDES += \
|
||||||
system/vold \
|
system/vold \
|
||||||
|
|
||||||
|
|||||||
+67
-67
@@ -43,8 +43,6 @@
|
|||||||
#include "screen_ui.h"
|
#include "screen_ui.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
#define TEXT_INDENT 4
|
|
||||||
|
|
||||||
// Return the current time as a double (including fractions of a second).
|
// Return the current time as a double (including fractions of a second).
|
||||||
static double now() {
|
static double now() {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@@ -53,7 +51,10 @@ static double now() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScreenRecoveryUI::ScreenRecoveryUI()
|
ScreenRecoveryUI::ScreenRecoveryUI()
|
||||||
: currentIcon(NONE),
|
: 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),
|
progressBarType(EMPTY),
|
||||||
progressScopeStart(0),
|
progressScopeStart(0),
|
||||||
progressScopeSize(0),
|
progressScopeSize(0),
|
||||||
@@ -282,65 +283,66 @@ static const char* LONG_PRESS_HELP[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// Redraw everything on the screen. Does not flip pages.
|
// Redraws everything on the screen. Does not flip pages. Should only be called with updateMutex
|
||||||
// Should only be called with updateMutex locked.
|
// locked.
|
||||||
void ScreenRecoveryUI::draw_screen_locked() {
|
void ScreenRecoveryUI::draw_screen_locked() {
|
||||||
if (!show_text) {
|
if (!show_text) {
|
||||||
draw_background_locked();
|
draw_background_locked();
|
||||||
draw_foreground_locked();
|
draw_foreground_locked();
|
||||||
} else {
|
return;
|
||||||
gr_color(0, 0, 0, 255);
|
}
|
||||||
gr_clear();
|
|
||||||
|
|
||||||
int y = 0;
|
gr_color(0, 0, 0, 255);
|
||||||
if (show_menu) {
|
gr_clear();
|
||||||
std::string recovery_fingerprint =
|
|
||||||
android::base::GetProperty("ro.bootimage.build.fingerprint", "");
|
|
||||||
|
|
||||||
SetColor(INFO);
|
static constexpr int TEXT_INDENT = 4;
|
||||||
DrawTextLine(TEXT_INDENT, &y, "Android Recovery", true);
|
int x = TEXT_INDENT + kMarginWidth;
|
||||||
for (auto& chunk : android::base::Split(recovery_fingerprint, ":")) {
|
int y = kMarginHeight;
|
||||||
DrawTextLine(TEXT_INDENT, &y, chunk.c_str(), false);
|
if (show_menu) {
|
||||||
}
|
std::string recovery_fingerprint =
|
||||||
DrawTextLines(TEXT_INDENT, &y, HasThreeButtons() ? REGULAR_HELP : LONG_PRESS_HELP);
|
android::base::GetProperty("ro.bootimage.build.fingerprint", "");
|
||||||
|
|
||||||
SetColor(HEADER);
|
SetColor(INFO);
|
||||||
DrawTextLines(TEXT_INDENT, &y, menu_headers_);
|
DrawTextLine(x, &y, "Android Recovery", true);
|
||||||
|
for (const auto& chunk : android::base::Split(recovery_fingerprint, ":")) {
|
||||||
SetColor(MENU);
|
DrawTextLine(x, &y, chunk.c_str(), false);
|
||||||
DrawHorizontalRule(&y);
|
|
||||||
y += 4;
|
|
||||||
for (int i = 0; i < menu_items; ++i) {
|
|
||||||
if (i == menu_sel) {
|
|
||||||
// Draw the highlight bar.
|
|
||||||
SetColor(IsLongPress() ? MENU_SEL_BG_ACTIVE : MENU_SEL_BG);
|
|
||||||
DrawHighlightBar(0, y - 2, gr_fb_width(), char_height_ + 4);
|
|
||||||
// Bold white text for the selected item.
|
|
||||||
SetColor(MENU_SEL_FG);
|
|
||||||
DrawTextLine(TEXT_INDENT, &y, menu_[i], true);
|
|
||||||
SetColor(MENU);
|
|
||||||
} else {
|
|
||||||
DrawTextLine(TEXT_INDENT, &y, menu_[i], false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DrawHorizontalRule(&y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// display from the bottom up, until we hit the top of the
|
|
||||||
// screen, the bottom of the menu, or we've displayed the
|
|
||||||
// entire text buffer.
|
|
||||||
SetColor(LOG);
|
|
||||||
int row = (text_top_ + text_rows_ - 1) % text_rows_;
|
|
||||||
size_t count = 0;
|
|
||||||
for (int ty = gr_fb_height() - char_height_ - log_bottom_offset_;
|
|
||||||
ty >= y && count < text_rows_;
|
|
||||||
ty -= char_height_, ++count) {
|
|
||||||
int temp_y = ty;
|
|
||||||
DrawTextLine(0, &temp_y, text_[row], false);
|
|
||||||
--row;
|
|
||||||
if (row < 0) row = text_rows_ - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
DrawTextLines(x, &y, HasThreeButtons() ? REGULAR_HELP : LONG_PRESS_HELP);
|
||||||
|
|
||||||
|
SetColor(HEADER);
|
||||||
|
DrawTextLines(x, &y, menu_headers_);
|
||||||
|
|
||||||
|
SetColor(MENU);
|
||||||
|
DrawHorizontalRule(&y);
|
||||||
|
y += 4;
|
||||||
|
for (int i = 0; i < menu_items; ++i) {
|
||||||
|
if (i == menu_sel) {
|
||||||
|
// Draw the highlight bar.
|
||||||
|
SetColor(IsLongPress() ? MENU_SEL_BG_ACTIVE : MENU_SEL_BG);
|
||||||
|
DrawHighlightBar(0, y - 2, gr_fb_width(), char_height_ + 4);
|
||||||
|
// Bold white text for the selected item.
|
||||||
|
SetColor(MENU_SEL_FG);
|
||||||
|
DrawTextLine(x, &y, menu_[i], true);
|
||||||
|
SetColor(MENU);
|
||||||
|
} else {
|
||||||
|
DrawTextLine(x, &y, menu_[i], false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DrawHorizontalRule(&y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display from the bottom up, until we hit the top of the screen, the bottom of the menu, or
|
||||||
|
// we've displayed the entire text buffer.
|
||||||
|
SetColor(LOG);
|
||||||
|
int row = (text_top_ + text_rows_ - 1) % text_rows_;
|
||||||
|
size_t count = 0;
|
||||||
|
for (int ty = gr_fb_height() - kMarginHeight - char_height_ - log_bottom_offset_;
|
||||||
|
ty >= y && count < text_rows_; ty -= char_height_, ++count) {
|
||||||
|
int temp_y = ty;
|
||||||
|
DrawTextLine(x, &temp_y, text_[row], false);
|
||||||
|
--row;
|
||||||
|
if (row < 0) row = text_rows_ - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redraw everything on the screen and flip the screen (make it visible).
|
// Redraw everything on the screen and flip the screen (make it visible).
|
||||||
@@ -450,15 +452,15 @@ void ScreenRecoveryUI::SetSystemUpdateText(bool security_update) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ScreenRecoveryUI::InitTextParams() {
|
bool ScreenRecoveryUI::InitTextParams() {
|
||||||
if (gr_init() < 0) {
|
if (gr_init() < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gr_font_size(gr_sys_font(), &char_width_, &char_height_);
|
gr_font_size(gr_sys_font(), &char_width_, &char_height_);
|
||||||
text_rows_ = gr_fb_height() / char_height_;
|
text_rows_ = (gr_fb_height() - kMarginHeight * 2) / char_height_;
|
||||||
text_cols_ = gr_fb_width() / char_width_;
|
text_cols_ = (gr_fb_width() - kMarginWidth * 2) / char_width_;
|
||||||
log_bottom_offset_ = 0;
|
log_bottom_offset_ = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScreenRecoveryUI::Init(const std::string& locale) {
|
bool ScreenRecoveryUI::Init(const std::string& locale) {
|
||||||
@@ -467,8 +469,6 @@ bool ScreenRecoveryUI::Init(const std::string& locale) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
density_ = static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f;
|
|
||||||
|
|
||||||
// Are we portrait or landscape?
|
// Are we portrait or landscape?
|
||||||
layout_ = (gr_fb_width() > gr_fb_height()) ? LANDSCAPE : PORTRAIT;
|
layout_ = (gr_fb_width() > gr_fb_height()) ? LANDSCAPE : PORTRAIT;
|
||||||
// Are we the large variant of our base layout?
|
// Are we the large variant of our base layout?
|
||||||
|
|||||||
+9
-2
@@ -72,10 +72,16 @@ class ScreenRecoveryUI : public RecoveryUI {
|
|||||||
void SetColor(UIElement e);
|
void SetColor(UIElement e);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Icon currentIcon;
|
// 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.
|
// The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi.
|
||||||
float density_;
|
const float density_;
|
||||||
|
|
||||||
|
Icon currentIcon;
|
||||||
|
|
||||||
// The layout to use.
|
// The layout to use.
|
||||||
int layout_;
|
int layout_;
|
||||||
|
|
||||||
@@ -136,6 +142,7 @@ class ScreenRecoveryUI : public RecoveryUI {
|
|||||||
|
|
||||||
int char_width_;
|
int char_width_;
|
||||||
int char_height_;
|
int char_height_;
|
||||||
|
|
||||||
pthread_mutex_t updateMutex;
|
pthread_mutex_t updateMutex;
|
||||||
|
|
||||||
virtual bool InitTextParams();
|
virtual bool InitTextParams();
|
||||||
|
|||||||
Reference in New Issue
Block a user