summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-05-23 23:28:44 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-05-23 23:28:44 +0200
commit8a43084979c3fc3da20e23fc325922e5d01e2424 (patch)
tree6930deb10e9c1f0f7e7a160773455edbd0d027d4 /install.cpp
parentresolve merge conflicts of 86a28d0 to klp-modular-dev am: a5bc59620f am: 36acff7d7e am: 1f814d7630 am: ca45737e27 am: 8a1d4e97ad am: aa02888e55 am: 300af0779d am: fc1d9a49d1 am: b02b2fe392 am: 75dea9ca3a am: bd43d7e92b (diff)
parentresolve merge conflicts of 3aabd77 to nyc-mr1-dev-plus-aosp (diff)
downloadandroid_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.gz
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.bz2
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.lz
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.xz
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.zst
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.zip
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/install.cpp b/install.cpp
index 2faabcbc2..9d2971c8c 100644
--- a/install.cpp
+++ b/install.cpp
@@ -27,7 +27,11 @@
#include <string>
#include <vector>
+#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
+
#include "common.h"
+#include "error_code.h"
#include "install.h"
#include "minui/minui.h"
#include "minzip/SysUtil.h"
@@ -253,6 +257,8 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
ui->Print("Update package verification took %.1f s (result %d).\n", duration.count(), err);
if (err != VERIFY_SUCCESS) {
LOGE("signature verification failed\n");
+ log_buffer.push_back(android::base::StringPrintf("error: %d", kZipVerificationFailure));
+
sysReleaseMap(&map);
return INSTALL_CORRUPT;
}
@@ -262,6 +268,8 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
err = mzOpenZipArchive(map.addr, map.length, &zip);
if (err != 0) {
LOGE("Can't open %s\n(%s)\n", path, err != -1 ? strerror(err) : "bad");
+ log_buffer.push_back(android::base::StringPrintf("error: %d", kZipOpenFailure));
+
sysReleaseMap(&map);
return INSTALL_CORRUPT;
}
@@ -280,7 +288,7 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
int
install_package(const char* path, bool* wipe_cache, const char* install_file,
- bool needs_mount)
+ bool needs_mount, int retry_count)
{
modified_flash = true;
auto start = std::chrono::system_clock::now();
@@ -300,13 +308,14 @@ install_package(const char* path, bool* wipe_cache, const char* install_file,
} else {
result = really_install_package(path, wipe_cache, needs_mount, log_buffer);
}
- if (install_log) {
+ if (install_log != nullptr) {
fputc(result == INSTALL_SUCCESS ? '1' : '0', install_log);
fputc('\n', install_log);
std::chrono::duration<double> duration = std::chrono::system_clock::now() - start;
int count = static_cast<int>(duration.count());
// Report the time spent to apply OTA update in seconds.
fprintf(install_log, "time_total: %d\n", count);
+ fprintf(install_log, "retry: %d\n", retry_count);
for (const auto& s : log_buffer) {
fprintf(install_log, "%s\n", s.c_str());