aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu2017-05-16 20:07:31 -0500
committerTianjie Xu2017-05-17 13:52:17 -0500
commit539b08cfcf223cea2be6713c5357643d45e6b70d (patch)
tree7787861cebb3fe75c554341cf23cf6bff51089fd /recovery.cpp
parented9db0fd73f0368be354a65d7bdc3de5d01bdc88 (diff)
downloadplatform-bootable-recovery-539b08cfcf223cea2be6713c5357643d45e6b70d.tar.gz
platform-bootable-recovery-539b08cfcf223cea2be6713c5357643d45e6b70d.tar.xz
platform-bootable-recovery-539b08cfcf223cea2be6713c5357643d45e6b70d.zip
Fix the input parameter for "set_retry_bootloader_message"
We're not updating argc & argv during get_args(), so some boot arguments missed when we set the boot message for retry. Bug: 38383406 Test: boot command sets correctly during retry attempt. Change-Id: Ie8583a22fad5e0084245e3431d4018518d508dfd (cherry picked from commit 72449c9f995649b1427b2116985ed9826a141d46)
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 173baac1..30edaa57 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -1305,20 +1305,20 @@ static bool is_battery_ok() {
1305 } 1305 }
1306} 1306}
1307 1307
1308static void set_retry_bootloader_message(int retry_count, int argc, char** argv) { 1308static void set_retry_bootloader_message(int retry_count, const std::vector<std::string>& args) {
1309 std::vector<std::string> options; 1309 std::vector<std::string> options;
1310 for (int i = 1; i < argc; ++i) { 1310 for (const auto& arg : args) {
1311 if (strstr(argv[i], "retry_count") == nullptr) { 1311 if (!android::base::StartsWith(arg, "--retry_count")) {
1312 options.push_back(argv[i]); 1312 options.push_back(arg);
1313 }
1314 } 1313 }
1314 }
1315 1315
1316 // Increment the retry counter by 1. 1316 // Increment the retry counter by 1.
1317 options.push_back(android::base::StringPrintf("--retry_count=%d", retry_count+1)); 1317 options.push_back(android::base::StringPrintf("--retry_count=%d", retry_count + 1));
1318 std::string err; 1318 std::string err;
1319 if (!update_bootloader_message(options, &err)) { 1319 if (!update_bootloader_message(options, &err)) {
1320 LOG(ERROR) << err; 1320 LOG(ERROR) << err;
1321 } 1321 }
1322} 1322}
1323 1323
1324static bool bootreason_in_blacklist() { 1324static bool bootreason_in_blacklist() {
@@ -1535,7 +1535,7 @@ int main(int argc, char **argv) {
1535 // times before we abandon this OTA update. 1535 // times before we abandon this OTA update.
1536 if (status == INSTALL_RETRY && retry_count < EIO_RETRY_COUNT) { 1536 if (status == INSTALL_RETRY && retry_count < EIO_RETRY_COUNT) {
1537 copy_logs(); 1537 copy_logs();
1538 set_retry_bootloader_message(retry_count, argc, argv); 1538 set_retry_bootloader_message(retry_count, args);
1539 // Print retry count on screen. 1539 // Print retry count on screen.
1540 ui->Print("Retry attempt %d\n", retry_count); 1540 ui->Print("Retry attempt %d\n", retry_count);
1541 1541