Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit e30a8e84 authored by LuK1337's avatar LuK1337
Browse files

recovery: Make OTA safety check A/B package only

Change-Id: I4b3824c7ad659c65cded4243d36aad151a53c8af
parent 1d86e11c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@
using namespace std::chrono_literals;

bool ask_to_ab_reboot(Device* device);
bool ask_to_cancel_ota(Device* device);
bool ask_to_continue_unverified(Device* device);
bool ask_to_continue_downgrade(Device* device);
bool ask_to_continue_spl_downgrade(Device* device);
@@ -407,6 +408,13 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
  bool has_metadata = ReadMetadataFromPackage(zip, &metadata);

  const bool package_is_ab = has_metadata && get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB);
  if (package_is_ab && !IsCancelUpdateSafe(device)) {
    if (!IsCancelUpdateSafe(device)) {
      if (!ask_to_cancel_ota(device)) {
        return INSTALL_ERROR;
      }
    }
  }
  const bool package_is_brick = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::BRICK);
  if (package_is_brick) {
    LOG(INFO) << "Installing a brick package";
+1 −8
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ static bool ask_to_wipe_data(Device* device) {
  return (chosen_item == 1);
}

static bool ask_to_cancel_ota(Device* device) {
bool ask_to_cancel_ota(Device* device) {
  // clang-format off
  std::vector<std::string> headers{
    "Overwrite in-progress update?",
@@ -604,13 +604,6 @@ change_menu:
      case Device::APPLY_UPDATE:
      case Device::ENTER_RESCUE: {
        save_current_log = true;

        if (!IsCancelUpdateSafe(device)) {
          if (!ask_to_cancel_ota(device)) {
            break;
          }
        }

        update_in_progress = true;
        WriteUpdateInProgress();