display error state on OTA failure

We need prompt_with_wait() to show either the ERROR or NO_COMMAND
state as appropriate.

Bug: 7221068
Change-Id: I191526cf12630d08b7a8250a2a81e724a4a5d972
diff --git a/recovery.cpp b/recovery.cpp
index 3b58138..5c1e3cd 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -668,12 +668,22 @@
 }
 
 static void
-prompt_and_wait(Device* device) {
+prompt_and_wait(Device* device, int status) {
     const char* const* headers = prepend_title(device->GetMenuHeaders());
 
     for (;;) {
         finish_recovery(NULL);
-        ui->SetBackground(RecoveryUI::NO_COMMAND);
+        switch (status) {
+            case INSTALL_SUCCESS:
+            case INSTALL_NONE:
+                ui->SetBackground(RecoveryUI::NO_COMMAND);
+                break;
+
+            case INSTALL_ERROR:
+            case INSTALL_CORRUPT:
+                ui->SetBackground(RecoveryUI::ERROR);
+                break;
+        }
         ui->SetProgressType(RecoveryUI::EMPTY);
 
         int chosen_item = get_menu_selection(headers, device->GetMenuItems(), 0, 0, device);
@@ -683,7 +693,6 @@
         // statement below.
         chosen_item = device->InvokeMenuItem(chosen_item);
 
-        int status;
         int wipe_cache;
         switch (chosen_item) {
             case Device::REBOOT:
@@ -920,7 +929,7 @@
         ui->SetBackground(RecoveryUI::ERROR);
     }
     if (status != INSTALL_SUCCESS || ui->IsTextVisible()) {
-        prompt_and_wait(device);
+        prompt_and_wait(device, status);
     }
 
     // Otherwise, get ready to boot the main system...