Commit graph

343 commits

Author SHA1 Message Date
Doug Zongker
a418aa7dd5 refactor image resource loading code in minui
Reduce the number of copies of libpng boilerplate.  Rename
res_create_* functions to be more clear.  Make explicit the use of the
framebuffer pixel format for images, and handle more combinations of
input and output (eg, loading a grayscale image for display rather
than use as a text alpha channel).

Change-Id: I3d41c800a8f4c22b2f0167967ce6ee4d6b2b8846
2014-03-17 12:27:08 -07:00
Mark Salyzyn
679baa06b7 am 4b6de1ba: am 026ebe02: Merge "Recovery 64-bit compile issues"
* commit '4b6de1ba1ce0fff95c18a8abb7ba6e5762006d49':
  Recovery 64-bit compile issues
2014-03-14 21:35:41 +00:00
Mark Salyzyn
4b6de1ba1c am 026ebe02: Merge "Recovery 64-bit compile issues"
* commit '026ebe0214d6c1c9b3ddc22c35e9ac37e5f622bc':
  Recovery 64-bit compile issues
2014-03-14 20:59:56 +00:00
Mark Salyzyn
f3bb31c32f Recovery 64-bit compile issues
Change-Id: I92d5abd1a628feab3b0246924fab7f97ba3b9d34
2014-03-14 13:51:39 -07:00
Doug Zongker
0d32f259cd clean up some warnings when building recovery
Change-Id: I1541534ee6978ddf8d548433986679ce9507d508
2014-02-13 15:34:18 -08:00
Doug Zongker
19a8e2463c log extra info for debugging
Make recovery log its PID, and when we use a block map file, log how
many ranges it contains.

Change-Id: I1b4299f8163af68a770b48c029ae25e6cb45d26b
2014-01-21 09:25:41 -08:00
Doug Zongker
c87bab1018 add the functions for multi-stage packages to updater
In order to support multi-stage recovery packages, we add the
set_stage() and get_stage() functions, which store a short string
somewhere it can be accessed across invocations of recovery.  We also
add reboot_now() which updater can invoke to immediately reboot the
device, without doing normal recovery cleanup.  (It can also choose
whether to boot off the boot or recovery partition.)

If the stage string is of the form "#/#", recovery's UI will be
augmented with a simple indicator of what stage you're in, so it
doesn't look like a reboot loop.

Change-Id: I62f7ff0bc802b549c9bcf3cc154a6bad99f94603
2013-11-26 15:46:57 -08:00
Doug Zongker
3b5a987cd7 recovery: fix use of init reboot method
We need to set the system property to "reboot,", not an empty string.

Bug: 10605007
Change-Id: I776e0d273764cf254651ab2b25c2743395b990e0
2013-09-03 14:29:54 -07:00
Doug Zongker
77ea71d6a8 recovery: fix rebooting
Change I84c0513acb549720cb0e8c9fcbda0050f5c396f5 moved reboot
functionality into init but did not update the recovery partition; so
"adb reboot" and /system/bin/reboot in recovery are both broken.

Change-Id: Ie2d14627a686ffb5064256b6c399723636dff116
2013-08-30 12:20:16 -07:00
Doug Zongker
239ac6abac recovery: install packages in a known mount environment
When installing a package, we should have /tmp and /cache mounted and
nothing else.  Ensure this is true by explicitly mounting them and
unmounting everything else as the first step of every install.

Also fix an error in the progress bar that crops up when you do
multiple package installs in one instance of recovery.

Change-Id: I4837ed707cb419ddd3d9f6188b6355ba1bcfe2b2
2013-08-21 13:44:35 -07:00
Doug Zongker
c0441d1719 notify about pending long press
Recovery changes:

- add a method to the UI class that is called when a key is held down
  long enough to be a "long press" (but before it is released).
  Device-specific subclasses can override this to indicate a long
  press.

- do color selection for ScreenRecoveryUI's menu-and-log drawing
  function.  Subclasses can override this to customize the colors they
  use for various elements.

- Include the value of ro.build.display.id in the menu headers, so you
  can see on the screen what version of recovery you are running.

