summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-04-30 20:49:59 +0200
committerTianjie Xu <xunchang@google.com>2016-05-20 22:56:53 +0200
commit162558382b768a4120b3e41090a4c7b53f11469a (patch)
tree7e0d268233fc6bea07a361cf6913fc3a5e524063 /recovery.cpp
parentAdd time and I/O info to last_install (diff)
downloadandroid_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.gz
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.bz2
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.lz
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.xz
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.zst
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 9873f976c..6b6643fab 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -50,6 +50,7 @@
#include "bootloader.h"
#include "common.h"
#include "device.h"
+#include "error_code.h"
#include "fuse_sdcard_provider.h"
#include "fuse_sideload.h"
#include "install.h"
@@ -1000,7 +1001,7 @@ static int apply_from_sdcard(Device* device, bool* wipe_cache) {
}
result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache,
- TEMPORARY_INSTALL_FILE, false);
+ TEMPORARY_INSTALL_FILE, false, 0/*retry_count*/);
break;
}
@@ -1455,10 +1456,21 @@ int main(int argc, char **argv) {
if (!is_battery_ok()) {
ui->Print("battery capacity is not enough for installing package, needed is %d%%\n",
BATTERY_OK_PERCENTAGE);
+ // Log the error code to last_install when installation skips due to
+ // low battery.
+ FILE* install_log = fopen_path(LAST_INSTALL_FILE, "w");
+ if (install_log != nullptr) {
+ fprintf(install_log, "%s\n", update_package);
+ fprintf(install_log, "0\n");
+ fprintf(install_log, "error: %d\n", kLowBattery);
+ fclose(install_log);
+ } else {
+ LOGE("failed to open last_install: %s\n", strerror(errno));
+ }
status = INSTALL_SKIPPED;
} else {
status = install_package(update_package, &should_wipe_cache,
- TEMPORARY_INSTALL_FILE, true);
+ TEMPORARY_INSTALL_FILE, true, retry_count);
if (status == INSTALL_SUCCESS && should_wipe_cache) {
wipe_cache(false, device);
}