Add ability to show "installing security update"
Add a new command "--security" to boot commands. If this command is observed as part of BCB, choose a different background text picture for installing stage in recovery UI. As a result, users will see "installing security update" instead of "installing system update" when applying a security update package. Bug: 27837319 Change-Id: I2e2253a124993ecc24804fa1ee0b918ac96837c5
This commit is contained in:
parent
343eb722dd
commit
35926c4b89
5 changed files with 23 additions and 1 deletions
|
@ -75,6 +75,7 @@ static const struct option OPTIONS[] = {
|
||||||
{ "stages", required_argument, NULL, 'g' },
|
{ "stages", required_argument, NULL, 'g' },
|
||||||
{ "shutdown_after", no_argument, NULL, 'p' },
|
{ "shutdown_after", no_argument, NULL, 'p' },
|
||||||
{ "reason", required_argument, NULL, 'r' },
|
{ "reason", required_argument, NULL, 'r' },
|
||||||
|
{ "security", no_argument, NULL, 'e'},
|
||||||
{ NULL, 0, NULL, 0 },
|
{ NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1344,6 +1345,7 @@ int main(int argc, char **argv) {
|
||||||
bool just_exit = false;
|
bool just_exit = false;
|
||||||
bool shutdown_after = false;
|
bool shutdown_after = false;
|
||||||
int retry_count = 0;
|
int retry_count = 0;
|
||||||
|
bool security_update = false;
|
||||||
|
|
||||||
int arg;
|
int arg;
|
||||||
while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) {
|
while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) {
|
||||||
|
@ -1368,6 +1370,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
case 'p': shutdown_after = true; break;
|
case 'p': shutdown_after = true; break;
|
||||||
case 'r': reason = optarg; break;
|
case 'r': reason = optarg; break;
|
||||||
|
case 'e': security_update = true; break;
|
||||||
case '?':
|
case '?':
|
||||||
LOGE("Invalid command argument\n");
|
LOGE("Invalid command argument\n");
|
||||||
continue;
|
continue;
|
||||||
|
@ -1387,6 +1390,9 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
ui->SetLocale(locale);
|
ui->SetLocale(locale);
|
||||||
ui->Init();
|
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;
|
int st_cur, st_max;
|
||||||
if (stage != NULL && sscanf(stage, "%d/%d", &st_cur, &st_max) == 2) {
|
if (stage != NULL && sscanf(stage, "%d/%d", &st_cur, &st_max) == 2) {
|
||||||
|
|
|
@ -425,6 +425,16 @@ static char** Alloc2d(size_t rows, size_t cols) {
|
||||||
return result;
|
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() {
|
void ScreenRecoveryUI::Init() {
|
||||||
gr_init();
|
gr_init();
|
||||||
|
|
||||||
|
@ -450,7 +460,10 @@ void ScreenRecoveryUI::Init() {
|
||||||
LoadBitmap("stage_empty", &stageMarkerEmpty);
|
LoadBitmap("stage_empty", &stageMarkerEmpty);
|
||||||
LoadBitmap("stage_fill", &stageMarkerFill);
|
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("erasing_text", &erasing_text);
|
||||||
LoadLocalizedBitmap("no_command_text", &no_command_text);
|
LoadLocalizedBitmap("no_command_text", &no_command_text);
|
||||||
LoadLocalizedBitmap("error_text", &error_text);
|
LoadLocalizedBitmap("error_text", &error_text);
|
||||||
|
|
|
@ -34,6 +34,7 @@ class ScreenRecoveryUI : public RecoveryUI {
|
||||||
|
|
||||||
// overall recovery state ("background image")
|
// overall recovery state ("background image")
|
||||||
void SetBackground(Icon icon);
|
void SetBackground(Icon icon);
|
||||||
|
void SetSystemUpdateText(bool security_update);
|
||||||
|
|
||||||
// progress indicator
|
// progress indicator
|
||||||
void SetProgressType(ProgressType type);
|
void SetProgressType(ProgressType type);
|
||||||
|
|
|
@ -46,6 +46,7 @@ class MockUI : public RecoveryUI {
|
||||||
void SetStage(int, int) { }
|
void SetStage(int, int) { }
|
||||||
void SetLocale(const char*) { }
|
void SetLocale(const char*) { }
|
||||||
void SetBackground(Icon icon) { }
|
void SetBackground(Icon icon) { }
|
||||||
|
void SetSystemUpdateText(bool security_update) { }
|
||||||
|
|
||||||
void SetProgressType(ProgressType determinate) { }
|
void SetProgressType(ProgressType determinate) { }
|
||||||
void ShowProgress(float portion, float seconds) { }
|
void ShowProgress(float portion, float seconds) { }
|
||||||
|
|
1
ui.h
1
ui.h
|
@ -39,6 +39,7 @@ class RecoveryUI {
|
||||||
// Set the overall recovery state ("background image").
|
// Set the overall recovery state ("background image").
|
||||||
enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
|
enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
|
||||||
virtual void SetBackground(Icon icon) = 0;
|
virtual void SetBackground(Icon icon) = 0;
|
||||||
|
virtual void SetSystemUpdateText(bool security_update) = 0;
|
||||||
|
|
||||||
// --- progress indicator ---
|
// --- progress indicator ---
|
||||||
enum ProgressType { EMPTY, INDETERMINATE, DETERMINATE };
|
enum ProgressType { EMPTY, INDETERMINATE, DETERMINATE };
|
||||||
|
|
Loading…
Reference in a new issue