Commit graph

27 commits

Author SHA1 Message Date
Tao Bao
6278bdf349 recovery: Add screensaver mode.
While it's waiting for user input, dim or turn off the backlight to
avoid OLED burn-in. The backlight brightness will be reduced after the
first timeout (default 120s), and then turned off after the second.
Pressing any key will take it back to the normal brightness. While the
display is off, the first key input will only turn on the backlight.

The most common case that triggers the screensaver is under text mode,
such as waiting for menu selection or viewing recovery logs.

This CL doesn't change the brightness while it's installing updates or
performing wipes under UI mode.

When it encounters any install error under UI mode (user builds):
 - If it's NOT USB connected, it will reboot automatically after the
   first timeout (same as before);
 - If it's USB connected, it will dim and turn off the display per the
   change in this CL.

Bug: 34077703
Test: Boot a device with the new recovery image. Wait for timeout.

Change-Id: I0c14907e60340a7f037adb6e464942d099ada08b
2017-01-30 16:12:30 -08:00
Tao Bao
0b1118d6b9 minui: Move callback functions to std::function.
Also make minor clean up to the header includes.

Test: mmma bootable/recovery system/core/healthd system/extra/slideshow
Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
2017-01-23 16:59:56 +00:00
Tao Bao
736d59c567 recovery: Fix the broken UI text.
UI text is broken (doesn't show any text during FDR) due to commit
d530449e54, which reordered the calls to
RecoveryUI::SetLocale() and RecoveryUI::Init().

Because Init() uses the locale info to load the localized texts (from
images), the locale must be set prior to that via SetLocale(). This CL
refactors Init() to take the locale parameter, and removes the odd
SetLocale() API.

Bug: 34029338
Test: 'Run graphics test' under recovery.
Change-Id: I620394a3d4e3705e9af5a1f6299285d143ae1b01
2017-01-03 22:40:03 -08:00
Sen Jiang
d530449e54 Add a stub recovery UI.
This allows recovery to work on devices without screen.
The stub recovery UI does nothing except print to stdout.

Test: write 'recovery\n--wipe_data\n--reason=wipe_data_from_ota\n'
      to misc and boot to recovery on a device without screen.
Bug: 33175036

Change-Id: Icde698aa2e2e29f4b3d0532dfd3c6a939ac2bc63
2016-12-13 13:29:33 -08:00
Tianjie Xu
35926c4b89 Add ability to show "installing security update"
Add a new command "--security" to boot commands. If this command is
observed as part of BCB, choose a different background text picture
for installing stage in recovery UI. As a result, users will see
"installing security update" instead of "installing system update"
when applying a security update package.

Bug: 27837319
Change-Id: I2e2253a124993ecc24804fa1ee0b918ac96837c5
2016-04-29 12:19:43 -07:00
Tao Bao
b6918c7c43 Log update outputs in order
Although stdout and stderr are both redirected to log file with no
buffering, we are seeing some outputs are mixed in random order.
This is because ui_print commands from the updater are passed to the
recovery binary via a pipe, which may interleave with other outputs
that go to stderr directly.

In recovery, adding ui::PrintOnScreenOnly() function to handle
ui_print command, which skips printing to stdout. Meanwhile, updater
prints the contents to stderr in addition to piping them to recovery.

Change-Id: Idda93ea940d2e23a0276bb8ead4aa70a3cb97700
2015-06-02 22:15:40 -07:00
Elliott Hughes
985022a623 Remove unnecessary globals.
Change-Id: I76a042432aede08ceaf250319cf5eeb25d601150
2015-04-13 13:04:32 -07:00
Elliott Hughes
4af215b2c3 Auto-detect whether to use the long-press UI.
Change-Id: Ie77a5584e301467c6a5e164d2c62d6f036b2c0c0
2015-04-10 15:14:35 -07:00
Elliott Hughes
642aaa7a3e Fix ScreenRecoveryUI to handle devices without power/up/down.
Currently fugu has a custom subclass to handle this. The default code
supports devices with trackballs but not all shipping Nexus devices?
That's just silly.

Change-Id: Id2779c91284899a26b4bb1af41e7033aa889df10
2015-04-10 12:47:46 -07:00
Elliott Hughes
ec28340cf3 Move "Mount /system" to the main menu.
Everyone's adding secret key combinations for this anyway, and it's
very useful when debugging.

Change-Id: Iad549452b872a7af963dd649f283ebcd3ea24234
2015-04-10 10:01:53 -07:00
Elliott Hughes
8de52078a4 Move file paging into ScreenRecoveryUI.
This fixes the N9 performance problem.

Change-Id: I00c10d4162ff266a6243285e5a5e768217f6f799
2015-04-08 20:06:50 -07:00
Elliott Hughes
018ed31c51 Enable printf format argument checking.
The original attempt missed the fact that Print is a member function,
so the first argument is the implicit 'this'.

Change-Id: I963b668c5432804c767f0a2e3ef7dea5978a1218
2015-04-08 16:56:17 -07:00
Doug Zongker
c704e06ce5 disable async reboot during package installation
The default recovery UI will reboot the device when the power key is
pressed 7 times in a row, regardless of what recovery is doing.
Disable this feature during package installation, to minimize the
chance of corrupting the device due to a mid-install reboot.  (Debug
packages can explicitly request that the feature be reenabled.)

Change-Id: I20f3ec240ecd344615d452005ff26d8dd7775acf
2014-05-23 08:52:31 -07:00
Doug Zongker
a766c34f86 am d327c63a: am c87bab10: add the functions for multi-stage packages to updater
* commit 'd327c63af691a36fbf53866a3ae7ad27a43ebe3b':
  add the functions for multi-stage packages to updater
2013-12-02 23:30:51 +00: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
Todd Poynor
a5ef19fabd recovery: fix epoll events type to uint32_t
Change-Id: I5db9987102201c18821acb45d1f824e9865a1451
2013-09-17 21:58:52 +00:00
Todd Poynor
e7265df352 recovery: ui changes for ev_*() switch to epoll
Convert callback events parameter to unsigned int.

Change-Id: Ife0e983f307c07bf4aca807d70574aeb20c460cd
2013-09-12 12:42:33 -07:00
Doug Zongker
9e805d6ca0 allow CheckKey to request mounting /system
Also provide a default implementation of CheckKey that's reasonable
for many devices (those that have power and volume keys).

Change-Id: Icf6c7746ebd866152d402059dbd27fd16bd51ff8
2013-09-04 15:02:29 -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
bb01d0c12b add NextCheckKeyIsLong() and EnqueueKey() methods
NextCheckKeyIsLong() is called right before each call to CheckKey() to
tell the implementation if the key is a long-press or not.  (To be
used on devices with few buttons.)  It's done as a separate method
(rather than a parameter to CheckKey) to not break existing recovery
UI implementations.

EnqueueKey() can be called from CheckKey() to put arbitrary code codes
in the synchronous queue (to be processed by HandleMenuKey).

Change-Id: If8a83d66efe0bbc9e2dc178e5ebe12acd216324b
2012-12-17 10:52:58 -08: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
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
48b5b0737c allow recovery UI to ignore certain keypresses
Change-Id: Id182bb95ffcc475c5acabb29b413e422302ae7f2
2012-01-18 15:15:39 -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
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
28ce47cfa6 turn recovery into a C++ binary
Change-Id: I423a23581048d451d53eef46e5f5eac485b77555
2011-10-31 10:24:09 -07:00