diff options
author | Tianjie Xu <xunchang@google.com> | 2019-04-16 00:34:19 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-04-16 00:34:19 +0200 |
commit | 9fc764f1f0e6c4c581a5236d7558d97a1f90b38e (patch) | |
tree | c1ebcae66a7fbf7aaa79a6c1d894f2fa708ac441 /install/install.cpp | |
parent | Merge "Import translations. DO NOT MERGE" (diff) | |
parent | Move wipe cache|data to libinstall (diff) | |
download | android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.tar android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.tar.gz android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.tar.bz2 android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.tar.lz android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.tar.xz android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.tar.zst android_bootable_recovery-9fc764f1f0e6c4c581a5236d7558d97a1f90b38e.zip |
Diffstat (limited to 'install/install.cpp')
-rw-r--r-- | install/install.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/install/install.cpp b/install/install.cpp index a1124c361..e2d470096 100644 --- a/install/install.cpp +++ b/install/install.cpp @@ -48,6 +48,7 @@ #include "install/package.h" #include "install/verifier.h" +#include "install/wipe_data.h" #include "otautil/error_code.h" #include "otautil/paths.h" #include "otautil/roots.h" @@ -631,10 +632,9 @@ static int really_install_package(const std::string& path, bool* wipe_cache, boo return result; } -int install_package(const std::string& path, bool* wipe_cache, bool needs_mount, int retry_count, - RecoveryUI* ui) { +int install_package(const std::string& path, bool should_wipe_cache, bool needs_mount, + int retry_count, RecoveryUI* ui) { CHECK(!path.empty()); - CHECK(wipe_cache != nullptr); auto start = std::chrono::system_clock::now(); @@ -647,8 +647,10 @@ int install_package(const std::string& path, bool* wipe_cache, bool needs_mount, LOG(ERROR) << "failed to set up expected mounts for install; aborting"; result = INSTALL_ERROR; } else { - result = really_install_package(path, wipe_cache, needs_mount, &log_buffer, retry_count, - &max_temperature, ui); + bool updater_wipe_cache = false; + result = really_install_package(path, &updater_wipe_cache, needs_mount, &log_buffer, + retry_count, &max_temperature, ui); + should_wipe_cache = should_wipe_cache || updater_wipe_cache; } // Measure the time spent to apply OTA update in seconds. @@ -703,6 +705,12 @@ int install_package(const std::string& path, bool* wipe_cache, bool needs_mount, // Write a copy into last_log. LOG(INFO) << log_content; + if (result == INSTALL_SUCCESS && should_wipe_cache) { + if (!WipeCache(ui, nullptr)) { + result = INSTALL_ERROR; + } + } + return result; } |