aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-03-07 14:28:05 -0600
committerGerrit Code Review2017-03-07 14:28:06 -0600
commit9bd1dced90da781b4506e46761364ea48f11d309 (patch)
treeb05ac7820b40960ca732d18251a72b4ab3d6e03e /recovery.cpp
parent1a575f8d5ff81238bd6b3f366bb3d1d40a0ccdd8 (diff)
parenta8d72bc3b4087632e8cdad95e8355a2495e15690 (diff)
downloadplatform-bootable-recovery-9bd1dced90da781b4506e46761364ea48f11d309.tar.gz
platform-bootable-recovery-9bd1dced90da781b4506e46761364ea48f11d309.tar.xz
platform-bootable-recovery-9bd1dced90da781b4506e46761364ea48f11d309.zip
Merge "recovery: Drop the "--stages" / '-g' argument."
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 61d3bf4f..618a2e8c 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));
@@ -1418,14 +1417,6 @@ int main(int argc, char **argv) {
1418 case 'a': sideload = true; sideload_auto_reboot = true; break; 1417 case 'a': sideload = true; sideload_auto_reboot = true; break;
1419 case 'x': just_exit = true; break; 1418 case 'x': just_exit = true; break;
1420 case 'l': locale = optarg; break; 1419 case 'l': locale = optarg; break;
1421 case 'g': {
1422 if (stage == NULL || *stage == '\0') {
1423 char buffer[20] = "1/";
1424 strncat(buffer, optarg, sizeof(buffer)-3);
1425 stage = strdup(buffer);
1426 }
1427 break;
1428 }
1429 case 'p': shutdown_after = true; break; 1420 case 'p': shutdown_after = true; break;
1430 case 'r': reason = optarg; break; 1421 case 'r': reason = optarg; break;
1431 case 'e': security_update = true; break; 1422 case 'e': security_update = true; break;
@@ -1457,7 +1448,7 @@ int main(int argc, char **argv) {
1457 } 1448 }
1458 1449
1459 printf("locale is [%s]\n", locale.c_str()); 1450 printf("locale is [%s]\n", locale.c_str());
1460 printf("stage is [%s]\n", stage); 1451 printf("stage is [%s]\n", stage.c_str());
1461 printf("reason is [%s]\n", reason); 1452 printf("reason is [%s]\n", reason);
1462 1453
1463 Device* device = make_device(); 1454 Device* device = make_device();
@@ -1472,7 +1463,7 @@ int main(int argc, char **argv) {
1472 ui->SetSystemUpdateText(security_update); 1463 ui->SetSystemUpdateText(security_update);
1473 1464
1474 int st_cur, st_max; 1465 int st_cur, st_max;
1475 if (stage != NULL && sscanf(stage, "%d/%d", &st_cur, &st_max) == 2) { 1466 if (!stage.empty() && sscanf(stage.c_str(), "%d/%d", &st_cur, &st_max) == 2) {
1476 ui->SetStage(st_cur, st_max); 1467 ui->SetStage(st_cur, st_max);
1477 } 1468 }
1478 1469