summaryrefslogtreecommitdiffstats
path: root/ui.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-05-08recovery: Get UI and locale from device.Jerry Zhang1-0/+2
This removes some reliance on the global locale and ui variables. Test: Recovery works Bug: 78793464 Change-Id: I78f1a2b321f5d50aa58b10735a73ae137283353a
2018-05-03Move menu headers/items to std::vector<std::string>.Tao Bao1-4/+6
Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: Build and boot into recovery image on angler. Check the UI that shows menu ('View recovery log', 'Wipe data', 'Run locale test'). Test: Start recovery with '--prompt_and_wipe_data'. Check the UI. Change-Id: If8a4209e0bb4ca64f719f9f9465d3b3589a69cdc
2018-05-02screen_ui: Drop the dependency on common.h.Tao Bao1-1/+3
Remove the use of fopen_path() in screen_ui.cpp, as this is the only place that requires the dependency on common.h. The mounting work should be done by the caller. Also change the parameter in RecoveryUI::ShowFile() from const char* to const std::string&. Test: mmma -j bootable/recovery Test: Build and boot into recovery image on angler. Choose 'View recovery logs'. Change-Id: I8e63f14a8e2b12b856e5a92476e4226cd6ea39fb
2018-05-01Add ScreenRecoveryUI::ShowMenu().Tao Bao1-11/+13
From caller's PoV, RecoveryUI::{Start,Select,End}Menu should always be used together, i.e. to show a menu and get user's selection. This CL provides ShowMenu() as one-stop service (which is based on get_menu_selection() from recovery.cpp). Also move RecoveryUI::{Start,Select,End}Menu into ScreenRecoveryUI, with a dropped access level from public to protected. Due to the dependency on recovery / librecovery refactoring, will add testcases in follow-up CLs. Test: Build and boot into recovery image. Check the menus (main menu, 'View recovery logs', 'Wipe data/factory reset'). Change-Id: Ie17aa78144871a12affd6f9075e045f76608a0ba
2017-12-14recovery: Porting screensave mode for new platform.katao1-0/+2
On new board platform the brightness path of sys/class/leds/lcd-backlight is deprecated,instead of /sys/class/backlight/panel0-backlight/. Test: reboot into recovery on sdm845. Change-Id: Idf0027ab888f9f982a8eef7de230ce3635e7c300 Signed-off-by: katao <katao@xiaomi.com>
2017-09-11ui: Move locale and friends into ScreenRecoveryUI class.Tao Bao1-6/+0
Localized texts only make sense on devices with screens. Test: Run fake OTA on angler; check the on-screen texts. Change-Id: I3a644294c8b1f2056cfb78b2d61a598b8ddf2acf
2017-09-10ui: Refactor the declaration orders.Tao Bao1-23/+49
By grouping similar kinds together, in an order of types, constants, ctor/dtor, all other methods and data members. Also rename ScreenRecoveryUI::density_ to ScreenRecoveryUI::kDensity to align with others. Test: mmma bootable/recovery Change-Id: I1ba2d15c05ba7be8c39762f3d9dadf1fb2130de4
2017-08-03ui: Check for bootreason=recovery_ui.Tao Bao1-0/+1
Some wear bootloaders are passing bootreason=recovery_ui when booting into recovery from fastboot, or via 'adb reboot recovery'. Allow turning on text mode with a swipe for such a bootreason. Since we will turn on text mode automatically for debuggable builds, this bootreason mainly handles the case for user builds. Note this change only applies to devices that allow touch screen inputs. Bug: 36169090 Bug: 64307776 Test: Build and boot into user build recovery image. Toggle on text mode with a swipe. Change-Id: I55f19aed7b210352f8370de19935b4772cc12095 (cherry picked from commit 046aae29d9b0d2cdf24ad0567146991c3864c140)
2017-08-03ui: Check for bootreason=recovery_ui.Tao Bao1-0/+1
Some wear bootloaders are passing bootreason=recovery_ui when booting into recovery from fastboot, or via 'adb reboot recovery'. Allow turning on text mode with a swipe for such a bootreason. Since we will turn on text mode automatically for debuggable builds, this bootreason mainly handles the case for user builds. Note this change only applies to devices that allow touch screen inputs. Bug: 36169090 Test: Build and boot into user build recovery image. Toggle on text mode with a swipe. Change-Id: I55f19aed7b210352f8370de19935b4772cc12095
2017-08-03ui: Move the support for touch inputs into RecoveryUI.Tao Bao1-0/+24
- Added detection for EV_ABS events in minui/events.cpp, if it's allowed; - Added listening and processing touch inputs in ui.cpp; - Fixed an issue in recognizing swipe with multi-touch protocol A; - Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It now allows turning on text mode with <power> + <swipe-up>. The last change also fixed an issue on devices with protocol A: prior to this CL, user may accidentally toggle the text mode during an OTA. Because it was considered as a single-button device, a long tap that sent BTN_TOUCH event would turn on text mode. Test: Allow detecting touch inputs. Swiping (up, down, enter) works on angler, angelfish, dorado respectively. Bug: 36169090 Bug: 64307776 Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd (cherry picked from commit 5f8dd9951d986b65d98d6a9ea38003427e9e46df)
2017-08-02ui: Move the support for touch inputs into RecoveryUI.Tao Bao1-0/+24
- Added detection for EV_ABS events in minui/events.cpp, if it's allowed; - Added listening and processing touch inputs in ui.cpp; - Fixed an issue in recognizing swipe with multi-touch protocol A; - Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It now allows turning on text mode with <power> + <swipe-up>. The last change also fixed an issue on devices with protocol A: prior to this CL, user may accidentally toggle the text mode during an OTA. Because it was considered as a single-button device, a long tap that sent BTN_TOUCH event would turn on text mode. Test: Allow detecting touch inputs. Swiping (up, down, enter) works on angler, angelfish, dorado respectively. Bug: 36169090 Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd
2017-06-24Add override specifier and member constness to RecoveryUI classes.Tao Bao1-38/+30
Test: mmma bootable/recovery Change-Id: I66e328614423488a4027d7878f4569fbf3a3721e
2017-06-24Formatting RecoveryUI related files.Tao Bao1-148/+148
All cosmetic changes about indentation reformatting in this CL. Test: mmma bootable/recovery Change-Id: I4539e6244697d1f356b7eb10b961b52d7db561f7
2017-01-31recovery: Add screensaver mode.Tao Bao1-0/+15
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-23minui: Move callback functions to std::function.Tao Bao1-2/+0
Also make minor clean up to the header includes. Test: mmma bootable/recovery system/core/healthd system/extra/slideshow Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
2017-01-04recovery: Fix the broken UI text.Tao Bao1-7/+14
UI text is broken (doesn't show any text during FDR) due to commit d530449e54bd327e9c26209ffa0490c6508afe6c, 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
2016-12-13Add a stub recovery UI.Sen Jiang1-2/+2
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-04-29Add ability to show "installing security update"Tianjie Xu1-0/+1
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
2015-06-03Log update outputs in orderTao Bao1-1/+3
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-04-13Remove unnecessary globals.Elliott Hughes1-5/+6
Change-Id: I76a042432aede08ceaf250319cf5eeb25d601150
2015-04-11Auto-detect whether to use the long-press UI.Elliott Hughes1-0/+4
Change-Id: Ie77a5584e301467c6a5e164d2c62d6f036b2c0c0
2015-04-10Fix ScreenRecoveryUI to handle devices without power/up/down.Elliott Hughes1-13/+16
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-10Move "Mount /system" to the main menu.Elliott Hughes1-2/+1
Everyone's adding secret key combinations for this anyway, and it's very useful when debugging. Change-Id: Iad549452b872a7af963dd649f283ebcd3ea24234
2015-04-09Move file paging into ScreenRecoveryUI.Elliott Hughes1-2/+4
This fixes the N9 performance problem. Change-Id: I00c10d4162ff266a6243285e5a5e768217f6f799
2015-04-09Enable printf format argument checking.Elliott Hughes1-1/+1
The original attempt missed the fact that Print is a member function, so the first argument is the implicit 'this'. Change-Id: I963b668c5432804c767f0a2e3ef7dea5978a1218
2014-05-23disable async reboot during package installationDoug Zongker1-0/+8
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-03-11allow CheckKey to request mounting /systemDoug Zongker1-1/+5
Also provide a default implementation of CheckKey that's reasonable for many devices (those that have power and volume keys). Change-Id: Icf6c7746ebd866152d402059dbd27fd16bd51ff8
2013-11-27add the functions for multi-stage packages to updaterDoug Zongker1-0/+2
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-09-17recovery: fix epoll events type to uint32_tTodd Poynor1-1/+1
Change-Id: I5db9987102201c18821acb45d1f824e9865a1451
2013-09-12recovery: ui changes for ev_*() switch to epollTodd Poynor1-1/+1
Convert callback events parameter to unsigned int. Change-Id: Ife0e983f307c07bf4aca807d70574aeb20c460cd
2013-09-05allow CheckKey to request mounting /systemDoug Zongker1-1/+5
Also provide a default implementation of CheckKey that's reasonable for many devices (those that have power and volume keys). Change-Id: Icf6c7746ebd866152d402059dbd27fd16bd51ff8
2013-07-31notify about pending long pressDoug Zongker1-1/+20
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
2012-12-17add NextCheckKeyIsLong() and EnqueueKey() methodsDoug Zongker1-0/+7
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-09-19localization for recovery messagesDoug Zongker1-0/+3
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-18localization for recovery messagesDoug Zongker1-0/+3
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-08-23add simple text to recovery UIDoug Zongker1-1/+1
- 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-01-19allow recovery UI to ignore certain keypressesDoug Zongker1-1/+1
Change-Id: Id182bb95ffcc475c5acabb29b413e422302ae7f2
2012-01-18allow recovery UI to ignore certain keypressesDoug Zongker1-1/+1
Change-Id: Id182bb95ffcc475c5acabb29b413e422302ae7f2
2011-11-04move key processing to RecoveryUIDoug Zongker1-5/+26
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-01move key processing to RecoveryUIDoug Zongker1-5/+26
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-10-31C++ class for device-specific codeDoug Zongker1-0/+7
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-31refactor ui functions into a classDoug Zongker1-50/+59
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-31C++ class for device-specific codeDoug Zongker1-0/+7
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-31turn recovery into a C++ binaryDoug Zongker1-63/+6
Change-Id: I423a23581048d451d53eef46e5f5eac485b77555
2011-10-28turn recovery into a C++ binaryDoug Zongker1-55/+10
Change-Id: I68a67a4c8edec9a74463b3d4766005ce27b51316
2011-04-12save a last_install file with the result of the last package install attemptDoug Zongker1-0/+3
When installing a package, create /cache/recovery/last_install, which contains the filename of the package and a 1 or 0 for success or failure. Also, don't mount ext4 and vfat filesystems as read-only (on devices where /cache is ext4, we need it to be read-write). Change-Id: I0cf2a1921bbd65e06343aa74e2006577fac77c2c
2011-03-01make recovery UI images more general; allow for installation animationDoug Zongker1-0/+19
Change some of the UI parameters (# of indeterminate progress bar frames, fps, etc.) from #defined constants to variables that can be set by the device-specific recovery_ui code (via a new function). Support overlaying different images on top of the base installation icon to animate it. Make the FPS control more accurate. Change-Id: I9268b389b7ea6b3ed9e0c7eae37baf4272e60edd
2011-02-25store partition length in recovery.fstabDoug Zongker1-0/+6
Don't hardcode magical partition behavior in roots.c. Change-Id: I587fc2c066575b51c11efd2e45a50f5b864df484
2011-02-25store partition length in recovery.fstabDoug Zongker1-0/+6
Don't hardcode magical partition behavior in roots.c. Change-Id: I587fc2c066575b51c11efd2e45a50f5b864df484
2011-02-18store partition length in recovery.fstabDoug Zongker1-0/+6
Don't hardcode magical partition behavior in roots.c. Change-Id: I587fc2c066575b51c11efd2e45a50f5b864df484
2011-01-25make recovery reboot after 2 minutes of no activityDoug Zongker1-0/+1
If recovery sits for 2 minutes in prompt_and_wait(), and you've never turned the screen on via the magic keypress, go ahead and reboot. (We used to assume that the user could pull the battery to get out of this state, but on devices with nonremovable batteries...) If you've ever enabled display of the log/menu since recovery started, we assume you know what you're doing and will stay in recovery until you choose to reboot. Bug: 3387873 Bug: 3387274 Change-Id: I041621e5db132df9a925e6808845a7c45e1b427a
2010-09-21remove the notion of "root path"; support mixed flash typesDoug Zongker1-0/+13
Remove the wacky notion of "roots" and "root paths" (those things that look like "FOO:some/path" instead of just "/foo/some/path"). Let each device specify its own table of available partitions and how to mount them (needed for devices that use both MTD/yaffs2 and EMMC/ext4 partitions). (Cherrypicked from gingerbread w/slight edits.) Change-Id: I2479ce76b13e73f1d12035c89386c3a82b3edf51
2010-09-21remove the notion of "root path"; support mixed flash types (do not merge)Doug Zongker1-0/+13
Remove the wacky notion of "roots" and "root paths" (those things that look like "FOO:some/path" instead of just "/foo/some/path"). Let each device specify its own table of available partitions and how to mount them (needed for devices that use both MTD/yaffs2 and EMMC/ext4 partitions). Change-Id: I18b0a572a71c5e087e0b7ae11b1774388339bfd1
2010-09-15support for ext4/EMMC filesystems in updater binaryDoug Zongker1-4/+4
Make the mount and format functions take extra parameters describing the filesystem type and add support for mounting and formatting ext4 filesystems on EMMC. Change recovery to consistently use stdout for status messages instead of mixing stdout and stderr.
2010-09-15(cherry-pick) support installing any .zip file on the sdcardDoug Zongker1-1/+1
Replaces the "install sdcard:update zip" menu option with one that displays a menu of zip files (and subdirs) on the sdcard and lets you pick which one to install. Change-Id: Icff541525f2fdfc8939a91af626ecc386ac9dd07
2010-09-03add --show_text option to recoveryDoug Zongker1-0/+1
Change-Id: Ie6c6c920260dfa759fbb15b1f352d6bb0fa7146c
2010-07-02support for ext4/EMMC filesystems in updater binaryDoug Zongker1-4/+4
Make the mount and format functions take extra parameters describing the filesystem type and add support for mounting and formatting ext4 filesystems on EMMC. Change recovery to consistently use stdout for status messages instead of mixing stdout and stderr.
2010-06-25Add __attribute__((format(printf, a, b))) to printf like functions.Nick Kralevich1-1/+1
Fix potential string format bug. Change-Id: Ie05aac53b2c45a48bd68e340b76ccb21edfd28b7
2010-04-08support installing any .zip file on the sdcardDoug Zongker1-1/+1
Replaces the "install sdcard:update zip" menu option with one that displays a menu of zip files (and subdirs) on the sdcard and lets you pick which one to install. Change-Id: I85c94c0e9bc8e05ca52031fc29ca2624c2695ced
2010-02-03bump updater API version to 3; deprecate firmware update commandDoug Zongker1-7/+0
Remove support for the HTC-specific "firmware" update command and the corresponding edify function write_firmware_update(). This functionality is now done by an edify extension library that lives in vendor/htc. Change-Id: I80858951ff10ed8dfff98aefb796bef009e05efb
2009-11-13eclair snapshotJean-Baptiste Queru1-1/+1
2009-09-20reduce fraction of progress bar for verificationDoug Zongker1-1/+1
Reduce the fraction of the progress bar used for package verification from 50% to 25%: - verification is faster than before due to sha1 improvements - in eclair we're now verifying the compressed data rather than decompressing it - incremental packages (which is what most installs use) write more data than is contained in the package.
2009-06-18let the "firmware" command take the file straight from the packageDoug Zongker1-0/+3
To do a firmware-install-on-reboot, the update binary tells recovery what file to install before rebooting. Let this file be specified as "PACKAGE:<foo>" to indicate taking the file out of the OTA package, avoiding an extra copy to /tmp. Bump the API version number to reflect this change.
2009-04-02AI 144105: am: CL 144082 Remove the unused "unpacking" recovery icon.Doug Zongker1-1/+0
Original author: dougz Merged from: //branches/donutburger/... Automated import of CL 144105
2009-04-01AI 144082: Remove the unused "unpacking" recovery icon.Doug Zongker1-1/+0
Automated import of CL 144082
2009-03-04auto import from //depot/cupcake/@135843The Android Open Source Project1-0/+94
2009-03-04auto import from //depot/cupcake/@135843The Android Open Source Project1-94/+0
2009-02-11auto import from //branches/cupcake/...@130745The Android Open Source Project1-0/+12