summaryrefslogtreecommitdiffstats
path: root/install/install.cpp
diff options
context:
space:
mode:
authorxunchang <xunchang@google.com>2019-04-13 01:22:15 +0200
committerxunchang <xunchang@google.com>2019-04-15 21:22:11 +0200
commit316e9717461890dd319dc370970069fe4532a561 (patch)
treebe9173eec48b83689ea9c4222e660a6341ece9d3 /install/install.cpp
parentMerge "Add socket communication between recovery and minadbd" (diff)
downloadandroid_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.tar
android_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.tar.gz
android_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.tar.bz2
android_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.tar.lz
android_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.tar.xz
android_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.tar.zst
android_bootable_recovery-316e9717461890dd319dc370970069fe4532a561.zip
Diffstat (limited to '')
-rw-r--r--install/install.cpp18
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;
}