summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-05-02 20:27:32 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-05-02 20:27:32 +0200
commitd25351da83432249780050e4766f1750f31f5577 (patch)
treeaf8500a155ab76d5d7ad3afa47035304beac159e
parentMerge "recovery: Always log the update attempt. am: 5687001895 am: f13662a349" into nyc-mr1-dev-plus-aosp (diff)
parentresolve merge conflicts of 23c7af7 to nyc-mr1-dev-plus-aosp (diff)
downloadandroid_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.tar
android_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.tar.gz
android_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.tar.bz2
android_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.tar.lz
android_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.tar.xz
android_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.tar.zst
android_bootable_recovery-d25351da83432249780050e4766f1750f31f5577.zip
-rw-r--r--recovery.cpp6
-rw-r--r--screen_ui.cpp15
-rw-r--r--screen_ui.h1
-rw-r--r--tests/component/verifier_test.cpp1
-rw-r--r--ui.h1
5 files changed, 23 insertions, 1 deletions
diff --git a/recovery.cpp b/recovery.cpp
index cf368e4e9..c681c8ce7 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -75,6 +75,7 @@ static const struct option OPTIONS[] = {
{ "stages", required_argument, NULL, 'g' },
{ "shutdown_after", no_argument, NULL, 'p' },
{ "reason", required_argument, NULL, 'r' },
+ { "security", no_argument, NULL, 'e'},
{ NULL, 0, NULL, 0 },
};
@@ -1328,6 +1329,7 @@ int main(int argc, char **argv) {
bool just_exit = false;
bool shutdown_after = false;
int retry_count = 0;
+ bool security_update = false;
int arg;
while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) {
@@ -1351,6 +1353,7 @@ int main(int argc, char **argv) {
}
case 'p': shutdown_after = true; break;
case 'r': reason = optarg; break;
+ case 'e': security_update = true; break;
case '?':
LOGE("Invalid command argument\n");
continue;
@@ -1370,6 +1373,9 @@ int main(int argc, char **argv) {
ui->SetLocale(locale);
ui->Init();
+ // Set background string to "installing security update" for security update,
+ // otherwise set it to "installing system update".
+ ui->SetSystemUpdateText(security_update);
int st_cur, st_max;
if (stage != NULL && sscanf(stage, "%d/%d", &st_cur, &st_max) == 2) {
diff --git a/screen_ui.cpp b/screen_ui.cpp
index cd3671f55..369755438 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -425,6 +425,16 @@ static char** Alloc2d(size_t rows, size_t cols) {
return result;
}
+// Choose the right background string to display during update.
+void ScreenRecoveryUI::SetSystemUpdateText(bool security_update) {
+ if (security_update) {
+ LoadLocalizedBitmap("installing_security_text", &installing_text);
+ } else {
+ LoadLocalizedBitmap("installing_text", &installing_text);
+ }
+ Redraw();
+}
+
void ScreenRecoveryUI::Init() {
gr_init();
@@ -450,7 +460,10 @@ void ScreenRecoveryUI::Init() {
LoadBitmap("stage_empty", &stageMarkerEmpty);
LoadBitmap("stage_fill", &stageMarkerFill);
- LoadLocalizedBitmap("installing_text", &installing_text);
+ // Background text for "installing_update" could be "installing update"
+ // or "installing security update". It will be set after UI init according
+ // to commands in BCB.
+ installing_text = nullptr;
LoadLocalizedBitmap("erasing_text", &erasing_text);
LoadLocalizedBitmap("no_command_text", &no_command_text);
LoadLocalizedBitmap("error_text", &error_text);
diff --git a/screen_ui.h b/screen_ui.h
index d8ac85bea..4319b76ce 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -34,6 +34,7 @@ class ScreenRecoveryUI : public RecoveryUI {
// overall recovery state ("background image")
void SetBackground(Icon icon);
+ void SetSystemUpdateText(bool security_update);
// progress indicator
void SetProgressType(ProgressType type);
diff --git a/tests/component/verifier_test.cpp b/tests/component/verifier_test.cpp
index 6a5e36901..d7166dfaf 100644
--- a/tests/component/verifier_test.cpp
+++ b/tests/component/verifier_test.cpp
@@ -46,6 +46,7 @@ class MockUI : public RecoveryUI {
void SetStage(int, int) { }
void SetLocale(const char*) { }
void SetBackground(Icon /*icon*/) { }
+ void SetSystemUpdateText(bool /*security_update*/) { }
void SetProgressType(ProgressType /*determinate*/) { }
void ShowProgress(float /*portion*/, float /*seconds*/) { }
diff --git a/ui.h b/ui.h
index ca72911db..82d95a346 100644
--- a/ui.h
+++ b/ui.h
@@ -39,6 +39,7 @@ class RecoveryUI {
// Set the overall recovery state ("background image").
enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
virtual void SetBackground(Icon icon) = 0;
+ virtual void SetSystemUpdateText(bool security_update) = 0;
// --- progress indicator ---
enum ProgressType { EMPTY, INDETERMINATE, DETERMINATE };