From cf5b17055b1276c187537cf5a054cf6ebe753113 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Tue, 24 Mar 2009 18:36:43 -0700 Subject: Automated import from //branches/donutburger/...@140818,140818 --- NOTICE | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 NOTICE diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000..c5b1efa7a --- /dev/null +++ b/NOTICE @@ -0,0 +1,190 @@ + + Copyright (c) 2005-2008, The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + -- cgit v1.2.3 From bc012de46e99fc936e6c06d19416b8414835c7b6 Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Tue, 24 Mar 2009 21:30:32 -0700 Subject: Automated import from //branches/donutburger/...@142141,142141 --- tools/ota/make-update-script.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/ota/make-update-script.c b/tools/ota/make-update-script.c index 225dc526a..1e1148bba 100644 --- a/tools/ota/make-update-script.c +++ b/tools/ota/make-update-script.c @@ -185,16 +185,21 @@ int main(int argc, char *argv[]) { } // The lines we're looking for look like: - // version-bootloader=x.yy.zzzz + // version-bootloader=x.yy.zzzz|x.yy.zzzz|... // or: - // require version-bootloader=x.yy.zzzz + // require version-bootloader=x.yy.zzzz|x.yy.zzzz|... char line[256]; while (fgets(line, sizeof(line), fp)) { - const char *name = strtok(line, "="), *value = strtok(NULL, "\n"); + const char *name = strtok(line, "="), *value = strtok(NULL, "|\n"); if (value != NULL && (!strcmp(name, "version-bootloader") || !strcmp(name, "require version-bootloader"))) { - printf("assert getprop(\"ro.bootloader\") == \"%s\"\n", value); + printf("assert getprop(\"ro.bootloader\") == \"%s\"", value); + + while ((value = strtok(NULL, "|\n")) != NULL) { + printf(" || getprop(\"ro.bootloader\") == \"%s\"", value); + } + printf("\n"); } // We also used to check version-baseband, but we update radio.img // ourselves, so there's no need. -- cgit v1.2.3 From 58bde316e22e392885de71d2391f2bc7f438ff1f Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Fri, 27 Mar 2009 13:25:30 -0700 Subject: AI 143128: Use PNG instead of BMP for recovery image icons. This saves about 60k from the recovery and system images. Automated import of CL 143128 --- Android.mk | 2 +- minui/resources.c | 167 +++++++++++--------------- res/images/icon_error.bmp | Bin 91076 -> 0 bytes res/images/icon_error.png | Bin 0 -> 9616 bytes res/images/icon_firmware_error.bmp | Bin 91076 -> 0 bytes res/images/icon_firmware_error.png | Bin 0 -> 8088 bytes res/images/icon_firmware_install.bmp | Bin 91076 -> 0 bytes res/images/icon_firmware_install.png | Bin 0 -> 11986 bytes res/images/icon_installing.bmp | Bin 91076 -> 0 bytes res/images/icon_installing.png | Bin 0 -> 10138 bytes res/images/icon_unpacking.bmp | Bin 91076 -> 0 bytes res/images/icon_unpacking.png | Bin 0 -> 7180 bytes res/images/indeterminate1.bmp | Bin 20214 -> 0 bytes res/images/indeterminate1.png | Bin 0 -> 2249 bytes res/images/indeterminate2.bmp | Bin 20214 -> 0 bytes res/images/indeterminate2.png | Bin 0 -> 2251 bytes res/images/indeterminate3.bmp | Bin 20214 -> 0 bytes res/images/indeterminate3.png | Bin 0 -> 2254 bytes res/images/indeterminate4.bmp | Bin 20214 -> 0 bytes res/images/indeterminate4.png | Bin 0 -> 2249 bytes res/images/indeterminate5.bmp | Bin 20214 -> 0 bytes res/images/indeterminate5.png | Bin 0 -> 2246 bytes res/images/indeterminate6.bmp | Bin 20214 -> 0 bytes res/images/indeterminate6.png | Bin 0 -> 2262 bytes res/images/progress_bar_empty.bmp | Bin 136 -> 0 bytes res/images/progress_bar_empty.png | Bin 0 -> 148 bytes res/images/progress_bar_empty_left_round.bmp | Bin 294 -> 0 bytes res/images/progress_bar_empty_left_round.png | Bin 0 -> 220 bytes res/images/progress_bar_empty_right_round.bmp | Bin 294 -> 0 bytes res/images/progress_bar_empty_right_round.png | Bin 0 -> 211 bytes res/images/progress_bar_fill.bmp | Bin 136 -> 0 bytes res/images/progress_bar_fill.png | Bin 0 -> 117 bytes res/images/progress_bar_left_round.bmp | Bin 294 -> 0 bytes res/images/progress_bar_left_round.png | Bin 0 -> 195 bytes res/images/progress_bar_right_round.bmp | Bin 294 -> 0 bytes res/images/progress_bar_right_round.png | Bin 0 -> 192 bytes 36 files changed, 68 insertions(+), 101 deletions(-) delete mode 100644 res/images/icon_error.bmp create mode 100644 res/images/icon_error.png delete mode 100644 res/images/icon_firmware_error.bmp create mode 100644 res/images/icon_firmware_error.png delete mode 100644 res/images/icon_firmware_install.bmp create mode 100644 res/images/icon_firmware_install.png delete mode 100644 res/images/icon_installing.bmp create mode 100644 res/images/icon_installing.png delete mode 100644 res/images/icon_unpacking.bmp create mode 100644 res/images/icon_unpacking.png delete mode 100644 res/images/indeterminate1.bmp create mode 100644 res/images/indeterminate1.png delete mode 100644 res/images/indeterminate2.bmp create mode 100644 res/images/indeterminate2.png delete mode 100644 res/images/indeterminate3.bmp create mode 100644 res/images/indeterminate3.png delete mode 100644 res/images/indeterminate4.bmp create mode 100644 res/images/indeterminate4.png delete mode 100644 res/images/indeterminate5.bmp create mode 100644 res/images/indeterminate5.png delete mode 100644 res/images/indeterminate6.bmp create mode 100644 res/images/indeterminate6.png delete mode 100644 res/images/progress_bar_empty.bmp create mode 100644 res/images/progress_bar_empty.png delete mode 100644 res/images/progress_bar_empty_left_round.bmp create mode 100644 res/images/progress_bar_empty_left_round.png delete mode 100644 res/images/progress_bar_empty_right_round.bmp create mode 100644 res/images/progress_bar_empty_right_round.png delete mode 100644 res/images/progress_bar_fill.bmp create mode 100644 res/images/progress_bar_fill.png delete mode 100644 res/images/progress_bar_left_round.bmp create mode 100644 res/images/progress_bar_left_round.png delete mode 100644 res/images/progress_bar_right_round.bmp create mode 100644 res/images/progress_bar_right_round.png diff --git a/Android.mk b/Android.mk index 816d143cc..6198ab338 100644 --- a/Android.mk +++ b/Android.mk @@ -30,7 +30,7 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_MODULE_TAGS := eng LOCAL_STATIC_LIBRARIES := libminzip libunz libamend libmtdutils libmincrypt -LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libcutils +LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils LOCAL_STATIC_LIBRARIES += libstdc++ libc # Specify a C-includable file containing the OTA public keys. diff --git a/minui/resources.c b/minui/resources.c index 5beb6a6d9..7ecfeefce 100644 --- a/minui/resources.c +++ b/minui/resources.c @@ -29,97 +29,84 @@ #include +#include + #include "minui.h" -// File signature for BMP files. -// The letters 'BM' as a little-endian unsigned short. - -#define BMP_SIGNATURE 0x4d42 - -typedef struct { - // constant, value should equal BMP_SIGNATURE - unsigned short bfType; - // size of the file in bytes. - unsigned long bfSize; - // must always be set to zero. - unsigned short bfReserved1; - // must always be set to zero. - unsigned short bfReserved2; - // offset from the beginning of the file to the bitmap data. - unsigned long bfOffBits; - - // The BITMAPINFOHEADER: - // size of the BITMAPINFOHEADER structure, in bytes. - unsigned long biSize; - // width of the image, in pixels. - unsigned long biWidth; - // height of the image, in pixels. - unsigned long biHeight; - // number of planes of the target device, must be set to 1. - unsigned short biPlanes; - // number of bits per pixel. - unsigned short biBitCount; - // type of compression, zero means no compression. - unsigned long biCompression; - // size of the image data, in bytes. If there is no compression, - // it is valid to set this member to zero. - unsigned long biSizeImage; - // horizontal pixels per meter on the designated targer device, - // usually set to zero. - unsigned long biXPelsPerMeter; - // vertical pixels per meter on the designated targer device, - // usually set to zero. - unsigned long biYPelsPerMeter; - // number of colors used in the bitmap, if set to zero the - // number of colors is calculated using the biBitCount member. - unsigned long biClrUsed; - // number of color that are 'important' for the bitmap, - // if set to zero, all colors are important. - unsigned long biClrImportant; -} __attribute__((packed)) BitMapFileHeader; +// 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 +// a dummy implementation to satisfy the linker. +double pow(double x, double y) { + return x; +} int res_create_surface(const char* name, gr_surface* pSurface) { char resPath[256]; - BitMapFileHeader header; GGLSurface* surface = NULL; int result = 0; - - snprintf(resPath, sizeof(resPath)-1, "/res/images/%s.bmp", name); + unsigned char header[8]; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + + snprintf(resPath, sizeof(resPath)-1, "/res/images/%s.png", name); resPath[sizeof(resPath)-1] = '\0'; - int fd = open(resPath, O_RDONLY); - if (fd == -1) { + FILE* fp = fopen(resPath, "rb"); + if (fp == NULL) { result = -1; goto exit; } - size_t bytesRead = read(fd, &header, sizeof(header)); + + size_t bytesRead = fread(header, 1, sizeof(header), fp); if (bytesRead != sizeof(header)) { result = -2; goto exit; } - if (header.bfType != BMP_SIGNATURE) { - result = -3; // Not a legal header + + if (png_sig_cmp(header, 0, sizeof(header))) { + result = -3; goto exit; } - if (header.biPlanes != 1) { + + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png_ptr) { result = -4; goto exit; } - if (!(header.biBitCount == 24 || header.biBitCount == 32)) { + + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) { result = -5; goto exit; } - if (header.biCompression != 0) { + + if (setjmp(png_jmpbuf(png_ptr))) { result = -6; goto exit; } - size_t width = header.biWidth; - size_t height = header.biHeight; + + 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; size_t pixelSize = stride * height; - + + int color_type = info_ptr->color_type; + int bit_depth = info_ptr->bit_depth; + int channels = info_ptr->channels; + if (bit_depth != 8 || (channels != 3 && channels != 4) || + (color_type != PNG_COLOR_TYPE_RGB && + color_type != PNG_COLOR_TYPE_RGBA)) { + return -7; + goto exit; + } + surface = malloc(sizeof(GGLSurface) + pixelSize); if (surface == NULL) { - result = -7; + result = -8; goto exit; } unsigned char* pData = (unsigned char*) (surface + 1); @@ -128,63 +115,43 @@ int res_create_surface(const char* name, gr_surface* pSurface) { surface->height = height; surface->stride = width; /* Yes, pixels, not bytes */ surface->data = pData; - surface->format = (header.biBitCount == 24) ? + surface->format = (channels == 3) ? GGL_PIXEL_FORMAT_RGBX_8888 : GGL_PIXEL_FORMAT_RGBA_8888; - // Source pixel bytes are stored B G R {A} - - lseek(fd, header.bfOffBits, SEEK_SET); - size_t y; - if (header.biBitCount == 24) { // RGB - size_t inputStride = (((3 * width + 3) >> 2) << 2); - for (y = 0; y < height; y++) { - unsigned char* pRow = pData + (height - (y + 1)) * stride; - bytesRead = read(fd, pRow, inputStride); - if (bytesRead != inputStride) { - result = -8; - goto exit; - } + int y; + if (channels == 3) { + for (y = 0; y < height; ++y) { + unsigned char* pRow = pData + y * stride; + png_read_row(png_ptr, pRow, NULL); + int x; for(x = width - 1; x >= 0; x--) { int sx = x * 3; int dx = x * 4; - unsigned char b = pRow[sx]; + unsigned char r = pRow[sx]; unsigned char g = pRow[sx + 1]; - unsigned char r = pRow[sx + 2]; + unsigned char b = pRow[sx + 2]; unsigned char a = 0xff; pRow[dx ] = r; // r pRow[dx + 1] = g; // g - pRow[dx + 2] = b; // b; + pRow[dx + 2] = b; // b pRow[dx + 3] = a; } } - } else { // RGBA - for (y = 0; y < height; y++) { - unsigned char* pRow = pData + (height - (y + 1)) * stride; - bytesRead = read(fd, pRow, stride); - if (bytesRead != stride) { - result = -9; - goto exit; - } - size_t x; - for(x = 0; x < width; x++) { - size_t xx = x * 4; - unsigned char b = pRow[xx]; - unsigned char g = pRow[xx + 1]; - unsigned char r = pRow[xx + 2]; - unsigned char a = pRow[xx + 3]; - pRow[xx ] = r; - pRow[xx + 1] = g; - pRow[xx + 2] = b; - pRow[xx + 3] = a; - } + } else { + for (y = 0; y < height; ++y) { + unsigned char* pRow = pData + y * stride; + png_read_row(png_ptr, pRow, NULL); } } + *pSurface = (gr_surface) surface; exit: - if (fd >= 0) { - close(fd); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + + if (fp != NULL) { + fclose(fp); } if (result < 0) { if (surface) { diff --git a/res/images/icon_error.bmp b/res/images/icon_error.bmp deleted file mode 100644 index 7eb2bbc77..000000000 Binary files a/res/images/icon_error.bmp and /dev/null differ diff --git a/res/images/icon_error.png b/res/images/icon_error.png new file mode 100644 index 000000000..7064c2e23 Binary files /dev/null and b/res/images/icon_error.png differ diff --git a/res/images/icon_firmware_error.bmp b/res/images/icon_firmware_error.bmp deleted file mode 100644 index 5b8649f17..000000000 Binary files a/res/images/icon_firmware_error.bmp and /dev/null differ diff --git a/res/images/icon_firmware_error.png b/res/images/icon_firmware_error.png new file mode 100644 index 000000000..0c32c9ede Binary files /dev/null and b/res/images/icon_firmware_error.png differ diff --git a/res/images/icon_firmware_install.bmp b/res/images/icon_firmware_install.bmp deleted file mode 100644 index b0f5f959b..000000000 Binary files a/res/images/icon_firmware_install.bmp and /dev/null differ diff --git a/res/images/icon_firmware_install.png b/res/images/icon_firmware_install.png new file mode 100644 index 000000000..ee2afac5d Binary files /dev/null and b/res/images/icon_firmware_install.png differ diff --git a/res/images/icon_installing.bmp b/res/images/icon_installing.bmp deleted file mode 100644 index fff99fd7e..000000000 Binary files a/res/images/icon_installing.bmp and /dev/null differ diff --git a/res/images/icon_installing.png b/res/images/icon_installing.png new file mode 100644 index 000000000..f24f2e33f Binary files /dev/null and b/res/images/icon_installing.png differ diff --git a/res/images/icon_unpacking.bmp b/res/images/icon_unpacking.bmp deleted file mode 100644 index ab6548c58..000000000 Binary files a/res/images/icon_unpacking.bmp and /dev/null differ diff --git a/res/images/icon_unpacking.png b/res/images/icon_unpacking.png new file mode 100644 index 000000000..9198e2eb1 Binary files /dev/null and b/res/images/icon_unpacking.png differ diff --git a/res/images/indeterminate1.bmp b/res/images/indeterminate1.bmp deleted file mode 100644 index 716c92568..000000000 Binary files a/res/images/indeterminate1.bmp and /dev/null differ diff --git a/res/images/indeterminate1.png b/res/images/indeterminate1.png new file mode 100644 index 000000000..264bf27e5 Binary files /dev/null and b/res/images/indeterminate1.png differ diff --git a/res/images/indeterminate2.bmp b/res/images/indeterminate2.bmp deleted file mode 100644 index 223cd3c1e..000000000 Binary files a/res/images/indeterminate2.bmp and /dev/null differ diff --git a/res/images/indeterminate2.png b/res/images/indeterminate2.png new file mode 100644 index 000000000..c30c049ab Binary files /dev/null and b/res/images/indeterminate2.png differ diff --git a/res/images/indeterminate3.bmp b/res/images/indeterminate3.bmp deleted file mode 100644 index fd9086a1f..000000000 Binary files a/res/images/indeterminate3.bmp and /dev/null differ diff --git a/res/images/indeterminate3.png b/res/images/indeterminate3.png new file mode 100644 index 000000000..891a00095 Binary files /dev/null and b/res/images/indeterminate3.png differ diff --git a/res/images/indeterminate4.bmp b/res/images/indeterminate4.bmp deleted file mode 100644 index 87b264034..000000000 Binary files a/res/images/indeterminate4.bmp and /dev/null differ diff --git a/res/images/indeterminate4.png b/res/images/indeterminate4.png new file mode 100644 index 000000000..7a6415149 Binary files /dev/null and b/res/images/indeterminate4.png differ diff --git a/res/images/indeterminate5.bmp b/res/images/indeterminate5.bmp deleted file mode 100644 index e16efb04c..000000000 Binary files a/res/images/indeterminate5.bmp and /dev/null differ diff --git a/res/images/indeterminate5.png b/res/images/indeterminate5.png new file mode 100644 index 000000000..cd6ab20a7 Binary files /dev/null and b/res/images/indeterminate5.png differ diff --git a/res/images/indeterminate6.bmp b/res/images/indeterminate6.bmp deleted file mode 100644 index 085ad951a..000000000 Binary files a/res/images/indeterminate6.bmp and /dev/null differ diff --git a/res/images/indeterminate6.png b/res/images/indeterminate6.png new file mode 100644 index 000000000..ddd9e7384 Binary files /dev/null and b/res/images/indeterminate6.png differ diff --git a/res/images/progress_bar_empty.bmp b/res/images/progress_bar_empty.bmp deleted file mode 100644 index 8e512fd92..000000000 Binary files a/res/images/progress_bar_empty.bmp and /dev/null differ diff --git a/res/images/progress_bar_empty.png b/res/images/progress_bar_empty.png new file mode 100644 index 000000000..9013f04ac Binary files /dev/null and b/res/images/progress_bar_empty.png differ diff --git a/res/images/progress_bar_empty_left_round.bmp b/res/images/progress_bar_empty_left_round.bmp deleted file mode 100644 index c4e2f44fc..000000000 Binary files a/res/images/progress_bar_empty_left_round.bmp and /dev/null differ diff --git a/res/images/progress_bar_empty_left_round.png b/res/images/progress_bar_empty_left_round.png new file mode 100644 index 000000000..dae7d5d13 Binary files /dev/null and b/res/images/progress_bar_empty_left_round.png differ diff --git a/res/images/progress_bar_empty_right_round.bmp b/res/images/progress_bar_empty_right_round.bmp deleted file mode 100644 index 1906f6209..000000000 Binary files a/res/images/progress_bar_empty_right_round.bmp and /dev/null differ diff --git a/res/images/progress_bar_empty_right_round.png b/res/images/progress_bar_empty_right_round.png new file mode 100644 index 000000000..542708823 Binary files /dev/null and b/res/images/progress_bar_empty_right_round.png differ diff --git a/res/images/progress_bar_fill.bmp b/res/images/progress_bar_fill.bmp deleted file mode 100644 index 8d57d8117..000000000 Binary files a/res/images/progress_bar_fill.bmp and /dev/null differ diff --git a/res/images/progress_bar_fill.png b/res/images/progress_bar_fill.png new file mode 100644 index 000000000..37c04b4f4 Binary files /dev/null and b/res/images/progress_bar_fill.png differ diff --git a/res/images/progress_bar_left_round.bmp b/res/images/progress_bar_left_round.bmp deleted file mode 100644 index 6d2df8d6a..000000000 Binary files a/res/images/progress_bar_left_round.bmp and /dev/null differ diff --git a/res/images/progress_bar_left_round.png b/res/images/progress_bar_left_round.png new file mode 100644 index 000000000..e72af47d4 Binary files /dev/null and b/res/images/progress_bar_left_round.png differ diff --git a/res/images/progress_bar_right_round.bmp b/res/images/progress_bar_right_round.bmp deleted file mode 100644 index 68bb6fe37..000000000 Binary files a/res/images/progress_bar_right_round.bmp and /dev/null differ diff --git a/res/images/progress_bar_right_round.png b/res/images/progress_bar_right_round.png new file mode 100644 index 000000000..d04c980b9 Binary files /dev/null and b/res/images/progress_bar_right_round.png differ -- cgit v1.2.3 From 1066d2c31990e3c2eacedbe0a70013da774fcf3e Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Wed, 1 Apr 2009 13:57:40 -0700 Subject: AI 144070: Add an option to wipe cache (only) to the recovery menu. Automated import of CL 144070 --- recovery.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/recovery.c b/recovery.c index 221ee2975..a0bae97ca 100644 --- a/recovery.c +++ b/recovery.c @@ -302,9 +302,11 @@ prompt_and_wait() #define ITEM_REBOOT 0 #define ITEM_APPLY_SDCARD 1 #define ITEM_WIPE_DATA 2 +#define ITEM_WIPE_CACHE 3 char* items[] = { "reboot system now [Home+Back]", "apply sdcard:update.zip [Alt+S]", "wipe data/factory reset [Alt+W]", + "wipe cache partition", NULL }; ui_start_menu(headers, items); @@ -357,6 +359,13 @@ prompt_and_wait() if (!ui_text_visible()) return; break; + case ITEM_WIPE_CACHE: + ui_print("\n-- Wiping cache...\n"); + erase_root("CACHE:"); + ui_print("Cache wipe complete.\n"); + if (!ui_text_visible()) return; + break; + case ITEM_APPLY_SDCARD: ui_print("\n-- Install from sdcard...\n"); int status = install_package(SDCARD_PACKAGE_FILE); -- cgit v1.2.3 From 49283858fb6565a5da0c5987e614f60254e61804 Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Wed, 1 Apr 2009 14:39:15 -0700 Subject: AI 144082: Remove the unused "unpacking" recovery icon. Automated import of CL 144082 --- common.h | 1 - res/images/icon_unpacking.png | Bin 7180 -> 0 bytes ui.c | 1 - 3 files changed, 2 deletions(-) delete mode 100644 res/images/icon_unpacking.png diff --git a/common.h b/common.h index e17f76a46..98ce86894 100644 --- a/common.h +++ b/common.h @@ -47,7 +47,6 @@ void ui_end_menu(); // Set the icon (normally the only thing visible besides the progress bar). enum { BACKGROUND_ICON_NONE, - BACKGROUND_ICON_UNPACKING, BACKGROUND_ICON_INSTALLING, BACKGROUND_ICON_ERROR, BACKGROUND_ICON_FIRMWARE_INSTALLING, diff --git a/res/images/icon_unpacking.png b/res/images/icon_unpacking.png deleted file mode 100644 index 9198e2eb1..000000000 Binary files a/res/images/icon_unpacking.png and /dev/null differ diff --git a/ui.c b/ui.c index 5d06561c5..b84f1722f 100644 --- a/ui.c +++ b/ui.c @@ -46,7 +46,6 @@ static gr_surface gProgressBarEmpty[NUM_SIDES]; static gr_surface gProgressBarFill[NUM_SIDES]; static const struct { gr_surface* surface; const char *name; } BITMAPS[] = { - { &gBackgroundIcon[BACKGROUND_ICON_UNPACKING], "icon_unpacking" }, { &gBackgroundIcon[BACKGROUND_ICON_INSTALLING], "icon_installing" }, { &gBackgroundIcon[BACKGROUND_ICON_ERROR], "icon_error" }, { &gBackgroundIcon[BACKGROUND_ICON_FIRMWARE_INSTALLING], -- cgit v1.2.3 From d1b19b9c98ac97db5c933d72dac5dca054a28353 Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Wed, 1 Apr 2009 15:48:46 -0700 Subject: AI 144130: Don't build OTA package keys into the recovery binary; read them from an external file in the recovery image. Use the test-keys for all builds. Automated import of CL 144130 --- Android.mk | 13 --------- install.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 88 insertions(+), 21 deletions(-) diff --git a/Android.mk b/Android.mk index 6198ab338..8c1de7366 100644 --- a/Android.mk +++ b/Android.mk @@ -33,21 +33,8 @@ LOCAL_STATIC_LIBRARIES := libminzip libunz libamend libmtdutils libmincrypt LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils LOCAL_STATIC_LIBRARIES += libstdc++ libc -# Specify a C-includable file containing the OTA public keys. -# This is built in config/Makefile. -# *** THIS IS A TOTAL HACK; EXECUTABLES MUST NOT CHANGE BETWEEN DIFFERENT -# PRODUCTS/BUILD TYPES. *** -# TODO: make recovery read the keys from an external file. -RECOVERY_INSTALL_OTA_KEYS_INC := \ - $(call intermediates-dir-for,PACKAGING,ota_keys_inc)/keys.inc -# Let install.c say #include "keys.inc" -LOCAL_C_INCLUDES += $(dir $(RECOVERY_INSTALL_OTA_KEYS_INC)) - include $(BUILD_EXECUTABLE) -# Depend on the generated keys.inc containing the OTA public keys. -$(intermediates)/install.o: $(RECOVERY_INSTALL_OTA_KEYS_INC) - include $(commands_recovery_local_path)/minui/Android.mk endif # TARGET_ARCH == arm diff --git a/install.c b/install.c index 069112080..4dcfe7536 100644 --- a/install.c +++ b/install.c @@ -31,12 +31,8 @@ #include "roots.h" #include "verifier.h" -/* List of public keys */ -static const RSAPublicKey keys[] = { -#include "keys.inc" -}; - #define ASSUMED_UPDATE_SCRIPT_NAME "META-INF/com/google/android/update-script" +#define PUBLIC_KEYS_FILE "/res/keys" static const ZipEntry * find_update_script(ZipArchive *zip) @@ -114,7 +110,8 @@ handle_update_script(ZipArchive *zip, const ZipEntry *update_script_entry) } static int -handle_update_package(const char *path, ZipArchive *zip) +handle_update_package(const char *path, ZipArchive *zip, + const RSAPublicKey *keys, int numKeys) { // Give verification half the progress bar... ui_print("Verifying update package...\n"); @@ -122,7 +119,7 @@ handle_update_package(const char *path, ZipArchive *zip) VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME); - if (!verify_jar_signature(zip, keys, sizeof(keys) / sizeof(keys[0]))) { + if (!verify_jar_signature(zip, keys, numKeys)) { LOGE("Verification failed\n"); return INSTALL_CORRUPT; } @@ -147,6 +144,80 @@ handle_update_package(const char *path, ZipArchive *zip) return ret; } +// Reads a file containing one or more public keys as produced by +// DumpPublicKey: this is an RSAPublicKey struct as it would appear +// as a C source literal, eg: +// +// "{64,0xc926ad21,{1795090719,...,-695002876},{-857949815,...,1175080310}}" +// +// (Note that the braces and commas in this example are actual +// characters the parser expects to find in the file; the ellipses +// indicate more numbers omitted from this example.) +// +// The file may contain multiple keys in this format, separated by +// commas. The last key must not be followed by a comma. +// +// Returns NULL if the file failed to parse, or if it contain zero keys. +static RSAPublicKey* +load_keys(const char* filename, int* numKeys) { + RSAPublicKey* out = NULL; + *numKeys = 0; + + FILE* f = fopen(filename, "r"); + if (f == NULL) { + LOGE("opening %s: %s\n", filename, strerror(errno)); + goto exit; + } + + int i; + bool done = false; + while (!done) { + ++*numKeys; + out = realloc(out, *numKeys * sizeof(RSAPublicKey)); + RSAPublicKey* key = out + (*numKeys - 1); + if (fscanf(f, " { %i , %i , { %i", + &(key->len), &(key->n0inv), &(key->n[0])) != 3) { + goto exit; + } + if (key->len != RSANUMWORDS) { + LOGE("key length (%d) does not match expected size\n", key->len); + goto exit; + } + for (i = 1; i < key->len; ++i) { + if (fscanf(f, " , %i", &(key->n[i])) != 1) goto exit; + } + if (fscanf(f, " } , { %i", &(key->rr[0])) != 1) goto exit; + for (i = 1; i < key->len; ++i) { + if (fscanf(f, " , %i", &(key->rr[i])) != 1) goto exit; + } + fscanf(f, " } } "); + + // if the line ends in a comma, this file has more keys. + switch (fgetc(f)) { + case ',': + // more keys to come. + break; + + case EOF: + done = true; + break; + + default: + LOGE("unexpected character between keys\n"); + goto exit; + } + } + + fclose(f); + return out; + +exit: + if (f) fclose(f); + free(out); + *numKeys = 0; + return NULL; +} + int install_package(const char *root_path) { @@ -169,6 +240,14 @@ install_package(const char *root_path) ui_print("Opening update package...\n"); LOGI("Update file path: %s\n", path); + int numKeys; + RSAPublicKey* loadedKeys = load_keys(PUBLIC_KEYS_FILE, &numKeys); + if (loadedKeys == NULL) { + LOGE("Failed to load keys\n"); + return INSTALL_CORRUPT; + } + LOGI("%d key(s) loaded from %s\n", numKeys, PUBLIC_KEYS_FILE); + /* Try to open the package. */ ZipArchive zip; @@ -180,7 +259,8 @@ install_package(const char *root_path) /* Verify and install the contents of the package. */ - int status = handle_update_package(path, &zip); + int status = handle_update_package(path, &zip, loadedKeys, numKeys); mzCloseZipArchive(&zip); + free(loadedKeys); return status; } -- cgit v1.2.3