From d530449e54bd327e9c26209ffa0490c6508afe6c Mon Sep 17 00:00:00 2001 From: Sen Jiang Date: Fri, 9 Dec 2016 16:20:49 -0800 Subject: 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 --- recovery.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'recovery.cpp') diff --git a/recovery.cpp b/recovery.cpp index e777c46cd..9152bb128 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -68,6 +68,7 @@ #include "roots.h" #include "rotate_logs.h" #include "screen_ui.h" +#include "stub_ui.h" #include "ui.h" static const struct option OPTIONS[] = { @@ -1495,8 +1496,11 @@ int main(int argc, char **argv) { Device* device = make_device(); ui = device->GetUI(); + if (!ui->Init()) { + printf("Failed to initialize UI, use stub UI instead."); + ui = new StubRecoveryUI(); + } ui->SetLocale(locale.c_str()); - ui->Init(); // Set background string to "installing security update" for security update, // otherwise set it to "installing system update". ui->SetSystemUpdateText(security_update); -- cgit v1.2.3