Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

change the default recovery assets to be in holograph style

Also remove the weird backwards compatibility thing for animations
with fewer than 10 frames.  Frames are always named "name01.png",
"name02.png", ..., no matter how many there are.

Change-Id: I7af64fdec1bfcdb0464998b735ec8d6c626ffe9d
  • Loading branch information...
commit be6d4d10529860037c165e4441a2d23f539e7b00 1 parent 6809c51
Doug Zongker authored
102 make-overlay.py
... ... @@ -0,0 +1,102 @@
  1 +# Copyright (C) 2011 The Android Open Source Project
  2 +#
  3 +# Licensed under the Apache License, Version 2.0 (the "License");
  4 +# you may not use this file except in compliance with the License.
  5 +# You may obtain a copy of the License at
  6 +#
  7 +# http://www.apache.org/licenses/LICENSE-2.0
  8 +#
  9 +# Unless required by applicable law or agreed to in writing, software
  10 +# distributed under the License is distributed on an "AS IS" BASIS,
  11 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 +# See the License for the specific language governing permissions and
  13 +# limitations under the License.
  14 +
  15 +"""Script to take a set of frames (PNG files) for a recovery
  16 +"installing" icon animation and turn it into a base image plus a set
  17 +of overlays, as needed by the recovery UI code. Run with the names of
  18 +all the input frames on the command line, in order."""
  19 +
  20 +import sys
  21 +try:
  22 + import Image
  23 +except ImportError:
  24 + print "This script requires the Python Imaging Library to be installed."
  25 + sys.exit(1)
  26 +
  27 +# Find the smallest box that contains all the pixels which change
  28 +# between images.
  29 +
  30 +print "reading", sys.argv[1]
  31 +base = Image.open(sys.argv[1])
  32 +
  33 +minmini = base.size[0]-1
  34 +maxmaxi = 0
  35 +minminj = base.size[1]-1
  36 +maxmaxj = 0
  37 +
  38 +for top_name in sys.argv[2:]:
  39 + print "reading", top_name
  40 + top = Image.open(top_name)
  41 +
  42 + assert base.size == top.size
  43 +
  44 + mini = base.size[0]-1
  45 + maxi = 0
  46 + minj = base.size[1]-1
  47 + maxj = 0
  48 +
  49 + h, w = base.size
  50 + for j in range(w):
  51 + for i in range(h):
  52 + b = base.getpixel((i,j))
  53 + t = top.getpixel((i,j))
  54 + if b != t:
  55 + if i < mini: mini = i
  56 + if i > maxi: maxi = i
  57 + if j < minj: minj = j
  58 + if j > maxj: maxj = j
  59 +
  60 + minmini = min(minmini, mini)
  61 + maxmaxi = max(maxmaxi, maxi)
  62 + minminj = min(minminj, minj)
  63 + maxmaxj = max(maxmaxj, maxj)
  64 +
  65 +w = maxmaxi - minmini + 1
  66 +h = maxmaxj - minminj + 1
  67 +
  68 +# Now write out an image containing just that box, for each frame.
  69 +
  70 +for num, top_name in enumerate(sys.argv[1:]):
  71 + top = Image.open(top_name)
  72 +
  73 + out = Image.new("RGB", (w, h))
  74 + for i in range(w):
  75 + for j in range(h):
  76 + t = top.getpixel((i+minmini, j+minminj))
  77 + out.putpixel((i, j), t)
  78 +
  79 + fn = "icon_installing_overlay%02d.png" % (num+1,)
  80 + out.save(fn)
  81 + print "saved", fn
  82 +
  83 +# Write out the base icon, which is the first frame with that box
  84 +# blacked out (just to make the file smaller, since it's always
  85 +# displayed with one of the overlays on top of it).
  86 +
  87 +for i in range(w):
  88 + for j in range(h):
  89 + base.putpixel((i+minmini, j+minminj), (0, 0, 0))
  90 +fn = "icon_installing.png"
  91 +base.save(fn)
  92 +print "saved", fn
  93 +
  94 +# The device_ui_init() function needs to tell the recovery UI the
  95 +# position of the overlay box.
  96 +
  97 +print
  98 +print "add this to your device_ui_init() function:"
  99 +print "-" * 40
  100 +print " ui_parameters->install_overlay_offset_x = %d;" % (minmini,)
  101 +print " ui_parameters->install_overlay_offset_y = %d;" % (minminj,)
  102 +print "-" * 40
