aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu2017-05-16 17:51:46 -0500
committerTianjie Xu2017-05-23 19:36:56 -0500
commit6957555e295e8ae34ba5e8cfbfb1c7bd76b0024d (patch)
tree6ccc20bb5be3a08af14e1c56dbf332decb6eafe2 /recovery.cpp
parent1f9808bd4856122924c9453d871d34fd777d5389 (diff)
downloadplatform-bootable-recovery-6957555e295e8ae34ba5e8cfbfb1c7bd76b0024d.tar.gz
platform-bootable-recovery-6957555e295e8ae34ba5e8cfbfb1c7bd76b0024d.tar.xz
platform-bootable-recovery-6957555e295e8ae34ba5e8cfbfb1c7bd76b0024d.zip
Retry the update if ApplyBSDiffPatch | ApplyImagePatch fails
We have seen one case when bspatch failed likely due to patch corruption. Since the package has passed verification before, we want to reboot and retry the patch command again since there's no alternative for users. We won't delete the stash before reboot, and the src has passed SHA1 check. If there's an error on the patch, it will fail the package verification during retry. Bug: 37855643 Test: angler reboots and retries the update when bspatch fails. Change-Id: I2ebac9621bd1f0649bb301b9a28a0dd079ed4e1d
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index dfae7f03..122b89d0 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -112,8 +112,9 @@ static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
112static const char *TEMPORARY_INSTALL_FILE = "/tmp/last_install"; 112static const char *TEMPORARY_INSTALL_FILE = "/tmp/last_install";
113static const char *LAST_KMSG_FILE = "/cache/recovery/last_kmsg"; 113static const char *LAST_KMSG_FILE = "/cache/recovery/last_kmsg";
114static const char *LAST_LOG_FILE = "/cache/recovery/last_log"; 114static const char *LAST_LOG_FILE = "/cache/recovery/last_log";
115// We will try to apply the update package 5 times at most in case of an I/O error. 115// We will try to apply the update package 5 times at most in case of an I/O error or
116static const int EIO_RETRY_COUNT = 4; 116// bspatch | imgpatch error.
117static const int RETRY_LIMIT = 4;
117static const int BATTERY_READ_TIMEOUT_IN_SEC = 10; 118static const int BATTERY_READ_TIMEOUT_IN_SEC = 10;
118// GmsCore enters recovery mode to install package when having enough battery 119// GmsCore enters recovery mode to install package when having enough battery
119// percentage. Normally, the threshold is 40% without charger and 20% with charger. 120// percentage. Normally, the threshold is 40% without charger and 20% with charger.
@@ -1530,9 +1531,9 @@ int main(int argc, char **argv) {
1530 } 1531 }
1531 if (status != INSTALL_SUCCESS) { 1532 if (status != INSTALL_SUCCESS) {
1532 ui->Print("Installation aborted.\n"); 1533 ui->Print("Installation aborted.\n");
1533 // When I/O error happens, reboot and retry installation EIO_RETRY_COUNT 1534 // When I/O error happens, reboot and retry installation RETRY_LIMIT
1534 // times before we abandon this OTA update. 1535 // times before we abandon this OTA update.
1535 if (status == INSTALL_RETRY && retry_count < EIO_RETRY_COUNT) { 1536 if (status == INSTALL_RETRY && retry_count < RETRY_LIMIT) {
1536 copy_logs(); 1537 copy_logs();
1537 set_retry_bootloader_message(retry_count, args); 1538 set_retry_bootloader_message(retry_count, args);
1538 // Print retry count on screen. 1539 // Print retry count on screen.