summaryrefslogtreecommitdiffstats
path: root/ui.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ui: Read custom recovery UI values via system property.Tao Bao2018-08-011-14/+19
| | | | | | | | | | | | | | | The matching change to build system now writes these values as build properties for recovery image. This allows us dropping the dependency on Android.mk (as well as having more flexibility to do UI customization). Also rename a few constant names, as the naming doesn't fully follow the style guide (which reads "whose value is fixed for the duration of the program"). Bug: 110380063 Test: Build and flash recovery image on taimen, which uses custom margin height. Check the UI and choose `Run graphics test`. Change-Id: I2c50326123639cb36022f51b62cdeed925d77ba7
* recovery: Add ability to interrupt UIJerry Zhang2018-07-301-23/+62
| | | | | | | | | | | | | | Normally calling a UI method will block indefinitely until the UI is actually used. This creates a method to interrupt the UI, causing waitKey to return -2. This in turn, will cause ShowMenu to return -2. This allows switching between recovery and fastbootd via usb commands. Test: adb shell /data/nativetest64/recovery_unit_test/recovery_unit_test Bug: 78793464 Change-Id: I4c6c9aa18d79070877841a5c9818acf723fa6096
* ui: join only if joinable.Tao Bao2018-06-061-1/+3
| | | | | | | | The threads in RecoveryUI only get initialized if their Init()s finish successfully. Test: recovery_unit_test on marlin. Change-Id: Ic4b62300a3cbd47887d9f4a90dc26f8a7deab616
* recovery: c++ify pthread use in UIJerry Zhang2018-05-301-53/+36
| | | | | | | | | | Change pthread usage to std::mutex, lock_guard, unique_lock, thread, or condition_variable as appropriate. Test: Recovery works, recovery_component_test pass Bug: 78793464 Change-Id: Ibf0b1bbedcf0b6e32fc4ee6aaadd17f21b4d7077
* ui: Use std::thread to create input/progress threads.Tao Bao2018-05-221-42/+32
| | | | | | Test: Build and boot into recovery on walleye. Check the long press detection; `Run graphics test`. Change-Id: Ic3e9b0652fc3ff6fb3ad118df5ebb9bb4abda2cd
* Move reboot() from common.h into otautil/sysutil.h.Tao Bao2018-05-041-4/+2
| | | | | | | | | | | | This breaks the dependency on common.h (which belongs to recovery/librecovery) from librecovery_ui. reboot() is now owned by libotautil, which is expected to be a leaf node to be depended on. With the change, recovery and updater also share the same reboot() code now. Test: mmma -j bootable/recovery Change-Id: I1cc5d702cfe49302048db33d31c9c87ddc97ac71
* recovery: Porting screensave mode for new platform.katao2017-12-141-6/+17
| | | | | | | | | | 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>
* ui: Move locale and friends into ScreenRecoveryUI class.Tao Bao2017-09-111-27/+2
| | | | | | | Localized texts only make sense on devices with screens. Test: Run fake OTA on angler; check the on-screen texts. Change-Id: I3a644294c8b1f2056cfb78b2d61a598b8ddf2acf
* ui: Check for bootreason=recovery_ui.Tao Bao2017-08-031-0/+20
| | | | | | | | | | | | | | | 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
* ui: Move the support for touch inputs into RecoveryUI.Tao Bao2017-08-021-4/+135
| | | | | | | | | | | | | | | | | | | - 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
* Formatting RecoveryUI related files.Tao Bao2017-06-241-165/+165
| | | | | | | All cosmetic changes about indentation reformatting in this CL. Test: mmma bootable/recovery Change-Id: I4539e6244697d1f356b7eb10b961b52d7db561f7
* Adding support for quiescent reboot to recoveryDmitri Plotnikov2017-04-191-1/+1
| | | | | | Bug: 37401320 Test: build and push OTA and hit adb reboot recovery,quiescent. The screen should remain off throughout the upgrade process. Change-Id: Ibed3795c09e26c4fa73684d40b94e40c78394d3f
* Removed C-style castsMikhail Lappo2017-03-231-1/+1
| | | | | | | | In c++ code would be cleaner to use c++ retinterpret cast instead of old c-style notation Change-Id: Ibeef5e0c374addf108c0a8876a6be45063d8e396
* Add the missing #include of <functional>.Tao Bao2017-03-171-0/+1
| | | | | | | | For the use of std::function and std::bind. They were relying on the transitive inclusion from <minui/minui.h>. Test: mmma bootable/recovery Change-Id: Ia138e1cbdd035b11d6cdca9e16c5591303b6ee13
* Fix a log issue in ui.cpp.Tao Bao2017-02-011-1/+1
| | | | | | | | | | It's a copy/paste error when addressing reviewer's comment for commit 6278bdf3490a2f6682f5a9c47350b3d9f92a9165. Test: recovery gives the right message (e.g. "Permission denied") when it fails to read max_brightness. Change-Id: I10372c82595bdc00a6f6725f036c02721b19a1aa
* recovery: Add screensaver mode.Tao Bao2017-01-311-24/+105
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* minui: Move callback functions to std::function.Tao Bao2017-01-231-6/+2
| | | | | | | Also make minor clean up to the header includes. Test: mmma bootable/recovery system/core/healthd system/extra/slideshow Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
* recovery: Fix the broken UI text.Tao Bao2017-01-041-20/+47
| | | | | | | | | | | | | | | 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
* Add a stub recovery UI.Sen Jiang2016-12-131-1/+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
* Switch to <android-base/properties.h>.Elliott Hughes2016-09-261-2/+2
| | | | | | | Bug: http://b/23102347 Test: boot into recovery. Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
* Clean up the sleep()'s after poking init servicesTao Bao2015-05-271-1/+1
| | | | Change-Id: I77564fe5c59e604f1377b278681b7d1bff53a77a
* recovery: change the way of rebooting when using power key comboGaelle Nassiet2015-05-271-1/+3
| | | | | | | | | | | | The power key combo allow to reboot from recovery mode by pressing power button 7 times in a row. It calls directly the function android_reboot() and lead to permission denial errors because of SE Linux rules enforcement. The right way to reboot from recovery is to set the property "sys.powerctl" and let init handle it. Change-Id: Ic7b81e446c3ee13dfbad10cda13a6a1f93123b76 Signed-off-by: Gaelle Nassiet <gaellex.nassiet@intel.com>
* Check all lseek calls succeed.Elliott Hughes2015-04-301-1/+1
| | | | | | | Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek. Bug: http://b/20625546 Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
* Remove unnecessary globals.Elliott Hughes2015-04-131-45/+40
| | | | Change-Id: I76a042432aede08ceaf250319cf5eeb25d601150
* Auto-detect whether to use the long-press UI.Elliott Hughes2015-04-111-1/+5
| | | | Change-Id: Ie77a5584e301467c6a5e164d2c62d6f036b2c0c0
* Fix ScreenRecoveryUI to handle devices without power/up/down.Elliott Hughes2015-04-101-24/+55
| | | | | | | | 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
* Move "Mount /system" to the main menu.Elliott Hughes2015-04-101-40/+16
| | | | | | | Everyone's adding secret key combinations for this anyway, and it's very useful when debugging. Change-Id: Iad549452b872a7af963dd649f283ebcd3ea24234
* am 54a61179: am cfd4b286: Merge "recovery: initialize keys press tracking status"Doug Zongker2014-06-061-0/+1
|\ | | | | | | | | * commit '54a6117935fe7470d23f7a538aeec9d6b139791b': recovery: initialize keys press tracking status
| * recovery: initialize keys press tracking statusMihai Serban2014-06-061-0/+1
| | | | | | | | | | | | | | | | Checks for keys pressed return random results because of an uninitialized data structure. Change-Id: Ic8b3d453d62347921aa893403079b374c16a092e Signed-off-by: Mihai Serban <mihai.serban@intel.com>
| * allow CheckKey to request mounting /systemDoug Zongker2014-03-111-2/+46
| | | | | | | | | | | | | | Also provide a default implementation of CheckKey that's reasonable for many devices (those that have power and volume keys). Change-Id: Icf6c7746ebd866152d402059dbd27fd16bd51ff8
* | disable async reboot during package installationDoug Zongker2014-05-231-4/+21
| | | | | | | | | | | | | | | | | | | | 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
* | remove DefaultDevice's UI subclassDoug Zongker2014-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | RecoveryUI (which is the superclass of ScreenRecoveryUI), provides a basic CheckKey method that is useful for devices that have KEY_POWER, KEY_VOLUMEUP, and KEY_VOLUMEDOWN. Stop overriding it with a less featureful method; with this no recovery UI customization is needed for most handheld devices (phones, tablets, etc.). Change-Id: I7d57cfaaef79afea8af4fc3dbc570afc61aeb5bc
* | recovery: fix epoll events type to uint32_tTodd Poynor2013-09-171-1/+1
| | | | | | | | Change-Id: I5db9987102201c18821acb45d1f824e9865a1451
* | recovery: ui changes for ev_*() switch to epollTodd Poynor2013-09-121-2/+2
| | | | | | | | | | | | Convert callback events parameter to unsigned int. Change-Id: Ife0e983f307c07bf4aca807d70574aeb20c460cd
* | allow CheckKey to request mounting /systemDoug Zongker2013-09-051-2/+46
|/ | | | | | | Also provide a default implementation of CheckKey that's reasonable for many devices (those that have power and volume keys). Change-Id: Icf6c7746ebd866152d402059dbd27fd16bd51ff8
* notify about pending long pressDoug Zongker2013-07-311-8/+33
| | | | | | | | | | | | | | | | | | 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
* add NextCheckKeyIsLong() and EnqueueKey() methodsDoug Zongker2012-12-171-9/+28
| | | | | | | | | | | | | 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
* allow recovery UI to ignore certain keypressesDoug Zongker2012-01-191-0/+3
| | | | Change-Id: Id182bb95ffcc475c5acabb29b413e422302ae7f2
* move key processing to RecoveryUIDoug Zongker2011-11-041-0/+222
| | | | | | | | | 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
* refactor ui functions into a classDoug Zongker2011-10-311-666/+0
| | | | | | | | | | | 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
* turn recovery into a C++ binaryDoug Zongker2011-10-311-0/+666
Change-Id: I423a23581048d451d53eef46e5f5eac485b77555