summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2015-02-03 09:56:57 -0800
committerTom Marshall <tdm@cyngn.com>2015-11-25 15:35:47 -0800
commitf028ccd3443a4526c245c8c664b37588be301eb2 (patch)
tree6608d58a19aa2821157b01b8754a8805a12ba7dd
parentd644eb58fde7d39a416850af3caeb4cbce514ec8 (diff)
downloadbootable_recovery-f028ccd3443a4526c245c8c664b37588be301eb2.zip
bootable_recovery-f028ccd3443a4526c245c8c664b37588be301eb2.tar.gz
bootable_recovery-f028ccd3443a4526c245c8c664b37588be301eb2.tar.bz2
recovery: Headless mode
Change-Id: I6b54bde65264aee99cb51a19436e82054b31fe74
-rw-r--r--recovery.cpp13
-rw-r--r--res-hdpi/images/icon_headless.pngbin0 -> 1155 bytes
-rw-r--r--res-mdpi/images/icon_headless.pngbin0 -> 734 bytes
-rw-r--r--res-xhdpi/images/icon_headless.pngbin0 -> 1536 bytes
-rw-r--r--res-xxhdpi/images/icon_headless.pngbin0 -> 2395 bytes
-rw-r--r--res-xxxhdpi/images/icon_headless.pngbin0 -> 3300 bytes
-rw-r--r--screen_ui.cpp15
-rw-r--r--screen_ui.h1
-rw-r--r--ui.h3
-rw-r--r--verifier_test.cpp1
10 files changed, 31 insertions, 2 deletions
diff --git a/recovery.cpp b/recovery.cpp
index f1c65ce..a4a4a64 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -97,6 +97,7 @@ static OemLockOp oem_lock = OEM_LOCK_NONE;
static const struct option OPTIONS[] = {
{ "send_intent", required_argument, NULL, 'i' },
{ "update_package", required_argument, NULL, 'u' },
+ { "headless", no_argument, NULL, 'h' },
{ "wipe_data", no_argument, NULL, 'w' },
{ "wipe_cache", no_argument, NULL, 'c' },
{ "wipe_media", no_argument, NULL, 'm' },
@@ -1304,6 +1305,7 @@ main(int argc, char **argv) {
bool show_text = false;
bool sideload = false;
bool sideload_auto_reboot = false;
+ bool headless = false;
bool just_exit = false;
bool shutdown_after = false;
@@ -1312,6 +1314,7 @@ main(int argc, char **argv) {
switch (arg) {
case 'i': send_intent = optarg; break;
case 'u': update_package = optarg; break;
+ case 'h': headless = true; break;
case 'w': should_wipe_data = true; break;
case 'c': should_wipe_cache = true; break;
case 't': show_text = true; break;
@@ -1485,7 +1488,15 @@ main(int argc, char **argv) {
}
Device::BuiltinAction after = shutdown_after ? Device::SHUTDOWN : Device::REBOOT;
- if ((status != INSTALL_SUCCESS && !sideload_auto_reboot) || ui->IsTextVisible()) {
+ if (headless) {
+ ui->ShowText(true);
+ ui->SetHeadlessMode();
+ finish_recovery(NULL);
+ for (;;) {
+ pause();
+ }
+ }
+ else if ((status != INSTALL_SUCCESS && !sideload_auto_reboot) || ui->IsTextVisible()) {
Device::BuiltinAction temp = prompt_and_wait(device, status);
if (temp != Device::NO_ACTION) {
after = temp;
diff --git a/res-hdpi/images/icon_headless.png b/res-hdpi/images/icon_headless.png
new file mode 100644
index 0000000..780836f
--- /dev/null
+++ b/res-hdpi/images/icon_headless.png
Binary files differ
diff --git a/res-mdpi/images/icon_headless.png b/res-mdpi/images/icon_headless.png
new file mode 100644
index 0000000..5d134cd
--- /dev/null
+++ b/res-mdpi/images/icon_headless.png
Binary files differ
diff --git a/res-xhdpi/images/icon_headless.png b/res-xhdpi/images/icon_headless.png
new file mode 100644
index 0000000..af283e2
--- /dev/null
+++ b/res-xhdpi/images/icon_headless.png
Binary files differ
diff --git a/res-xxhdpi/images/icon_headless.png b/res-xxhdpi/images/icon_headless.png
new file mode 100644
index 0000000..09a8234
--- /dev/null
+++ b/res-xxhdpi/images/icon_headless.png
Binary files differ
diff --git a/res-xxxhdpi/images/icon_headless.png b/res-xxxhdpi/images/icon_headless.png
new file mode 100644
index 0000000..a715e3f
--- /dev/null
+++ b/res-xxxhdpi/images/icon_headless.png
Binary files differ
diff --git a/screen_ui.cpp b/screen_ui.cpp
index aef714b..992210b 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -282,6 +282,9 @@ void ScreenRecoveryUI::draw_dialog()
}
else {
draw_background_locked(dialog_icon);
+ if (dialog_icon == HEADLESS) {
+ return;
+ }
}
draw_header_icon();
@@ -522,6 +525,7 @@ void ScreenRecoveryUI::Init() {
LoadBitmap("icon_info", &backgroundIcon[D_INFO]);
LoadBitmap("icon_error", &backgroundIcon[D_ERROR]);
backgroundIcon[NO_COMMAND] = backgroundIcon[D_ERROR];
+ LoadBitmap("icon_headless", &backgroundIcon[HEADLESS]);
LoadBitmap("progress_empty", &progressBarEmpty);
LoadBitmap("progress_fill", &progressBarFill);
@@ -802,6 +806,17 @@ void ScreenRecoveryUI::DialogDismiss()
pthread_mutex_unlock(&updateMutex);
}
+void ScreenRecoveryUI::SetHeadlessMode()
+{
+ pthread_mutex_lock(&updateMutex);
+ free(dialog_text);
+ dialog_text = strdup("");
+ dialog_show_log = false;
+ dialog_icon = HEADLESS;
+ update_screen_locked();
+ pthread_mutex_unlock(&updateMutex);
+}
+
void ScreenRecoveryUI::StartMenu(const char* const * headers, const char* const * items,
int initial_selection) {
pthread_mutex_lock(&updateMutex);
diff --git a/screen_ui.h b/screen_ui.h
index fff0f0e..b03b6ef 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -58,6 +58,7 @@ class ScreenRecoveryUI : public RecoveryUI {
int DialogShowing() const { return (dialog_text != NULL); }
bool DialogDismissable() const { return (dialog_icon == D_ERROR); }
void DialogDismiss();
+ void SetHeadlessMode();
// menu display
virtual int MenuItemStart() const { return menu_item_start_; }
diff --git a/ui.h b/ui.h
index df7fbde..abe4bca 100644
--- a/ui.h
+++ b/ui.h
@@ -106,7 +106,7 @@ class RecoveryUI {
virtual void SetLocale(const char* locale) = 0;
// Set the overall recovery state ("background image").
- enum Icon { NONE, INSTALLING_UPDATE, VIEWING_LOG, ERASING, NO_COMMAND, D_INFO, D_ERROR, NR_ICONS };
+ enum Icon { NONE, INSTALLING_UPDATE, VIEWING_LOG, ERASING, NO_COMMAND, D_INFO, D_ERROR, HEADLESS, NR_ICONS };
virtual void SetBackground(Icon icon) = 0;
// --- progress indicator ---
@@ -145,6 +145,7 @@ class RecoveryUI {
virtual int DialogShowing() const = 0;
virtual bool DialogDismissable() const = 0;
virtual void DialogDismiss() = 0;
+ virtual void SetHeadlessMode() = 0;
// --- key handling ---
diff --git a/verifier_test.cpp b/verifier_test.cpp
index d97e115..623ae64 100644
--- a/verifier_test.cpp
+++ b/verifier_test.cpp
@@ -156,6 +156,7 @@ class FakeUI : public RecoveryUI {
virtual int DialogShowing() const { return 0; }
bool DialogDismissable() const { return false; }
virtual void DialogDismiss() {}
+ virtual void SetHeadlessMode() {}
void StartMenu(const char* const * headers, const char* const * items,
int initial_selection) { }