Merge "Move the parse of last_install to recovery-persist"
diff --git a/install.h b/install.h
index 0f6670a..1d3d0cd 100644
--- a/install.h
+++ b/install.h
@@ -23,8 +23,15 @@
 
 #include <ziparchive/zip_archive.h>
 
-enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE, INSTALL_SKIPPED,
-        INSTALL_RETRY };
+enum InstallResult {
+  INSTALL_SUCCESS,
+  INSTALL_ERROR,
+  INSTALL_CORRUPT,
+  INSTALL_NONE,
+  INSTALL_SKIPPED,
+  INSTALL_RETRY,
+  INSTALL_KEY_INTERRUPTED
+};
 
 // Installs the given update package. If INSTALL_SUCCESS is returned and *wipe_cache is true on
 // exit, caller should wipe the cache partition.
diff --git a/minui/graphics.cpp b/minui/graphics.cpp
index 4fe0fdc..e6367d9 100644
--- a/minui/graphics.cpp
+++ b/minui/graphics.cpp
@@ -342,7 +342,7 @@
 
 int gr_init() {
   // pixel_format needs to be set before loading any resources or initializing backends.
-  std::string format = android::base::GetProperty("ro.recovery.ui.pixel_format", "");
+  std::string format = android::base::GetProperty("ro.minui.pixel_format", "");
   if (format == "ABGR_8888") {
     pixel_format = PixelFormat::ABGR;
   } else if (format == "RGBX_8888") {
@@ -378,7 +378,7 @@
 
   gr_backend = backend.release();
 
-  int overscan_percent = android::base::GetIntProperty("ro.recovery.ui.overscan_percent", 0);
+  int overscan_percent = android::base::GetIntProperty("ro.minui.overscan_percent", 0);
   overscan_offset_x = gr_draw->width * overscan_percent / 100;
   overscan_offset_y = gr_draw->height * overscan_percent / 100;
 
@@ -390,7 +390,7 @@
   }
 
   std::string rotation_str =
-      android::base::GetProperty("ro.recovery.ui.default_rotation", "ROTATION_NONE");
+      android::base::GetProperty("ro.minui.default_rotation", "ROTATION_NONE");
   if (rotation_str == "ROTATION_RIGHT") {
     gr_rotate(GRRotation::RIGHT);
   } else if (rotation_str == "ROTATION_DOWN") {
diff --git a/recovery.cpp b/recovery.cpp
index 5934b61..7cc344b 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -394,7 +394,7 @@
     return success;
 }
 
-static bool prompt_and_wipe_data(Device* device) {
+static InstallResult prompt_and_wipe_data(Device* device) {
   // Use a single string and let ScreenRecoveryUI handles the wrapping.
   std::vector<std::string> headers{
     "Can't load Android system. Your data may be corrupt. "
@@ -415,13 +415,17 @@
 
     // If ShowMenu() returned RecoveryUI::KeyError::INTERRUPTED, WaitKey() was interrupted.
     if (chosen_item == static_cast<size_t>(RecoveryUI::KeyError::INTERRUPTED)) {
-      return false;
+      return INSTALL_KEY_INTERRUPTED;
     }
     if (chosen_item != 1) {
-      return true;  // Just reboot, no wipe; not a failure, user asked for it
+      return INSTALL_SUCCESS;  // Just reboot, no wipe; not a failure, user asked for it
     }
     if (ask_to_wipe_data(device)) {
-      return wipe_data(device);
+      if (wipe_data(device)) {
+        return INSTALL_SUCCESS;
+      } else {
+        return INSTALL_ERROR;
+      }
     }
   }
 }
@@ -1192,12 +1196,15 @@
       status = INSTALL_ERROR;
     }
   } else if (should_prompt_and_wipe_data) {
+    // Trigger the logging to capture the cause, even if user chooses to not wipe data.
+    modified_flash = true;
+
     ui->ShowText(true);
     ui->SetBackground(RecoveryUI::ERROR);
-    if (!prompt_and_wipe_data(device)) {
-      status = INSTALL_ERROR;
+    status = prompt_and_wipe_data(device);
+    if (status != INSTALL_KEY_INTERRUPTED) {
+      ui->ShowText(false);
     }
-    ui->ShowText(false);
   } else if (should_wipe_cache) {
     if (!wipe_cache(false, device)) {
       status = INSTALL_ERROR;
diff --git a/recovery_main.cpp b/recovery_main.cpp
index c3168fc..29a5865 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -425,6 +425,10 @@
     device->RemoveMenuItemForAction(Device::WIPE_CACHE);
   }
 
+  if (!android::base::GetBoolProperty("ro.boot.logical_partitions", false)) {
+    device->RemoveMenuItemForAction(Device::ENTER_FASTBOOT);
+  }
+
   ui->SetBackground(RecoveryUI::NONE);
   if (show_text) ui->ShowText(true);