Change-Id: I426a6daf892b9011638e2035aebfa2831d4f596d
2013-07-31 11:35:12 -07:00
Doug Zongker
a4ee1f8b76 Merge "recovery: preserve recovery logs across cache wipes" 2013-07-09 21:16:53 +00:00
Doug Zongker
6d0d7ac051 recovery: preserve recovery logs across cache wipes
When doing a cache wipe or a factory reset (which includes a cache
wipe), save any last* log files in the /cache/recovery directory and
write them back after reformatting the partition, so that wiping data
doesn't lose useful log information.

Change-Id: I1f52ae9131760b5e752e136645c19f71b7b166ee
2013-07-09 13:34:55 -07:00
Doug Zongker
fafc85b4ad recovery: move log output to stdout
Recovery currently has a random mix of messages printed to stdout and
messages printed to stderr, which can make logs hard to read.  Move
everything to stdout.

Change-Id: Ie33bd4a9e1272e731302569cdec918e0534c48a6
2013-07-09 12:50:24 -07:00
Doug Zongker
f24fd7e847 recovery: copy logs to cache more aggressively
Copy logs to /cache immediately upon a package installation failure;
don't wait for recovery to finish.  (If the user reboots without
exiting recovery the "right" way, the logs never get copied at all.)

Change-Id: Iee342944e7ded63da5a4af33d11ebc876f6c0835
2013-07-02 11:43:25 -07:00
Doug Zongker
8cd12112e4 am d51bfc9b: Merge "Fix the potential segmentation fault"
* commit 'd51bfc9b1fe89321af3c629e7b23a747050332e1':
  Fix the potential segmentation fault
2013-06-04 12:10:28 -07:00
Jin Feng
93ffa7579c Fix the potential segmentation fault
Extral newline can trigger recovery segmentation fault
Test case:
host$ adb shell 'echo -en "--update_package=ota_update.zip\n--show_text\n\n" > /cache/recovery/command'
host$ adb reboot recovery

Change-Id: If1781c1f5ad94a273f1cb122b67cedd9fb562433
Signed-off-by: Jin Feng <jin88.feng@gmail.com>
2013-06-04 17:46:24 +08:00
Doug Zongker
da1ebaef0a recovery: save logs from the last few invocations of recovery
Extends the last_log mechanism to save logs from the last six
invocations of recovery, so that we're more likely to have useful logs
even if the device has repeatedly booted into recovery.

Change-Id: I08ae7a09553ada45f9e0733fe1e55e5a22efd9f9
2013-05-21 11:19:15 -07:00
Doug Zongker
7c3ae45ef9 recovery: turn on text display for install errors in debug builds
Hopefully this will reduce the number of OTA "bugs" reported that are
really just someone having changed their system partition,
invalidating future incremental OTAs.

Also fixes a longstanding TODO about putting LOGE() output in the
on-screen display.

Change-Id: I44e5be65b2dee7ebce2cce28ccd920dc3d6e522e
2013-05-21 11:18:38 -07:00
Doug Zongker
6fd59ac07d more font improvements and cleanup
Get rid of the notion of a font's "ascent"; the reference point for
drawing is the top-left corner of the character box rather than the
baseline.  Add some more space between the menu entries and make the
highlight bar around the text.

Replace the default font.png with two images; the build system will
include one or the other based on the resolutions of the device.

Restore the original compiled-in bitmap font, to fall back on when
font.png can't be found (eg, in the charger binary).

Add support for bold text (when a font.png image is used).

Change-Id: I6d211a486a3636f20208502b1cd2aeae8b9f5b02
2013-03-07 13:34:24 -08:00
Kenny Root
cd74108cda resolved conflicts for merge of 78afed1c to jb-mr1-dev-plus-aosp
Change-Id: I861e3a6aa07c448909b2ae54618bba178bd6e457
2012-10-16 17:44:21 -07:00
Kenny Root
7eb7567aa3 Remove HAVE_SELINUX guards
Change-Id: Ia96201f20f7838d7d9e8926208977d3f8318ced4
2012-10-16 12:57:26 -07:00
Devin Kim
6016d08b0c recovery: fix failure to unmount "/cache"
At load_locale_from_cache() function, LOCALE_FILE must get closed
after it is opened and used. Otherwise it causes a failure to
unmount "/cache" after load_locale_from_cache() function is called.

