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

Commit 9fc764f1 authored by Tianjie Xu's avatar Tianjie Xu Committed by Gerrit Code Review
Browse files

Merge "Move wipe cache|data to libinstall"

parents 0b172415 316e9717
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -107,7 +107,6 @@ cc_binary {
    ],

    srcs: [
        "logging.cpp",
        "recovery_main.cpp",
    ],

@@ -139,7 +138,6 @@ cc_binary {
    ],

    srcs: [
        "logging.cpp",
        "recovery-persist.cpp",
    ],

@@ -167,7 +165,6 @@ cc_binary {
    ],

    srcs: [
        "logging.cpp",
        "recovery-refresh.cpp",
    ],

+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ cc_library_static {
        "install.cpp",
        "package.cpp",
        "verifier.cpp",
        "wipe_data.cpp",
    ],

    shared_libs: [
+4 −5
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ static bool WriteStatusToFd(MinadbdCommandStatus status, int fd) {
}

// Installs the package from FUSE. Returns true if the installation succeeds, and false otherwise.
static bool AdbInstallPackageHandler(bool* wipe_cache, RecoveryUI* ui, int* result) {
static bool AdbInstallPackageHandler(RecoveryUI* ui, int* result) {
  // How long (in seconds) we wait for the package path to be ready. It doesn't need to be too long
  // because the minadbd service has already issued an install command. FUSE_SIDELOAD_HOST_PATHNAME
  // will start to exist once the host connects and starts serving a package. Poll for its
@@ -99,7 +99,7 @@ static bool AdbInstallPackageHandler(bool* wipe_cache, RecoveryUI* ui, int* resu
        break;
      }
    }
    *result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, false, 0, ui);
    *result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, false, false, 0, ui);
    break;
  }

@@ -280,7 +280,7 @@ static void CreateMinadbdServiceAndExecuteCommands(
  signal(SIGPIPE, SIG_DFL);
}

int apply_from_adb(bool* wipe_cache, RecoveryUI* ui) {
int apply_from_adb(RecoveryUI* ui) {
  // Save the usb state to restore after the sideload operation.
  std::string usb_state = android::base::GetProperty("sys.usb.state", "none");
  // Clean up state and stop adbd.
@@ -295,8 +295,7 @@ int apply_from_adb(bool* wipe_cache, RecoveryUI* ui) {

  int install_result = INSTALL_ERROR;
  std::map<MinadbdCommands, CommandFunction> command_map{
    { MinadbdCommands::kInstall,
      std::bind(&AdbInstallPackageHandler, wipe_cache, ui, &install_result) },
    { MinadbdCommands::kInstall, std::bind(&AdbInstallPackageHandler, ui, &install_result) },
  };

  CreateMinadbdServiceAndExecuteCommands(command_map);
+2 −2
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ static bool StartSdcardFuse(const std::string& path) {
  return run_fuse_sideload(std::move(file_data_reader)) == 0;
}

int ApplyFromSdcard(Device* device, bool* wipe_cache, RecoveryUI* ui) {
int ApplyFromSdcard(Device* device, RecoveryUI* ui) {
  if (ensure_path_mounted(SDCARD_ROOT) != 0) {
    LOG(ERROR) << "\n-- Couldn't mount " << SDCARD_ROOT << ".\n";
    return INSTALL_ERROR;
@@ -184,7 +184,7 @@ int ApplyFromSdcard(Device* device, bool* wipe_cache, RecoveryUI* ui) {
      }
    }

    result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, false, 0 /*retry_count*/, ui);
    result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, false, false, 0 /*retry_count*/, ui);
    break;
  }

+1 −1
Original line number Diff line number Diff line
@@ -18,4 +18,4 @@

#include <recovery_ui/ui.h>

int apply_from_adb(bool* wipe_cache, RecoveryUI* ui);
int apply_from_adb(RecoveryUI* ui);
Loading