Add a stub recovery UI.

This allows recovery to work on devices without screen.
The stub recovery UI does nothing except print to stdout.

Test: write 'recovery\n--wipe_data\n--reason=wipe_data_from_ota\n'
      to misc and boot to recovery on a device without screen.
Bug: 33175036

Change-Id: Icde698aa2e2e29f4b3d0532dfd3c6a939ac2bc63
This commit is contained in:
Sen Jiang
2016-12-13 13:29:33 -08:00
parent d6a5005fcb
commit d530449e54
9 changed files with 102 additions and 17 deletions
+11 -4
View File
@@ -448,17 +448,22 @@ void ScreenRecoveryUI::SetSystemUpdateText(bool security_update) {
Redraw();
}
void ScreenRecoveryUI::InitTextParams() {
gr_init();
bool ScreenRecoveryUI::InitTextParams() {
if (gr_init() < 0) {
return false;
}
gr_font_size(gr_sys_font(), &char_width_, &char_height_);
text_rows_ = gr_fb_height() / char_height_;
text_cols_ = gr_fb_width() / char_width_;
return true;
}
void ScreenRecoveryUI::Init() {
bool ScreenRecoveryUI::Init() {
RecoveryUI::Init();
InitTextParams();
if (!InitTextParams()) {
return false;
}
density_ = static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f;
@@ -493,6 +498,8 @@ void ScreenRecoveryUI::Init() {
LoadAnimation();
pthread_create(&progress_thread_, nullptr, ProgressThreadStartRoutine, this);
return true;
}
void ScreenRecoveryUI::LoadAnimation() {