Change-Id: I9cec0f29a8ec4452c8a6a52e2f3c8ce9930d5372
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-08 16:34:00 -07:00
Doug Zongker
6c8553dda8 display error state on OTA failure
We need prompt_with_wait() to show either the ERROR or NO_COMMAND
state as appropriate.

Bug: 7221068
Change-Id: I191526cf12630d08b7a8250a2a81e724a4a5d972
2012-09-24 10:40:47 -07:00
Doug Zongker
5fa8c23911 localization for recovery messages
Add images of text for all locales we support.  Make the progress bar
fill the correct way for RTL languages.  (Flip the direction the
spinner turns, too, just for good measure.)

Bug: 7064142
Change-Id: I5dddb26e02ee5275c57c4dc4a03c6d68432ac7ba
2012-09-18 12:37:02 -07:00
Doug Zongker
8b240ccca1 recovery locale handling fixes
- change locale filename to "last_locale" so the main system doesn't
  delete it

- clean up some chatty logging

- update images with real German (other languages TBD)

Change-Id: I2ebb4ed4e054bd1808a3042d9efbb2c18f3a044d
2012-08-29 15:19:29 -07:00
Doug Zongker
4f33e55d1c change recovery images to android with spinner
Also make writing the locale a bit more robust.

Change-Id: I803dd0aa0b9d6661fad74ea13fb085682402323c
2012-08-23 13:19:02 -07:00
Doug Zongker
02ec6b88ed add simple text to recovery UI
- recovery takes a --locale argument, which will be passed by the main
  system

- the locale is saved in cache, in case the --locale argument is
  missing (eg, when recovery is started from fastboot)

- we include images that have prerendered text for many locales

- we split the background states into four (installing update,
  erasing, no command, error) so that appropriate text can be shown.

Change-Id: I731b8108e83d5ccc09a4aacfc1dbf7e86b397aaf
2012-08-22 17:26:40 -07:00
Doug Zongker
f69d40afa1 am e5d5ac76: minor recovery changes
* commit 'e5d5ac76cc8e5d11867aeff6a1d068215c1c3a7c':
  minor recovery changes
2012-04-12 12:55:53 -07:00
Doug Zongker
e5d5ac76cc minor recovery changes
- add the --just_exit option to make recovery exit normally without doing anything
- make it possible to build updater extensions in C++
- add the clear_display command so that the updater binary can request
  recovery switch to the NONE background UI

These are all used to support the notion of using OTA as a factory
reflash mechanism.

Change-Id: Ib00d1cbf540feff38f52a61a2cf198915b48488c
2012-04-12 11:01:22 -07:00
Kenny Root
038818cb63 Update merge for SELinux to compile
The contribution of SELinux things to AOSP had a call to the old
ui_print that merged cleanly. This changes that call into the newer
call so it will actually compile when enabled.

Change-Id: I8368e937219b01d0bef06007fa46302415256d07
2012-04-08 11:03:04 -07:00
Kenny Root
41dda82d84 resolved conflicts for merge of 0b1fee1b to master
Change-Id: I2e8298ff5988a96754f56f80a5186c9605ad9928
2012-03-30 21:26:01 -07:00
Doug Zongker
e83b7cf8f1 support "sideload over ADB" mode
Rather than depending on the existence of some place to store a file
that is accessible to users on an an unbootable device (eg, a physical
sdcard, external USB drive, etc.), add support for sideloading
packages sent to the device with adb.

This change adds a "minimal adbd" which supports nothing but receiving
a package over adb (with the "adb sideload" command) and storing it to
a fixed filename in the /tmp ramdisk, from where it can be verified
and sideloaded in the usual way.  This should be leave available even
on locked user-build devices.

The user can select "apply package from ADB" from the recovery menu,
which starts minimal-adb mode (shutting down any real adbd that may be
running).  Once minimal-adb has received a package it exits
(restarting real adbd if appropriate) and then verification and
installation of the received package proceeds.

always initialize usb product, vendor, etc. for adb in recovery

Set these values even on non-debuggable builds, so that the mini-adb
now in recovery can work.
2012-01-18 10:35:28 -08:00
Doug Zongker
9270a20a80 support "sideload over ADB" mode
Rather than depending on the existence of some place to store a file
that is accessible to users on an an unbootable device (eg, a physical
sdcard, external USB drive, etc.), add support for sideloading
packages sent to the device with adb.

