aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2016-12-25 20:46:50 -0600
committerTao Bao2017-03-07 02:12:06 -0600
commita8d72bc3b4087632e8cdad95e8355a2495e15690 (patch)
treebb6a15e6e8c553927e0cf66a840a9eee23ba0c4b /recovery.cpp
parenta2e7a07031d72e617ddf082897d76f8b83fc52e3 (diff)
downloadplatform-bootable-recovery-a8d72bc3b4087632e8cdad95e8355a2495e15690.tar.gz
platform-bootable-recovery-a8d72bc3b4087632e8cdad95e8355a2495e15690.tar.xz
platform-bootable-recovery-a8d72bc3b4087632e8cdad95e8355a2495e15690.zip
recovery: Drop the "--stages" / '-g' argument.
This was introduced in commit c87bab101893e8322b49d7c8600e3367b20ab50a. But the stage info should be passed through BCB only (there's a dedicated field in struct bootloader_message). This CL removes it from recovery arguments, and also moves 'stage' variable to std::string. Test: 'stage' variable is not used by any device-specific recovery code. Test: Code search shows no hit of '--stages' use. Change-Id: Iccbde578a13255f2b55dd4a928e9ecf487f16b97
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 5c60ce65..872658a5 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -83,7 +83,6 @@ static const struct option OPTIONS[] = {
83 { "sideload_auto_reboot", no_argument, NULL, 'a' }, 83 { "sideload_auto_reboot", no_argument, NULL, 'a' },
84 { "just_exit", no_argument, NULL, 'x' }, 84 { "just_exit", no_argument, NULL, 'x' },
85 { "locale", required_argument, NULL, 'l' }, 85 { "locale", required_argument, NULL, 'l' },
86 { "stages", required_argument, NULL, 'g' },
87 { "shutdown_after", no_argument, NULL, 'p' }, 86 { "shutdown_after", no_argument, NULL, 'p' },
88 { "reason", required_argument, NULL, 'r' }, 87 { "reason", required_argument, NULL, 'r' },
89 { "security", no_argument, NULL, 'e'}, 88 { "security", no_argument, NULL, 'e'},
@@ -129,7 +128,7 @@ static bool has_cache = false;
129 128
130RecoveryUI* ui = nullptr; 129RecoveryUI* ui = nullptr;
131bool modified_flash = false; 130bool modified_flash = false;
132const char* stage = nullptr; 131std::string stage;
133const char* reason = nullptr; 132const char* reason = nullptr;
134struct selabel_handle* sehandle; 133struct selabel_handle* sehandle;
135 134
@@ -309,7 +308,7 @@ static std::vector<std::string> get_args(const int argc, char** const argv) {
309 // If fails, leave a zeroed bootloader_message. 308 // If fails, leave a zeroed bootloader_message.
310 boot = {}; 309 boot = {};
311 } 310 }
312 stage = strndup(boot.stage, sizeof(boot.stage)); 311 stage = std::string(boot.stage);
313 312
314 if (boot.command[0] != 0) { 313 if (boot.command[0] != 0) {
315 std::string boot_command = std::string(boot.command, sizeof(boot.command)); 314 std::string boot_command = std::string(boot.command, sizeof(boot.command));
@@ -1422,14 +1421,6 @@ int main(int argc, char **argv) {
1422 case 'a': sideload = true; sideload_auto_reboot = true; break; 1421 case 'a': sideload = true; sideload_auto_reboot = true; break;
1423 case 'x': just_exit = true; break; 1422 case 'x': just_exit = true; break;
1424 case 'l': locale = optarg; break; 1423 case 'l': locale = optarg; break;
1425 case 'g': {
1426 if (stage == NULL || *stage == '\0') {
1427 char buffer[20] = "1/";
1428 strncat(buffer, optarg, sizeof(buffer)-3);
1429 stage = strdup(buffer);
1430 }
1431 break;
1432 }
1433 case 'p': shutdown_after = true; break; 1424 case 'p': shutdown_after = true; break;
1434 case 'r': reason = optarg; break; 1425 case 'r': reason = optarg; break;
1435 case 'e': security_update = true; break; 1426 case 'e': security_update = true; break;
@@ -1461,7 +1452,7 @@ int main(int argc, char **argv) {
1461 } 1452 }
1462 1453
1463 printf("locale is [%s]\n", locale.c_str()); 1454 printf("locale is [%s]\n", locale.c_str());
1464 printf("stage is [%s]\n", stage); 1455 printf("stage is [%s]\n", stage.c_str());
1465 printf("reason is [%s]\n", reason); 1456 printf("reason is [%s]\n", reason);
1466 1457
1467 Device* device = make_device(); 1458 Device* device = make_device();
@@ -1476,7 +1467,7 @@ int main(int argc, char **argv) {
1476 ui->SetSystemUpdateText(security_update); 1467 ui->SetSystemUpdateText(security_update);
1477 1468
1478 int st_cur, st_max; 1469 int st_cur, st_max;
1479 if (stage != NULL && sscanf(stage, "%d/%d", &st_cur, &st_max) == 2) { 1470 if (!stage.empty() && sscanf(stage.c_str(), "%d/%d", &st_cur, &st_max) == 2) {
1480 ui->SetStage(st_cur, st_max); 1471 ui->SetStage(st_cur, st_max);
1481 } 1472 }
1482 1473