summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker <dougz@google.com>2014-03-18 21:52:43 +0100
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-18 21:52:43 +0100
commita898c52b6414ca76a137955d9e427fa280863eff (patch)
tree9d5e1d1ab6b7355e154f893bdafe7de0aed6da3b
parentam 47c7e365: am 130a7985: Merge "fix error log statement" (diff)
parentresolved conflicts for merge of 708aa238 to klp-modular-dev-plus-aosp (diff)
downloadandroid_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.tar
android_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.tar.gz
android_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.tar.bz2
android_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.tar.lz
android_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.tar.xz
android_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.tar.zst
android_bootable_recovery-a898c52b6414ca76a137955d9e427fa280863eff.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index b2cdf08e5..8d3731540 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -57,6 +57,7 @@ static const struct option OPTIONS[] = {
{ "just_exit", no_argument, NULL, 'x' },
{ "locale", required_argument, NULL, 'l' },
{ "stages", required_argument, NULL, 'g' },
+ { "shutdown_after", no_argument, NULL, 'p' },
{ NULL, 0, NULL, 0 },
};
@@ -945,16 +946,15 @@ main(int argc, char **argv) {
rotate_last_logs(10);
get_args(&argc, &argv);
- int previous_runs = 0;
const char *send_intent = NULL;
const char *update_package = NULL;
int wipe_data = 0, wipe_cache = 0, show_text = 0;
bool just_exit = false;
+ bool shutdown_after = false;
int arg;
while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) {
switch (arg) {
- case 'p': previous_runs = atoi(optarg); break;
case 's': send_intent = optarg; break;
case 'u': update_package = optarg; break;
case 'w': wipe_data = wipe_cache = 1; break;
@@ -970,6 +970,7 @@ main(int argc, char **argv) {
}
break;
}
+ case 'p': shutdown_after = true; break;
case '?':
LOGE("Invalid command argument\n");
continue;
@@ -1079,7 +1080,12 @@ main(int argc, char **argv) {
// Otherwise, get ready to boot the main system...
finish_recovery(send_intent);
- ui->Print("Rebooting...\n");
- property_set(ANDROID_RB_PROPERTY, "reboot,");
+ if (shutdown_after) {
+ ui->Print("Shutting down...\n");
+ property_set(ANDROID_RB_PROPERTY, "shutdown,");
+ } else {
+ ui->Print("Rebooting...\n");
+ property_set(ANDROID_RB_PROPERTY, "reboot,");
+ }
return EXIT_SUCCESS;
}