This change adds a "minimal adbd" which supports nothing but receiving
a package over adb (with the "adb sideload" command) and storing it to
a fixed filename in the /tmp ramdisk, from where it can be verified
and sideloaded in the usual way.  This should be leave available even
on locked user-build devices.

The user can select "apply package from ADB" from the recovery menu,
which starts minimal-adb mode (shutting down any real adbd that may be
running).  Once minimal-adb has received a package it exits
(restarting real adbd if appropriate) and then verification and
installation of the received package proceeds.

Change-Id: I6fe13161ca064a98d06fa32104e1f432826582f5
2012-01-10 10:18:17 -08:00
Doug Zongker
d9428e3d3e mount cache before sideloading from external storage
Some packages expect to find cache mounted, since it always is for
"real" OTAs.

Bug: 5739915
Change-Id: I7a7cdd88a60c61e4bc7dc3e1f99956f6487c42e1
2011-12-13 16:03:28 -08:00
Doug Zongker
32a0a47a59 move key processing to RecoveryUI
Move the key for handling keys from ScreenRecoveryUI to RecoveryUI, so
it can be used by devices without screens.  Remove the UIParameters
struct and replace it with some new member variables in
ScreenRecoveryUI.

Change-Id: I70094ecbc4acbf76ce44d5b5ec2036c36bdc3414
2011-11-04 14:09:48 -07:00
Doug Zongker
a4e88e45de move key processing to RecoveryUI
Move the key for handling keys from ScreenRecoveryUI to RecoveryUI, so
it can be used by devices without screens.  Remove the UIParameters
struct and replace it with some new member variables in
ScreenRecoveryUI.

Change-Id: I4c0e659edcbedc0b9e86ed261ae4dbb3c6097414
2011-11-01 11:04:27 -07:00
Doug Zongker
daefc1d442 C++ class for device-specific code
Replace the device-specific functions with a class.  Move some of the
key handling (for log visibility toggling and rebooting) into the UI
class.  Fix up the key handling so there is less crosstalk between the
immediate keys and the queued keys (an increasing annoyance on
button-limited devices).

Change-Id: I698f6fd21c67a1e55429312a0484b6c393cad46f
2011-10-31 15:51:07 -07:00
Doug Zongker
211aebc4e0 refactor ui functions into a class
Move all the functions in ui.c to be members of a ScreenRecoveryUI
class, which is a subclass of an abstract RecoveryUI class.  Recovery
then creates a global singleton instance of this class and then invoke
the methods to drive the UI.  We use this to allow substitution of a
different RecoveryUI implementation for devices with radically
different form factors (eg, that don't have a screen).

Change-Id: I76bdd34eca506149f4cc07685df6a4890473f3d9
2011-10-31 14:15:02 -07:00
Doug Zongker
7d0542f280 C++ class for device-specific code
Replace the device-specific functions with a class.  Move some of the
key handling (for log visibility toggling and rebooting) into the UI
class.  Fix up the key handling so there is less crosstalk between the
immediate keys and the queued keys (an increasing annoyance on
button-limited devices).

Change-Id: I8bdea6505da7974631bf3d9ac3ee308f8c0f76e1
2011-10-31 13:50:32 -07:00
Doug Zongker
28ce47cfa6 turn recovery into a C++ binary
Change-Id: I423a23581048d451d53eef46e5f5eac485b77555
2011-10-31 10:24:09 -07:00
Doug Zongker
7440630caa refactor ui functions into a class
Move all the functions in ui.c to be members of a ScreenRecoveryUI
class, which is a subclass of an abstract RecoveryUI class.  Recovery
then creates a global singleton instance of this class and then invoke
the methods to drive the UI.  We use this to allow substitution of a
different RecoveryUI implementation for devices with radically
different form factors (eg, that don't have a screen).

Change-Id: I7fd8b2949d0db5a3f47c52978bca183966c86f33
2011-10-28 15:13:10 -07:00
Doug Zongker
10e418d3c8 turn recovery into a C++ binary
Change-Id: I68a67a4c8edec9a74463b3d4766005ce27b51316
2011-10-28 10:33:05 -07:00
Renamed from recovery.c (Browse further)