aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2016-09-26 20:38:53 -0500
committerGerrit Code Review2016-09-26 20:38:53 -0500
commit95afc912fb4a30f3522facde0686597aa1505017 (patch)
treeb8d5b18c3f030b70fffc5da76bbb2ec972f26b0d /recovery.cpp
parentcc02f9652f7994c835c7073d13b30f60ff1134af (diff)
parentf4885adc189f246ac3c651aa5cb2e74a240f3f1e (diff)
downloadplatform-bootable-recovery-95afc912fb4a30f3522facde0686597aa1505017.tar.gz
platform-bootable-recovery-95afc912fb4a30f3522facde0686597aa1505017.tar.xz
platform-bootable-recovery-95afc912fb4a30f3522facde0686597aa1505017.zip
Merge "Duplicate the last_install content into last_log."
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/recovery.cpp b/recovery.cpp
index bd06aaff..91c18b52 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -1554,15 +1554,19 @@ int main(int argc, char **argv) {
1554 BATTERY_OK_PERCENTAGE); 1554 BATTERY_OK_PERCENTAGE);
1555 // Log the error code to last_install when installation skips due to 1555 // Log the error code to last_install when installation skips due to
1556 // low battery. 1556 // low battery.
1557 FILE* install_log = fopen_path(LAST_INSTALL_FILE, "w"); 1557 std::vector<std::string> log_buffer = {
1558 if (install_log != nullptr) { 1558 update_package,
1559 fprintf(install_log, "%s\n", update_package); 1559 "0", // install result
1560 fprintf(install_log, "0\n"); 1560 "error: " + std::to_string(kLowBattery),
1561 fprintf(install_log, "error: %d\n", kLowBattery); 1561 };
1562 fclose(install_log); 1562 std::string log_content = android::base::Join(log_buffer, "\n");
1563 } else { 1563 if (!android::base::WriteStringToFile(log_content, LAST_INSTALL_FILE)) {
1564 PLOG(ERROR) << "failed to open last_install"; 1564 PLOG(ERROR) << "failed to write " << LAST_INSTALL_FILE;
1565 } 1565 }
1566
1567 // Also write the info into last_log.
1568 LOG(INFO) << log_content;
1569
1566 status = INSTALL_SKIPPED; 1570 status = INSTALL_SKIPPED;
1567 } else { 1571 } else {
1568 status = install_package(update_package, &should_wipe_cache, 1572 status = install_package(update_package, &should_wipe_cache,