summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorDoug Zongker <dougz@google.com>2013-11-27 19:57:44 +0100
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-27 19:57:44 +0100
commitd327c63af691a36fbf53866a3ae7ad27a43ebe3b (patch)
treecbd6add22b369da022af5531f619eac66213c14b /recovery.cpp
parentam c64e76c7: Merge "Enable incremental builder to find files that moved, and try to process them via patch + rename, instead of delete + add." into klp-dev (diff)
parentadd the functions for multi-stage packages to updater (diff)
downloadandroid_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.tar
android_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.tar.gz
android_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.tar.bz2
android_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.tar.lz
android_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.tar.xz
android_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.tar.zst
android_bootable_recovery-d327c63af691a36fbf53866a3ae7ad27a43ebe3b.zip
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/recovery.cpp b/recovery.cpp
index d803cadf1..43cd9dafe 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -56,6 +56,7 @@ static const struct option OPTIONS[] = {
{ "show_text", no_argument, NULL, 't' },
{ "just_exit", no_argument, NULL, 'x' },
{ "locale", required_argument, NULL, 'l' },
+ { "stages", required_argument, NULL, 'g' },
{ NULL, 0, NULL, 0 },
};
@@ -76,6 +77,7 @@ static const char *SIDELOAD_TEMP_DIR = "/tmp/sideload";
RecoveryUI* ui = NULL;
char* locale = NULL;
char recovery_version[PROPERTY_VALUE_MAX+1];
+char* stage = NULL;
/*
* The recovery tool communicates with the main system through /cache files.
@@ -172,6 +174,7 @@ get_args(int *argc, char ***argv) {
struct bootloader_message boot;
memset(&boot, 0, sizeof(boot));
get_bootloader_message(&boot); // this may fail, leaving a zeroed structure
+ stage = strndup(boot.stage, sizeof(boot.stage));
if (boot.command[0] != 0 && boot.command[0] != 255) {
LOGI("Boot command: %.*s\n", sizeof(boot.command), boot.command);
@@ -959,6 +962,14 @@ main(int argc, char **argv) {
case 't': show_text = 1; break;
case 'x': just_exit = true; break;
case 'l': locale = optarg; break;
+ case 'g': {
+ if (stage == NULL || *stage == '\0') {
+ char buffer[20] = "1/";
+ strncat(buffer, optarg, sizeof(buffer)-3);
+ stage = strdup(buffer);
+ }
+ break;
+ }
case '?':
LOGE("Invalid command argument\n");
continue;
@@ -969,12 +980,19 @@ main(int argc, char **argv) {
load_locale_from_cache();
}
printf("locale is [%s]\n", locale);
+ printf("stage is [%s]\n", stage, stage);
Device* device = make_device();
ui = device->GetUI();
gCurrentUI = ui;
ui->Init();
+
+ int st_cur, st_max;
+ if (stage != NULL && sscanf(stage, "%d/%d", &st_cur, &st_max) == 2) {
+ ui->SetStage(st_cur, st_max);
+ }
+
ui->SetLocale(locale);
ui->SetBackground(RecoveryUI::NONE);
if (show_text) ui->ShowText(true);