BIN  res/images/icon_error.png 100755 → 100644
BIN  res/images/icon_installing.png 100755 → 100644
BIN  res/images/icon_installing_overlay01.png
BIN  res/images/icon_installing_overlay02.png
BIN  res/images/icon_installing_overlay03.png
BIN  res/images/icon_installing_overlay04.png
BIN  res/images/icon_installing_overlay05.png
BIN  res/images/icon_installing_overlay06.png
BIN  res/images/icon_installing_overlay07.png
BIN  res/images/indeterminate01.png
BIN  res/images/indeterminate02.png
BIN  res/images/indeterminate03.png
BIN  res/images/indeterminate04.png
BIN  res/images/indeterminate05.png
BIN  res/images/indeterminate06.png
BIN  res/images/indeterminate1.png
BIN  res/images/indeterminate2.png
BIN  res/images/indeterminate3.png
BIN  res/images/indeterminate4.png
BIN  res/images/indeterminate5.png
BIN  res/images/indeterminate6.png
BIN  res/images/progress_empty.png
BIN  res/images/progress_fill.png
20 ui.c
@@ -39,10 +39,10 @@
39 39 #define UI_WAIT_KEY_TIMEOUT_SEC 120
40 40
41 41 UIParameters ui_parameters = {
42   - 6, // indeterminate progress bar frames
43   - 15, // fps
44   - 0, // installation icon frames (0 == static image)
45   - 0, 0, // installation icon overlay offset
  42 + 6, // indeterminate progress bar frames
  43 + 20, // fps
  44 + 7, // installation icon frames (0 == static image)
  45 + 23, 83, // installation icon overlay offset
46 46 };
47 47
48 48 static pthread_mutex_t gUpdateMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -386,10 +386,8 @@ void ui_init(void)
386 386 sizeof(gr_surface));
387 387 for (i = 0; i < ui_parameters.indeterminate_frames; ++i) {
388 388 char filename[40];
389   - // "indeterminateN" if fewer than 10 frames, else "indeterminateNN".
390   - sprintf(filename, "indeterminate%0*d",
391   - ui_parameters.indeterminate_frames < 10 ? 1 : 2,
392   - i+1);
  389 + // "indeterminate01.png", "indeterminate02.png", ...
  390 + sprintf(filename, "indeterminate%02d", i+1);
393 391 int result = res_create_surface(filename, gProgressBarIndeterminate+i);
394 392 if (result < 0) {
395 393 LOGE("Missing bitmap %s\n(Code %d)\n", filename, result);
@@ -401,9 +399,9 @@ void ui_init(void)
401 399 sizeof(gr_surface));
402 400 for (i = 0; i < ui_parameters.installing_frames; ++i) {
403 401 char filename[40];
404   - sprintf(filename, "icon_installing_overlay%0*d",
405   - ui_parameters.installing_frames < 10 ? 1 : 2,
406   - i+1);
  402 + // "icon_installing_overlay01.png",
  403 + // "icon_installing_overlay02.png", ...
  404 + sprintf(filename, "icon_installing_overlay%02d", i+1);
407 405 int result = res_create_surface(filename, gInstallationOverlay+i);
408 406 if (result < 0) {
409 407 LOGE("Missing bitmap %s\n(Code %d)\n", filename, result);

0 comments on commit be6d4d1

Please sign in to comment.
Something went wrong with that request. Please try again.