summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install.cpp2
-rw-r--r--install.h2
-rw-r--r--minui/graphics.c16
-rw-r--r--minui/minui.h2
-rw-r--r--minui/resources.c150
-rw-r--r--minzip/inline_magic.h2
-rw-r--r--mtdutils/mtdutils.c8
-rw-r--r--recovery.cpp66
-rw-r--r--res/images/erasing_text.pngbin0 -> 4511 bytes
-rw-r--r--res/images/error_text.pngbin0 -> 3119 bytes
-rw-r--r--res/images/icon_error.pngbin19306 -> 18244 bytes
-rw-r--r--res/images/icon_installing.pngbin25261 -> 21072 bytes
-rw-r--r--res/images/icon_installing_overlay01.pngbin10095 -> 8017 bytes
-rw-r--r--res/images/icon_installing_overlay02.pngbin9990 -> 7803 bytes
-rw-r--r--res/images/icon_installing_overlay03.pngbin9782 -> 7489 bytes
-rw-r--r--res/images/icon_installing_overlay04.pngbin9817 -> 7150 bytes
-rw-r--r--res/images/icon_installing_overlay05.pngbin9863 -> 7271 bytes
-rw-r--r--res/images/icon_installing_overlay06.pngbin9944 -> 7400 bytes
-rw-r--r--res/images/icon_installing_overlay07.pngbin10062 -> 7568 bytes
-rw-r--r--res/images/icon_installing_overlay08.pngbin0 -> 7901 bytes
-rw-r--r--res/images/icon_installing_overlay09.pngbin0 -> 8455 bytes
-rw-r--r--res/images/icon_installing_overlay10.pngbin0 -> 8740 bytes
-rw-r--r--res/images/icon_installing_overlay11.pngbin0 -> 8764 bytes
-rw-r--r--res/images/icon_installing_overlay12.pngbin0 -> 8547 bytes
-rw-r--r--res/images/icon_installing_overlay13.pngbin0 -> 8405 bytes
-rw-r--r--res/images/icon_installing_overlay14.pngbin0 -> 8114 bytes
-rw-r--r--res/images/icon_installing_overlay15.pngbin0 -> 7740 bytes
-rw-r--r--res/images/icon_installing_overlay16.pngbin0 -> 7685 bytes
-rw-r--r--res/images/icon_installing_overlay17.pngbin0 -> 7719 bytes
-rw-r--r--res/images/icon_installing_overlay18.pngbin0 -> 7565 bytes
-rw-r--r--res/images/icon_installing_overlay19.pngbin0 -> 7259 bytes
-rw-r--r--res/images/icon_installing_overlay20.pngbin0 -> 6993 bytes
-rw-r--r--res/images/icon_installing_overlay21.pngbin0 -> 7361 bytes
-rw-r--r--res/images/icon_installing_overlay22.pngbin0 -> 7457 bytes
-rw-r--r--res/images/icon_installing_overlay23.pngbin0 -> 7512 bytes
-rw-r--r--res/images/icon_installing_overlay24.pngbin0 -> 7572 bytes
-rw-r--r--res/images/icon_installing_overlay25.pngbin0 -> 7768 bytes
-rw-r--r--res/images/icon_installing_overlay26.pngbin0 -> 8299 bytes
-rw-r--r--res/images/icon_installing_overlay27.pngbin0 -> 8642 bytes
-rw-r--r--res/images/icon_installing_overlay28.pngbin0 -> 8828 bytes
-rw-r--r--res/images/icon_installing_overlay29.pngbin0 -> 8898 bytes
-rw-r--r--res/images/icon_installing_overlay30.pngbin0 -> 8700 bytes
-rw-r--r--res/images/icon_installing_overlay31.pngbin0 -> 8343 bytes
-rw-r--r--res/images/icon_installing_overlay32.pngbin0 -> 7846 bytes
-rw-r--r--res/images/icon_installing_overlay33.pngbin0 -> 7673 bytes
-rw-r--r--res/images/icon_installing_overlay34.pngbin0 -> 7378 bytes
-rw-r--r--res/images/icon_installing_overlay35.pngbin0 -> 7203 bytes
-rw-r--r--res/images/icon_installing_overlay36.pngbin0 -> 7208 bytes
-rw-r--r--res/images/icon_installing_overlay37.pngbin0 -> 7567 bytes
-rw-r--r--res/images/icon_installing_overlay38.pngbin0 -> 7912 bytes
-rw-r--r--res/images/icon_installing_overlay39.pngbin0 -> 8156 bytes
-rw-r--r--res/images/icon_installing_overlay40.pngbin0 -> 8288 bytes
-rw-r--r--res/images/icon_installing_overlay41.pngbin0 -> 8416 bytes
-rw-r--r--res/images/icon_installing_overlay42.pngbin0 -> 8173 bytes
-rw-r--r--res/images/icon_installing_overlay43.pngbin0 -> 7701 bytes
-rw-r--r--res/images/icon_installing_overlay44.pngbin0 -> 7452 bytes
-rw-r--r--res/images/icon_installing_overlay45.pngbin0 -> 7795 bytes
-rw-r--r--res/images/icon_installing_overlay46.pngbin0 -> 8031 bytes
-rw-r--r--res/images/icon_installing_overlay47.pngbin0 -> 8033 bytes
-rw-r--r--res/images/icon_installing_overlay48.pngbin0 -> 8042 bytes
-rw-r--r--res/images/indeterminate01.pngbin673 -> 592 bytes
-rw-r--r--res/images/indeterminate02.pngbin687 -> 607 bytes
-rw-r--r--res/images/indeterminate03.pngbin661 -> 559 bytes
-rw-r--r--res/images/indeterminate04.pngbin665 -> 568 bytes
-rw-r--r--res/images/indeterminate05.pngbin683 -> 559 bytes
-rw-r--r--res/images/indeterminate06.pngbin676 -> 577 bytes
-rw-r--r--res/images/indeterminate07.pngbin0 -> 590 bytes
-rw-r--r--res/images/indeterminate08.pngbin0 -> 603 bytes
-rw-r--r--res/images/indeterminate09.pngbin0 -> 597 bytes
-rw-r--r--res/images/indeterminate10.pngbin0 -> 603 bytes
-rw-r--r--res/images/indeterminate11.pngbin0 -> 603 bytes
-rw-r--r--res/images/indeterminate12.pngbin0 -> 612 bytes
-rw-r--r--res/images/indeterminate13.pngbin0 -> 616 bytes
-rw-r--r--res/images/indeterminate14.pngbin0 -> 608 bytes
-rw-r--r--res/images/indeterminate15.pngbin0 -> 627 bytes
-rw-r--r--res/images/indeterminate16.pngbin0 -> 617 bytes
-rw-r--r--res/images/installing_text.pngbin0 -> 6433 bytes
-rw-r--r--res/images/no_command_text.pngbin0 -> 2528 bytes
-rw-r--r--screen_ui.cpp69
-rw-r--r--screen_ui.h6
-rw-r--r--tools/ota/check-lost+found.c2
-rw-r--r--ui.h2
82 files changed, 287 insertions, 40 deletions
diff --git a/install.cpp b/install.cpp
index 819650e1f..b8f478130 100644
--- a/install.cpp
+++ b/install.cpp
@@ -277,7 +277,7 @@ exit:
static int
really_install_package(const char *path, int* wipe_cache)
{
- ui->SetBackground(RecoveryUI::INSTALLING);
+ ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
ui->Print("Finding update package...\n");
ui->SetProgressType(RecoveryUI::INDETERMINATE);
LOGI("Update location: %s\n", path);
diff --git a/install.h b/install.h
index 1943f02d3..2ada529ef 100644
--- a/install.h
+++ b/install.h
@@ -23,7 +23,7 @@
extern "C" {
#endif
-enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT };
+enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE };
// Install the package specified by root_path. If INSTALL_SUCCESS is
// returned and *wipe_cache is true on exit, caller should wipe the
// cache partition.
diff --git a/minui/graphics.c b/minui/graphics.c
index 81f13ad2c..88572a878 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -244,6 +244,22 @@ int gr_text(int x, int y, const char *s)
return x;
}
+void gr_texticon(int x, int y, gr_surface icon) {
+ GGLContext* gl = gr_context;
+
+ gl->bindTexture(gl, (GGLSurface*) icon);
+ gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
+ gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
+ gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
+ gl->enable(gl, GGL_TEXTURE_2D);
+
+ int w = gr_get_width(icon);
+ int h = gr_get_height(icon);
+
+ gl->texCoord2i(gl, -x, -y);
+ gl->recti(gl, x, y, x+gr_get_width(icon), y+gr_get_height(icon));
+}
+
void gr_fill(int x, int y, int w, int h)
{
GGLContext *gl = gr_context;
diff --git a/minui/minui.h b/minui/minui.h
index 74da4e9c0..767ffcb50 100644
--- a/minui/minui.h
+++ b/minui/minui.h
@@ -38,6 +38,7 @@ void gr_fb_blank(bool blank);
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
void gr_fill(int x, int y, int w, int h);
int gr_text(int x, int y, const char *s);
+ void gr_texticon(int x, int y, gr_surface icon);
int gr_measure(const char *s);
void gr_font_size(int *x, int *y);
@@ -71,6 +72,7 @@ void ev_dispatch(void);
// Returns 0 if no error, else negative.
int res_create_surface(const char* name, gr_surface* pSurface);
+int res_create_localized_surface(const char* name, gr_surface* pSurface);
void res_free_surface(gr_surface surface);
#ifdef __cplusplus
diff --git a/minui/resources.c b/minui/resources.c
index b437a87cb..af8720a56 100644
--- a/minui/resources.c
+++ b/minui/resources.c
@@ -33,6 +33,8 @@
#include "minui.h"
+extern char* locale;
+
// libpng gives "undefined reference to 'pow'" errors, and I have no
// idea how to convince the build system to link with -lm. We don't
// need this functionality (it's used for gamma adjustment) so provide
@@ -173,6 +175,154 @@ exit:
return result;
}
+static int matches_locale(const char* loc) {
+ if (locale == NULL) return 0;
+
+ printf("matching loc=[%s] vs locale=[%s]\n", loc, locale);
+
+ if (strcmp(loc, locale) == 0) return 1;
+
+ // if loc does *not* have an underscore, and it matches the start
+ // of locale, and the next character in locale *is* an underscore,
+ // that's a match. For instance, loc == "en" matches locale ==
+ // "en_US".
+
+ int i;
+ for (i = 0; loc[i] != 0 && loc[i] != '_'; ++i);
+ if (loc[i] == '_') return 0;
+ printf(" partial match possible; i = %d\n", i);
+
+ return (strncmp(locale, loc, i) == 0 && locale[i] == '_');
+}
+
+int res_create_localized_surface(const char* name, gr_surface* pSurface) {
+ char resPath[256];
+ GGLSurface* surface = NULL;
+ int result = 0;
+ unsigned char header[8];
+ png_structp png_ptr = NULL;
+ png_infop info_ptr = NULL;
+
+ *pSurface = NULL;
+
+ snprintf(resPath, sizeof(resPath)-1, "/res/images/%s.png", name);
+ resPath[sizeof(resPath)-1] = '\0';
+ FILE* fp = fopen(resPath, "rb");
+ if (fp == NULL) {
+ result = -1;
+ goto exit;
+ }
+
+ size_t bytesRead = fread(header, 1, sizeof(header), fp);
+ if (bytesRead != sizeof(header)) {
+ result = -2;
+ goto exit;
+ }
+
+ if (png_sig_cmp(header, 0, sizeof(header))) {
+ result = -3;
+ goto exit;
+ }
+
+ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (!png_ptr) {
+ result = -4;
+ goto exit;
+ }
+
+ info_ptr = png_create_info_struct(png_ptr);
+ if (!info_ptr) {
+ result = -5;
+ goto exit;
+ }
+
+ if (setjmp(png_jmpbuf(png_ptr))) {
+ result = -6;
+ goto exit;
+ }
+
+ png_init_io(png_ptr, fp);
+ png_set_sig_bytes(png_ptr, sizeof(header));
+ png_read_info(png_ptr, info_ptr);
+
+ size_t width = info_ptr->width;
+ size_t height = info_ptr->height;
+ size_t stride = 4 * width;
+
+ printf("image size is %d x %d\n", width, height);
+
+ int color_type = info_ptr->color_type;
+ int bit_depth = info_ptr->bit_depth;
+ int channels = info_ptr->channels;
+ printf("color_type %d bit_depth %d channels %d\n",
+ color_type, bit_depth, channels);
+
+ if (!(bit_depth == 8 &&
+ (channels == 1 && color_type == PNG_COLOR_TYPE_GRAY))) {
+ return -7;
+ printf("exiting -7\n");
+ goto exit;
+ }
+
+ unsigned char* row = malloc(width);
+ int y;
+ for (y = 0; y < height; ++y) {
+ png_read_row(png_ptr, row, NULL);
+ int w = (row[1] << 8) | row[0];
+ int h = (row[3] << 8) | row[2];
+ int len = row[4];
+ char* loc = row+5;
+
+ printf("row %d: %s %d x %d\n", y, loc, w, h);
+
+ if (y+1+h >= height || matches_locale(loc)) {
+ printf(" taking this one\n");
+
+ surface = malloc(sizeof(GGLSurface));
+ if (surface == NULL) {
+ result = -8;
+ goto exit;
+ }
+ unsigned char* pData = malloc(w*h);
+
+ surface->version = sizeof(GGLSurface);
+ surface->width = w;
+ surface->height = h;
+ surface->stride = w; /* Yes, pixels, not bytes */
+ surface->data = pData;
+ surface->format = GGL_PIXEL_FORMAT_A_8;
+
+ int i;
+ for (i = 0; i < h; ++i, ++y) {
+ png_read_row(png_ptr, row, NULL);
+ memcpy(pData + i*w, row, w);
+ }
+
+ *pSurface = (gr_surface) surface;
+ break;
+ } else {
+ printf(" skipping\n");
+ int i;
+ for (i = 0; i < h; ++i, ++y) {
+ png_read_row(png_ptr, row, NULL);
+ }
+ }
+ }
+
+exit:
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+
+ if (fp != NULL) {
+ fclose(fp);
+ }
+ if (result < 0) {
+ if (surface) {
+ free(surface);
+ }
+ }
+ return result;
+}
+
void res_free_surface(gr_surface surface) {
GGLSurface* pSurface = (GGLSurface*) surface;
if (pSurface) {
diff --git a/minzip/inline_magic.h b/minzip/inline_magic.h
index 8c185e155..59c659f77 100644
--- a/minzip/inline_magic.h
+++ b/minzip/inline_magic.h
@@ -18,7 +18,7 @@
#define MINZIP_INLINE_MAGIC_H_
#ifndef MINZIP_GENERATE_INLINES
-#define INLINE extern __inline__
+#define INLINE extern inline __attribute((__gnu_inline__))
#else
#define INLINE
#endif
diff --git a/mtdutils/mtdutils.c b/mtdutils/mtdutils.c
index e4d2a6064..107cbb9a8 100644
--- a/mtdutils/mtdutils.c
+++ b/mtdutils/mtdutils.c
@@ -328,8 +328,8 @@ static int read_block(const MtdPartition *partition, int fd, char *data)
ssize_t mtd_read_data(MtdReadContext *ctx, char *data, size_t len)
{
- ssize_t read = 0;
- while (read < (int) len) {
+ size_t read = 0;
+ while (read < len) {
if (ctx->consumed < ctx->partition->erase_size) {
size_t avail = ctx->partition->erase_size - ctx->consumed;
size_t copy = len - read < avail ? len - read : avail;
@@ -350,7 +350,7 @@ ssize_t mtd_read_data(MtdReadContext *ctx, char *data, size_t len)
}
// Read the next block into the buffer
- if (ctx->consumed == ctx->partition->erase_size && read < (int) len) {
+ if (ctx->consumed == ctx->partition->erase_size && read < len) {
if (read_block(ctx->partition, ctx->fd, ctx->buffer)) return -1;
ctx->consumed = 0;
}
@@ -457,7 +457,7 @@ static int write_block(MtdWriteContext *ctx, const char *data)
if (retry > 0) {
fprintf(stderr, "mtd: wrote block after %d retries\n", retry);
}
- fprintf(stderr, "mtd: successfully wrote block at %llx\n", pos);
+ fprintf(stderr, "mtd: successfully wrote block at %lx\n", pos);
return 0; // Success!
}
diff --git a/recovery.cpp b/recovery.cpp
index ce4358a53..70817d307 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -54,6 +54,7 @@ static const struct option OPTIONS[] = {
{ "wipe_cache", no_argument, NULL, 'c' },
{ "show_text", no_argument, NULL, 't' },
{ "just_exit", no_argument, NULL, 'x' },
+ { "locale", required_argument, NULL, 'l' },
{ NULL, 0, NULL, 0 },
};
@@ -62,6 +63,7 @@ static const char *INTENT_FILE = "/cache/recovery/intent";
static const char *LOG_FILE = "/cache/recovery/log";
static const char *LAST_LOG_FILE = "/cache/recovery/last_log";
static const char *LAST_INSTALL_FILE = "/cache/recovery/last_install";
+static const char *LOCALE_FILE = "/cache/recovery/locale";
static const char *CACHE_ROOT = "/cache";
static const char *SDCARD_ROOT = "/sdcard";
static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
@@ -69,6 +71,7 @@ static const char *TEMPORARY_INSTALL_FILE = "/tmp/last_install";
static const char *SIDELOAD_TEMP_DIR = "/tmp/sideload";
RecoveryUI* ui = NULL;
+char* locale = NULL;
/*
* The recovery tool communicates with the main system through /cache files.
@@ -274,6 +277,18 @@ finish_recovery(const char *send_intent) {
}
}
+ // Save the locale to cache, so if recovery is next started up
+ // without a --locale argument (eg, directly from the bootloader)
+ // it will use the last-known locale.
+ if (locale != NULL) {
+ LOGI("Saving locale \"%s\"\n", locale);
+ FILE* fp = fopen_path(LOCALE_FILE, "w");
+ fwrite(locale, 1, strlen(locale), fp);
+ fflush(fp);
+ fsync(fileno(fp));
+ check_and_fclose(fp, LOCALE_FILE);
+ }
+
// Copy logs to cache so the system can find out what happened.
copy_log_file(TEMPORARY_LOG_FILE, LOG_FILE, true);
copy_log_file(TEMPORARY_LOG_FILE, LAST_LOG_FILE, false);
@@ -300,7 +315,7 @@ finish_recovery(const char *send_intent) {
static int
erase_volume(const char *volume) {
- ui->SetBackground(RecoveryUI::INSTALLING);
+ ui->SetBackground(RecoveryUI::ERASING);
ui->SetProgressType(RecoveryUI::INDETERMINATE);
ui->Print("Formatting %s...\n", volume);
@@ -658,6 +673,7 @@ prompt_and_wait(Device* device) {
for (;;) {
finish_recovery(NULL);
+ ui->SetBackground(RecoveryUI::NO_COMMAND);
ui->SetProgressType(RecoveryUI::EMPTY);
int chosen_item = get_menu_selection(headers, device->GetMenuItems(), 0, 0, device);
@@ -679,6 +695,7 @@ prompt_and_wait(Device* device) {
break;
case Device::WIPE_CACHE:
+ ui->ShowText(false);
ui->Print("\n-- Wiping cache...\n");
erase_volume("/cache");
ui->Print("Cache wipe complete.\n");
@@ -757,6 +774,24 @@ print_property(const char *key, const char *name, void *cookie) {
printf("%s=%s\n", key, name);
}
+static void
+load_locale_from_cache() {
+ FILE* fp = fopen_path(LOCALE_FILE, "r");
+ char buffer[80];
+ if (fp != NULL) {
+ fgets(buffer, sizeof(buffer), fp);
+ int j = 0;
+ int i;
+ for (i = 0; i < sizeof(buffer) && buffer[i]; ++i) {
+ if (!isspace(buffer[i])) {
+ buffer[j++] = buffer[i];
+ }
+ }
+ buffer[j] = 0;
+ locale = strdup(buffer);
+ }
+}
+
int
main(int argc, char **argv) {
time_t start = time(NULL);
@@ -779,18 +814,13 @@ main(int argc, char **argv) {
printf("Starting recovery on %s", ctime(&start));
- Device* device = make_device();
- ui = device->GetUI();
-
- ui->Init();
- ui->SetBackground(RecoveryUI::NONE);
load_volume_table();
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;
+ int wipe_data = 0, wipe_cache = 0, show_text = 0;
bool just_exit = false;
int arg;
@@ -801,14 +831,27 @@ main(int argc, char **argv) {
case 'u': update_package = optarg; break;
case 'w': wipe_data = wipe_cache = 1; break;
case 'c': wipe_cache = 1; break;
- case 't': ui->ShowText(true); break;
+ case 't': show_text = 1; break;
case 'x': just_exit = true; break;
+ case 'l': locale = optarg; break;
case '?':
LOGE("Invalid command argument\n");
continue;
}
}
+ if (locale == NULL) {
+ load_locale_from_cache();
+ }
+ printf("locale is [%s]\n", locale);
+
+ Device* device = make_device();
+ ui = device->GetUI();
+
+ ui->Init();
+ ui->SetBackground(RecoveryUI::NONE);
+ if (show_text) ui->ShowText(true);
+
#ifdef HAVE_SELINUX
struct selinux_opt seopts[] = {
{ SELABEL_OPT_PATH, "/file_contexts" }
@@ -868,10 +911,13 @@ main(int argc, char **argv) {
if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR;
if (status != INSTALL_SUCCESS) ui->Print("Cache wipe failed.\n");
} else if (!just_exit) {
- status = INSTALL_ERROR; // No command specified
+ status = INSTALL_NONE; // No command specified
+ ui->SetBackground(RecoveryUI::NO_COMMAND);
}
- if (status != INSTALL_SUCCESS) ui->SetBackground(RecoveryUI::ERROR);
+ if (status == INSTALL_ERROR || status == INSTALL_CORRUPT) {
+ ui->SetBackground(RecoveryUI::ERROR);
+ }
if (status != INSTALL_SUCCESS || ui->IsTextVisible()) {
prompt_and_wait(device);
}
diff --git a/res/images/erasing_text.png b/res/images/erasing_text.png
new file mode 100644
index 000000000..f92119772
--- /dev/null
+++ b/res/images/erasing_text.png
Binary files differ
diff --git a/res/images/error_text.png b/res/images/error_text.png
new file mode 100644
index 000000000..581347094
--- /dev/null
+++ b/res/images/error_text.png
Binary files differ
diff --git a/res/images/icon_error.png b/res/images/icon_error.png
index cb3d1ab22..7000d4d8a 100644
--- a/res/images/icon_error.png
+++ b/res/images/icon_error.png
Binary files differ
diff --git a/res/images/icon_installing.png b/res/images/icon_installing.png
index 571eb8b0f..ad7927753 100644
--- a/res/images/icon_installing.png
+++ b/res/images/icon_installing.png
Binary files differ
diff --git a/res/images/icon_installing_overlay01.png b/res/images/icon_installing_overlay01.png
index e762d6cbe..c9f6125d9 100644
--- a/res/images/icon_installing_overlay01.png
+++ b/res/images/icon_installing_overlay01.png
Binary files differ
diff --git a/res/images/icon_installing_overlay02.png b/res/images/icon_installing_overlay02.png
index f7a853017..c87e5fa92 100644
--- a/res/images/icon_installing_overlay02.png
+++ b/res/images/icon_installing_overlay02.png
Binary files differ
diff --git a/res/images/icon_installing_overlay03.png b/res/images/icon_installing_overlay03.png
index 1a1d738e4..30e95803f 100644
--- a/res/images/icon_installing_overlay03.png
+++ b/res/images/icon_installing_overlay03.png
Binary files differ
diff --git a/res/images/icon_installing_overlay04.png b/res/images/icon_installing_overlay04.png
index a74903d33..6f1f9cf0d 100644
--- a/res/images/icon_installing_overlay04.png
+++ b/res/images/icon_installing_overlay04.png
Binary files differ
diff --git a/res/images/icon_installing_overlay05.png b/res/images/icon_installing_overlay05.png
index d17bdc006..8791abdbd 100644
--- a/res/images/icon_installing_overlay05.png
+++ b/res/images/icon_installing_overlay05.png
Binary files differ
diff --git a/res/images/icon_installing_overlay06.png b/res/images/icon_installing_overlay06.png
index 1200b75cb..08a0133b0 100644
--- a/res/images/icon_installing_overlay06.png
+++ b/res/images/icon_installing_overlay06.png
Binary files differ
diff --git a/res/images/icon_installing_overlay07.png b/res/images/icon_installing_overlay07.png
index 3838a85ad..15b53d9b7 100644
--- a/res/images/icon_installing_overlay07.png
+++ b/res/images/icon_installing_overlay07.png
Binary files differ
diff --git a/res/images/icon_installing_overlay08.png b/res/images/icon_installing_overlay08.png
new file mode 100644
index 000000000..bb4987894
--- /dev/null
+++ b/res/images/icon_installing_overlay08.png
Binary files differ
diff --git a/res/images/icon_installing_overlay09.png b/res/images/icon_installing_overlay09.png
new file mode 100644
index 000000000..e8715fcfa
--- /dev/null
+++ b/res/images/icon_installing_overlay09.png
Binary files differ
diff --git a/res/images/icon_installing_overlay10.png b/res/images/icon_installing_overlay10.png
new file mode 100644
index 000000000..4ad81bf71
--- /dev/null
+++ b/res/images/icon_installing_overlay10.png
Binary files differ
diff --git a/res/images/icon_installing_overlay11.png b/res/images/icon_installing_overlay11.png
new file mode 100644
index 000000000..b3ae7e3ad
--- /dev/null
+++ b/res/images/icon_installing_overlay11.png
Binary files differ
diff --git a/res/images/icon_installing_overlay12.png b/res/images/icon_installing_overlay12.png
new file mode 100644
index 000000000..5e7fd04a6
--- /dev/null
+++ b/res/images/icon_installing_overlay12.png
Binary files differ
diff --git a/res/images/icon_installing_overlay13.png b/res/images/icon_installing_overlay13.png
new file mode 100644
index 000000000..4e4dbe923
--- /dev/null
+++ b/res/images/icon_installing_overlay13.png
Binary files differ
diff --git a/res/images/icon_installing_overlay14.png b/res/images/icon_installing_overlay14.png
new file mode 100644
index 000000000..55e19b5e4
--- /dev/null
+++ b/res/images/icon_installing_overlay14.png
Binary files differ
diff --git a/res/images/icon_installing_overlay15.png b/res/images/icon_installing_overlay15.png
new file mode 100644
index 000000000..ac5fb991c
--- /dev/null
+++ b/res/images/icon_installing_overlay15.png
Binary files differ
diff --git a/res/images/icon_installing_overlay16.png b/res/images/icon_installing_overlay16.png
new file mode 100644
index 000000000..6461d70f1
--- /dev/null
+++ b/res/images/icon_installing_overlay16.png
Binary files differ
diff --git a/res/images/icon_installing_overlay17.png b/res/images/icon_installing_overlay17.png
new file mode 100644
index 000000000..cc981d347
--- /dev/null
+++ b/res/images/icon_installing_overlay17.png
Binary files differ
diff --git a/res/images/icon_installing_overlay18.png b/res/images/icon_installing_overlay18.png
new file mode 100644
index 000000000..2b3221444
--- /dev/null
+++ b/res/images/icon_installing_overlay18.png
Binary files differ
diff --git a/res/images/icon_installing_overlay19.png b/res/images/icon_installing_overlay19.png
new file mode 100644
index 000000000..d379e51a1
--- /dev/null
+++ b/res/images/icon_installing_overlay19.png
Binary files differ
diff --git a/res/images/icon_installing_overlay20.png b/res/images/icon_installing_overlay20.png
new file mode 100644
index 000000000..362a8cabc
--- /dev/null
+++ b/res/images/icon_installing_overlay20.png
Binary files differ
diff --git a/res/images/icon_installing_overlay21.png b/res/images/icon_installing_overlay21.png
new file mode 100644
index 000000000..0b6559222
--- /dev/null
+++ b/res/images/icon_installing_overlay21.png
Binary files differ
diff --git a/res/images/icon_installing_overlay22.png b/res/images/icon_installing_overlay22.png
new file mode 100644
index 000000000..51d5cbadf
--- /dev/null
+++ b/res/images/icon_installing_overlay22.png
Binary files differ
diff --git a/res/images/icon_installing_overlay23.png b/res/images/icon_installing_overlay23.png
new file mode 100644
index 000000000..59148e5cc
--- /dev/null
+++ b/res/images/icon_installing_overlay23.png
Binary files differ
diff --git a/res/images/icon_installing_overlay24.png b/res/images/icon_installing_overlay24.png
new file mode 100644
index 000000000..d315673b4
--- /dev/null
+++ b/res/images/icon_installing_overlay24.png
Binary files differ
diff --git a/res/images/icon_installing_overlay25.png b/res/images/icon_installing_overlay25.png
new file mode 100644
index 000000000..1eb7843e3
--- /dev/null
+++ b/res/images/icon_installing_overlay25.png
Binary files differ
diff --git a/res/images/icon_installing_overlay26.png b/res/images/icon_installing_overlay26.png
new file mode 100644
index 000000000..14a024dcf
--- /dev/null
+++ b/res/images/icon_installing_overlay26.png
Binary files differ
diff --git a/res/images/icon_installing_overlay27.png b/res/images/icon_installing_overlay27.png
new file mode 100644
index 000000000..035c16340
--- /dev/null
+++ b/res/images/icon_installing_overlay27.png
Binary files differ
diff --git a/res/images/icon_installing_overlay28.png b/res/images/icon_installing_overlay28.png
new file mode 100644
index 000000000..75483864f
--- /dev/null
+++ b/res/images/icon_installing_overlay28.png
Binary files differ
diff --git a/res/images/icon_installing_overlay29.png b/res/images/icon_installing_overlay29.png
new file mode 100644
index 000000000..836d3138f
--- /dev/null
+++ b/res/images/icon_installing_overlay29.png
Binary files differ
diff --git a/res/images/icon_installing_overlay30.png b/res/images/icon_installing_overlay30.png
new file mode 100644
index 000000000..e470a7e1e
--- /dev/null
+++ b/res/images/icon_installing_overlay30.png
Binary files differ
diff --git a/res/images/icon_installing_overlay31.png b/res/images/icon_installing_overlay31.png
new file mode 100644
index 000000000..bed0c65aa
--- /dev/null
+++ b/res/images/icon_installing_overlay31.png
Binary files differ
diff --git a/res/images/icon_installing_overlay32.png b/res/images/icon_installing_overlay32.png
new file mode 100644
index 000000000..51811e0ac
--- /dev/null
+++ b/res/images/icon_installing_overlay32.png
Binary files differ
diff --git a/res/images/icon_installing_overlay33.png b/res/images/icon_installing_overlay33.png
new file mode 100644
index 000000000..f1fc656d5
--- /dev/null
+++ b/res/images/icon_installing_overlay33.png
Binary files differ
diff --git a/res/images/icon_installing_overlay34.png b/res/images/icon_installing_overlay34.png
new file mode 100644
index 000000000..5791a7d16
--- /dev/null
+++ b/res/images/icon_installing_overlay34.png
Binary files differ
diff --git a/res/images/icon_installing_overlay35.png b/res/images/icon_installing_overlay35.png
new file mode 100644
index 000000000..0769ec9eb
--- /dev/null
+++ b/res/images/icon_installing_overlay35.png
Binary files differ
diff --git a/res/images/icon_installing_overlay36.png b/res/images/icon_installing_overlay36.png
new file mode 100644
index 000000000..28a692bd2
--- /dev/null
+++ b/res/images/icon_installing_overlay36.png
Binary files differ
diff --git a/res/images/icon_installing_overlay37.png b/res/images/icon_installing_overlay37.png
new file mode 100644
index 000000000..12b21cfae
--- /dev/null
+++ b/res/images/icon_installing_overlay37.png
Binary files differ
diff --git a/res/images/icon_installing_overlay38.png b/res/images/icon_installing_overlay38.png
new file mode 100644
index 000000000..f8ef9967d
--- /dev/null
+++ b/res/images/icon_installing_overlay38.png
Binary files differ
diff --git a/res/images/icon_installing_overlay39.png b/res/images/icon_installing_overlay39.png
new file mode 100644
index 000000000..f929119ab
--- /dev/null
+++ b/res/images/icon_installing_overlay39.png
Binary files differ
diff --git a/res/images/icon_installing_overlay40.png b/res/images/icon_installing_overlay40.png
new file mode 100644
index 000000000..ceed45759
--- /dev/null
+++ b/res/images/icon_installing_overlay40.png
Binary files differ
diff --git a/res/images/icon_installing_overlay41.png b/res/images/icon_installing_overlay41.png
new file mode 100644
index 000000000..34cf1aec4
--- /dev/null
+++ b/res/images/icon_installing_overlay41.png
Binary files differ
diff --git a/res/images/icon_installing_overlay42.png b/res/images/icon_installing_overlay42.png
new file mode 100644
index 000000000..d622417ac
--- /dev/null
+++ b/res/images/icon_installing_overlay42.png
Binary files differ
diff --git a/res/images/icon_installing_overlay43.png b/res/images/icon_installing_overlay43.png
new file mode 100644
index 000000000..9902df1a7
--- /dev/null
+++ b/res/images/icon_installing_overlay43.png
Binary files differ
diff --git a/res/images/icon_installing_overlay44.png b/res/images/icon_installing_overlay44.png
new file mode 100644
index 000000000..b5d7911e1
--- /dev/null
+++ b/res/images/icon_installing_overlay44.png
Binary files differ
diff --git a/res/images/icon_installing_overlay45.png b/res/images/icon_installing_overlay45.png
new file mode 100644
index 000000000..dfbf408b6
--- /dev/null
+++ b/res/images/icon_installing_overlay45.png
Binary files differ
diff --git a/res/images/icon_installing_overlay46.png b/res/images/icon_installing_overlay46.png
new file mode 100644
index 000000000..495bb90df
--- /dev/null
+++ b/res/images/icon_installing_overlay46.png
Binary files differ
diff --git a/res/images/icon_installing_overlay47.png b/res/images/icon_installing_overlay47.png
new file mode 100644
index 000000000..9d6937866
--- /dev/null
+++ b/res/images/icon_installing_overlay47.png
Binary files differ
diff --git a/res/images/icon_installing_overlay48.png b/res/images/icon_installing_overlay48.png
new file mode 100644
index 000000000..a5080af97
--- /dev/null
+++ b/res/images/icon_installing_overlay48.png
Binary files differ
diff --git a/res/images/indeterminate01.png b/res/images/indeterminate01.png
index 933528d6d..4db384337 100644
--- a/res/images/indeterminate01.png
+++ b/res/images/indeterminate01.png
Binary files differ
diff --git a/res/images/indeterminate02.png b/res/images/indeterminate02.png
index d760e2bdd..761b2332f 100644
--- a/res/images/indeterminate02.png
+++ b/res/images/indeterminate02.png
Binary files differ
diff --git a/res/images/indeterminate03.png b/res/images/indeterminate03.png
index 0e97399d1..e2617abcb 100644
--- a/res/images/indeterminate03.png
+++ b/res/images/indeterminate03.png
Binary files differ
diff --git a/res/images/indeterminate04.png b/res/images/indeterminate04.png
index c7d5b4e04..132940e50 100644
--- a/res/images/indeterminate04.png
+++ b/res/images/indeterminate04.png
Binary files differ
diff --git a/res/images/indeterminate05.png b/res/images/indeterminate05.png
index d6fb2a032..a17032c2d 100644
--- a/res/images/indeterminate05.png
+++ b/res/images/indeterminate05.png
Binary files differ
diff --git a/res/images/indeterminate06.png b/res/images/indeterminate06.png
index 44867619f..efaac42e6 100644
--- a/res/images/indeterminate06.png
+++ b/res/images/indeterminate06.png
Binary files differ
diff --git a/res/images/indeterminate07.png b/res/images/indeterminate07.png
new file mode 100644
index 000000000..6e84a5a0f
--- /dev/null
+++ b/res/images/indeterminate07.png
Binary files differ
diff --git a/res/images/indeterminate08.png b/res/images/indeterminate08.png
new file mode 100644
index 000000000..58c112e38
--- /dev/null
+++ b/res/images/indeterminate08.png
Binary files differ
diff --git a/res/images/indeterminate09.png b/res/images/indeterminate09.png
new file mode 100644
index 000000000..b25145f12
--- /dev/null
+++ b/res/images/indeterminate09.png
Binary files differ
diff --git a/res/images/indeterminate10.png b/res/images/indeterminate10.png
new file mode 100644
index 000000000..4ff7e2527
--- /dev/null
+++ b/res/images/indeterminate10.png
Binary files differ
diff --git a/res/images/indeterminate11.png b/res/images/indeterminate11.png
new file mode 100644
index 000000000..4860c2a02
--- /dev/null
+++ b/res/images/indeterminate11.png
Binary files differ
diff --git a/res/images/indeterminate12.png b/res/images/indeterminate12.png
new file mode 100644
index 000000000..a249c225b
--- /dev/null
+++ b/res/images/indeterminate12.png
Binary files differ
diff --git a/res/images/indeterminate13.png b/res/images/indeterminate13.png
new file mode 100644
index 000000000..1b70dc072
--- /dev/null
+++ b/res/images/indeterminate13.png
Binary files differ
diff --git a/res/images/indeterminate14.png b/res/images/indeterminate14.png
new file mode 100644
index 000000000..a5f779f73
--- /dev/null
+++ b/res/images/indeterminate14.png
Binary files differ
diff --git a/res/images/indeterminate15.png b/res/images/indeterminate15.png
new file mode 100644
index 000000000..018fa685c
--- /dev/null
+++ b/res/images/indeterminate15.png
Binary files differ
diff --git a/res/images/indeterminate16.png b/res/images/indeterminate16.png
new file mode 100644
index 000000000..e8e05b6d3
--- /dev/null
+++ b/res/images/indeterminate16.png
Binary files differ
diff --git a/res/images/installing_text.png b/res/images/installing_text.png
new file mode 100644
index 000000000..c48a45295
--- /dev/null
+++ b/res/images/installing_text.png
Binary files differ
diff --git a/res/images/no_command_text.png b/res/images/no_command_text.png
new file mode 100644
index 000000000..1d6a5b7cf
--- /dev/null
+++ b/res/images/no_command_text.png
Binary files differ
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 3c6c3ae25..1f2471ade 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -75,10 +75,10 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
// that overrides Init() to set these values appropriately and
// then call the superclass Init().
animation_fps(20),
- indeterminate_frames(6),
- installing_frames(7),
- install_overlay_offset_x(13),
- install_overlay_offset_y(190) {
+ indeterminate_frames(16),
+ installing_frames(48),
+ install_overlay_offset_x(65),
+ install_overlay_offset_y(106) {
pthread_mutex_init(&updateMutex, NULL);
self = this;
}
@@ -94,7 +94,7 @@ void ScreenRecoveryUI::draw_install_overlay_locked(int frame) {
int iconWidth = gr_get_width(surface);
int iconHeight = gr_get_height(surface);
gr_blit(surface, 0, 0, iconWidth, iconHeight,
- install_overlay_offset_x, install_overlay_offset_y);
+ overlay_offset_x, overlay_offset_y);
}
// Clear the screen and draw the currently selected background icon (if any).
@@ -107,14 +107,26 @@ void ScreenRecoveryUI::draw_background_locked(Icon icon)
if (icon) {
gr_surface surface = backgroundIcon[icon];
+ gr_surface text_surface = backgroundText[icon];
+
int iconWidth = gr_get_width(surface);
int iconHeight = gr_get_height(surface);
+ int textWidth = gr_get_width(text_surface);
+ int textHeight = gr_get_height(text_surface);
+
int iconX = (gr_fb_width() - iconWidth) / 2;
- int iconY = (gr_fb_height() - iconHeight) / 2;
+ int iconY = (gr_fb_height() - (iconHeight+textHeight+40)) / 2;
+
+ int textX = (gr_fb_width() - textWidth) / 2;
+ int textY = ((gr_fb_height() - (iconHeight+textHeight+40)) / 2) + iconHeight + 40;
+
gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY);
- if (icon == INSTALLING) {
+ if (icon == INSTALLING_UPDATE || icon == ERASING) {
draw_install_overlay_locked(installingFrame);
}
+
+ gr_color(255, 255, 255, 255);
+ gr_texticon(textX, textY, text_surface);
}
}
@@ -124,12 +136,12 @@ void ScreenRecoveryUI::draw_progress_locked()
{
if (currentIcon == ERROR) return;
- if (currentIcon == INSTALLING) {
+ if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) {
draw_install_overlay_locked(installingFrame);
}
if (progressBarType != EMPTY) {
- int iconHeight = gr_get_height(backgroundIcon[INSTALLING]);
+ int iconHeight = gr_get_height(backgroundIcon[INSTALLING_UPDATE]);
int width = gr_get_width(progressBarEmpty);
int height = gr_get_height(progressBarEmpty);
@@ -242,7 +254,8 @@ void ScreenRecoveryUI::progress_loop() {
// update the installation animation, if active
// skip this if we have a text overlay (too expensive to update)
- if (currentIcon == INSTALLING && installing_frames > 0 && !show_text) {
+ if ((currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) &&
+ installing_frames > 0 && !show_text) {
installingFrame = (installingFrame + 1) % installing_frames;
redraw = 1;
}
@@ -283,6 +296,13 @@ void ScreenRecoveryUI::LoadBitmap(const char* filename, gr_surface* surface) {
}
}
+void ScreenRecoveryUI::LoadLocalizedBitmap(const char* filename, gr_surface* surface) {
+ int result = res_create_localized_surface(filename, surface);
+ if (result < 0) {
+ LOGE("missing bitmap %s\n(Code %d)\n", filename, result);
+ }
+}
+
void ScreenRecoveryUI::Init()
{
gr_init();
@@ -295,11 +315,19 @@ void ScreenRecoveryUI::Init()
text_cols = gr_fb_width() / CHAR_WIDTH;
if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;
- LoadBitmap("icon_installing", &backgroundIcon[INSTALLING]);
+ LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]);
+ backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
LoadBitmap("icon_error", &backgroundIcon[ERROR]);
+ backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
+
LoadBitmap("progress_empty", &progressBarEmpty);
LoadBitmap("progress_fill", &progressBarFill);
+ LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]);
+ LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]);
+ LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]);
+ LoadLocalizedBitmap("error_text", &backgroundText[ERROR]);
+
int i;
progressBarIndeterminate = (gr_surface*)malloc(indeterminate_frames *
@@ -321,14 +349,6 @@ void ScreenRecoveryUI::Init()
sprintf(filename, "icon_installing_overlay%02d", i+1);
LoadBitmap(filename, installationOverlay+i);
}
-
- // Adjust the offset to account for the positioning of the
- // base image on the screen.
- if (backgroundIcon[INSTALLING] != NULL) {
- gr_surface bg = backgroundIcon[INSTALLING];
- install_overlay_offset_x += (gr_fb_width() - gr_get_width(bg)) / 2;
- install_overlay_offset_y += (gr_fb_height() - gr_get_height(bg)) / 2;
- }
} else {
installationOverlay = NULL;
}
@@ -343,6 +363,17 @@ void ScreenRecoveryUI::SetBackground(Icon icon)
pthread_mutex_lock(&updateMutex);
currentIcon = icon;
update_screen_locked();
+
+ // Adjust the offset to account for the positioning of the
+ // base image on the screen.
+ if (backgroundIcon[icon] != NULL) {
+ gr_surface bg = backgroundIcon[icon];
+ gr_surface text = backgroundText[icon];
+ overlay_offset_x = install_overlay_offset_x + (gr_fb_width() - gr_get_width(bg)) / 2;
+ overlay_offset_y = install_overlay_offset_y +
+ (gr_fb_height() - (gr_get_height(bg) + gr_get_height(text) + 40)) / 2;
+ }
+
pthread_mutex_unlock(&updateMutex);
}
diff --git a/screen_ui.h b/screen_ui.h
index 34929ee1a..16ee741b7 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -57,7 +57,8 @@ class ScreenRecoveryUI : public RecoveryUI {
int installingFrame;
pthread_mutex_t updateMutex;
- gr_surface backgroundIcon[3];
+ gr_surface backgroundIcon[5];
+ gr_surface backgroundText[5];
gr_surface *installationOverlay;
gr_surface *progressBarIndeterminate;
gr_surface progressBarEmpty;
@@ -92,6 +93,7 @@ class ScreenRecoveryUI : public RecoveryUI {
int indeterminate_frames;
int installing_frames;
int install_overlay_offset_x, install_overlay_offset_y;
+ int overlay_offset_x, overlay_offset_y;
void draw_install_overlay_locked(int frame);
void draw_background_locked(Icon icon);
@@ -104,7 +106,7 @@ class ScreenRecoveryUI : public RecoveryUI {
void progress_loop();
void LoadBitmap(const char* filename, gr_surface* surface);
-
+ void LoadLocalizedBitmap(const char* filename, gr_surface* surface);
};
#endif // RECOVERY_UI_H
diff --git a/tools/ota/check-lost+found.c b/tools/ota/check-lost+found.c
index f85627544..da02f4602 100644
--- a/tools/ota/check-lost+found.c
+++ b/tools/ota/check-lost+found.c
@@ -44,7 +44,7 @@ static const char *kPartitions[] = { "/system", "/data", "/cache", NULL };
* 2. Write a log entry with the number of files in lost+found directories.
*/
-int main(int argc, char **argv) {
+int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) {
mkdir(kOutputDir, 0755);
chown(kOutputDir, AID_SYSTEM, AID_SYSTEM);
FILE *out = fopen(kOutputFile, "a");
diff --git a/ui.h b/ui.h
index 0d3b7bb98..ccbb466ac 100644
--- a/ui.h
+++ b/ui.h
@@ -31,7 +31,7 @@ class RecoveryUI {
virtual void Init();
// Set the overall recovery state ("background image").
- enum Icon { NONE, INSTALLING, ERROR };
+ enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR };
virtual void SetBackground(Icon icon) = 0;
// --- progress indicator ---