summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-05-23 21:17:13 +0200
committerTianjie Xu <xunchang@google.com>2016-05-23 21:30:42 +0200
commit549745cc8778f806e46809e472fbcf3c7f066b83 (patch)
tree5c64036573622ef1291e24e8c0c5c036f3052484 /recovery.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 (diff)
parentMerge "Allow recovery to return error codes" into nyc-dev (diff)
downloadandroid_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.gz
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.bz2
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.lz
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.xz
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.zst
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.zip
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/recovery.cpp b/recovery.cpp
index c681c8ce7..573ae1abb 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -51,6 +51,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"
@@ -985,7 +986,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;
}
@@ -1438,10 +1439,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);
}