summaryrefslogtreecommitdiffstats
path: root/screen_ui.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-11-05ui: Manage loaded resources with smart pointers.Tao Bao1-44/+41
Test: Run recovery_unit_test on marlin. Test: `Run graphics test` on marlin. Change-Id: I8239c3d9fb288f80ee11f615402768ff8ef8ecd0
2018-10-23ui: Add constness to Draw- functions.Tao Bao1-4/+5
These functions take the given GRSurface instances as inputs, which shouldn't be altered. Test: mmma -j bootable/recovery Test: Run recovery_unit_test. Test: `Run graphics test` on marlin. Change-Id: I51bf408e85faae2b497d4f148ab1dec22dd16c93
2018-10-23minui: Move GRSurface into a class.Tao Bao1-1/+1
This CL adds GRSurface::Create() and dtor for managing the allocated memory in GRSurface class. It also adds GRSurface::data() that hides the underlying implementation, with both of const and non-const overloads. This allows `const GRSurface&` to be more useful - previously it only ensured a const member variable of `data`, instead of a read-only buffer it points to. It also marks the parameters in gr_texticon() and gr_blit() as const, as they're incoming source that shouldn't be altered. It corrects the type of gr_draw, which is the sink to be painted on (an earlier attempt was made in [1], but didn't get the full picture correctly). [1] https://android-review.googlesource.com/c/platform/bootable/recovery/+/704757/ Test: mmma -j bootable/recovery Test: recovery_unit_test on marlin Test: Run graphics test on marlin (fbdev). Test: Run graphics test on blueline (drm). Change-Id: I7904df084cd6c08fa04a9da97d01b4b1a6e3a20c
2018-10-23Add function to show localized rescue party menuTianjie Xu1-17/+39
Add a function in screenUI to display the pre-generated graphs for rescue party. If these graphs are not valid, falls back to display the old text strings. Right now we haven't generated the localized graphs yet, so the UI always shows the TextMenu. Bug: 116655889 Test: check rescue party under recovery Change-Id: I0558cb536b659cdc25c8b7946d3a39820935b003
2018-10-13Implement the graphic menusTianjie Xu1-46/+121
As we plan to show localized rescue party dialogs under recovery mode with pre-generated images, it becomes necessary to show the menu headers and items with images. This cl converts the menu class to a interface and derived TextMenu & GraphicMenu classes. And the GraphicMenu uses GRSurfaces* as the menu header and a list of GRSurfaces* as menu items. Moreover, factor out the Draw* functions in the ScreenUI into a separate DrawInterface. Therefore, the Menu class can access these draw functions and use them to implement the DrawHeaders & DrawItems neatly. Bug: 74397117 Test: unittests pass, boot into recovery and check menu Change-Id: I95cee30f3e5eb666eb6fbcdfc873a7260fc177c1
2018-08-01ui: Read custom recovery UI values via system property.Tao Bao1-4/+4
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
2018-05-30recovery: c++ify pthread use in UIJerry Zhang1-3/+1
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
2018-05-22ui: Use std::thread to create input/progress threads.Tao Bao1-1/+5
Test: Build and boot into recovery on walleye. Check the long press detection; `Run graphics test`. Change-Id: Ic3e9b0652fc3ff6fb3ad118df5ebb9bb4abda2cd
2018-05-22recovery: Add ability to set title linesJerry Zhang1-0/+3
Add the ability to change the contents of the title lines, displayed at the top of the screen. Once set, the same lines are displayed for all menus until changed again. Test: Recovery works Bug: 78793464 Change-Id: I7ef5594b0d76dbbd2e01ad7508863af1270b2a2a
2018-05-10Device owns the RecoveryUI instance.Tao Bao1-1/+1
Test: mmma -j bootable/recovery Test: Build and boot into recovery, w/ and w/o enabling quiescent mode respectively. Change-Id: I5d9bb945a6c3c9a3b96199fa0c8071a2f91339a0
2018-05-09screen_ui: Fix an issue when displaying wrapped text.Tao Bao1-2/+3
The last character at EOL is cut when showing the prompt-for-data-wipe message on angler. Address the issue by keeping symmetrical margins based on the given offset. Test: Trigger prompt-and-wipe-data menu. No cutout character at EOL. Change-Id: Id6e8dc7815bf681435bcaf13e7bdd09cf870d95f
2018-05-08screen_ui: Drop the parameter in CheckBackgroundTextImages.Tao Bao1-3/+3
ScreenRecoveryUI already has the info in locale_. Also when showing "Current locale: X/Y" on screen, use 1-based index for X, so that we have 1 <= X <= Y. Test: Build anf flash recovery image on aosp_bullhead-userdebug. Choose `Run locale test` from UI. Change-Id: I5dd4de82e63890ddf755f4e23cd2290ad5d50ece
2018-05-08recovery: Get UI and locale from device.Jerry Zhang1-0/+1
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-13/+14
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-03screen_ui: Merge Menu::Start() into its ctor.Tao Bao1-5/+6
Since we instantiate a Menu object each time for a given set of header/items, we don't have a use case of re-populating an existing Menu with different data (which is what Menu::Start() does). Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: Build and boot into recovery image on angler. Check the UI. Change-Id: Iaa2ba9d406ebd74c015e43198c17c5335b38df53
2018-05-03screen_ui: Use std::string in DrawTextLine() and siblings.Tao Bao1-4/+4
Test: mmma -j bootable/recovery Test: Build and boot into recovery image on angler. Check the UI. Test: Repeat the same test on devices using wearable UI. Change-Id: I1a67ff4ae8de4d7a8dc66326cf07f95c89e95152
2018-05-02screen_ui: Drop the dependency on common.h.Tao Bao1-1/+1
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-4/+15
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
2018-03-24Factor out a menu class for screen uiTianjie Xu1-4/+69
Also consolidate the duplicate codes to draw the menu in ScreenRecoveryUI and WearRecoveryUI. This helps us to support text icons as menu in the future. Bug: 74397117 Test: Check the menu under recovery on bullhead and a wear device. Change-Id: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b Merged-In: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b
2018-03-24Factor out a menu class for screen uiTianjie Xu1-4/+69
Also consolidate the duplicate codes to draw the menu in ScreenRecoveryUI and WearRecoveryUI. This helps us to support text icons as menu in the future. Bug: 74397117 Test: Check the menu under recovery on bullhead and a wear device. Change-Id: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b (cherry picked from commit 2b3f80068ece1040ba7c923afe1e70b705535ad5)
2017-10-05vr_ui: drawing changesLuke Song1-0/+11
Change drawing of horizontal bars. Implement image and background drawing. Bug: 65556996 Test: Viewed graphics test Change-Id: I68ddd997123607dbebf972af5a455ce8ef0c7075
2017-09-27Add a new option in recovery menu to test the background textsTianjie Xu1-0/+8
Add a new option "Run locale test" to check the background text images (i.e. texts for "erasing", "error", "no_command" and "installing" with different locales.) Use volume up/down button to cycle through all the locales embedded in the png file, and power button to go back to recovery main menu. Test: Run locale test with bullhead. Change-Id: Ib16e119f372110cdb5e611ef497b0f9b9b418f51
2017-09-11ui: Move locale and friends into ScreenRecoveryUI class.Tao Bao1-0/+7
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-51/+52
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-09-09ui: Remove text_top_.Tao Bao1-1/+1
After the cleanup to WearRecoveryUI, text_top_ now always equals to ((text_row_ + 1) % text_rows_). Test: Check the recovery UI and 'View recovery logs'. Change-Id: I69a7f377bbd990db2194f9d3efae257c323c06a8
2017-09-09ui: Manage menu_ with std::vector.Tao Bao1-1/+2
Prior to this CL, menu_ is allocated with a fixed length of text_rows_. However, because we support scrollable menu in wear_ui, there might be more menu entries than text_rows_, which would lead to out-of-bounds array access. This CL addresses the issue by switching to std::vector. Bug: 65416558 Test: Run 'View recovery logs' on angler. Test: Set large margin height that leaves text_rows less than 21. Then run 'View recovery logs' with 21 menu entries. Change-Id: I5d4e3a0a097039e1104eda7d494c6269053dc894 (cherry picked from commit e15d7a5104978cd8399501636aec0df9c1a4823c)
2017-09-08ui: Manage menu_ with std::vector.Tao Bao1-1/+2
Prior to this CL, menu_ is allocated with a fixed length of text_rows_. However, because we support scrollable menu in wear_ui, there might be more menu entries than text_rows_, which would lead to out-of-bounds array access. This CL addresses the issue by switching to std::vector. Bug: 65416558 Test: Run 'View recovery logs' on angler. Test: Set large margin height that leaves text_rows less than 21. Then run 'View recovery logs' with 21 menu entries. Change-Id: I5d4e3a0a097039e1104eda7d494c6269053dc894
2017-08-16screen_ui: Word-wrap menu headers.Tao Bao1-0/+3
This CL adds ScreenRecoveryUI::DrawWrappedTextLines() to better handle long menu header texts. It does a word wrap at spaces, if available. This avoids fixed-length menu headers being truncated on small screens. Bug: 64293520 Test: On bullhead, boot into recovery with --prompt_and_wipe_data, and check the prompt texts. Change-Id: Ia22746583516dd230567a267584aca558429395e (cherry picked from commit 2bbc6d642d1fbfb007905d95b629fe5f833b2a1b)
2017-08-16screen_ui: Word-wrap menu headers.Tao Bao1-0/+3
This CL adds ScreenRecoveryUI::DrawWrappedTextLines() to better handle long menu header texts. It does a word wrap at spaces, if available. This avoids fixed-length menu headers being truncated on small screens. Bug: 64293520 Test: On bullhead, boot into recovery with --prompt_and_wipe_data, and check the prompt texts. Change-Id: Ia22746583516dd230567a267584aca558429395e
2017-08-13Allow customizing WearRecoveryUI via Makefile variables.Tao Bao1-3/+3
With the following Makefile variables, we can reduce the work of writing (copy/pasting) device-specific WearRecoveryUI classes. The list of Makefile variables (the ones useful for Wear devices): - TARGET_RECOVERY_UI_MARGIN_HEIGHT (default: 0) - TARGET_RECOVERY_UI_MARGIN_WIDTH (default: 0) Specify the margin space that we don't want to display texts. They replace the former outer_width and outer_height. - TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD (default: 50) - TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD (default: 90) Specify the sensitivity of recognizing a swipe. Devices give absolute positions, so for some devices we need to adjust the thresholds. - TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE Specify the progress bar vertical position, which should be adjusted to the actual height of a device. It replaces the former progress_bar_y. - TARGET_RECOVERY_UI_ANIMATION_FPS (default: 30) Specify the animation FPS if using device-specific animation images. It replaces the former animation_fps. Devices can specify "TARGET_RECOVERY_UI_LIB := librecovery_ui_wear", with optionally defined Makefile vars above, in BoardConfig.mk to customize their WearRecoveryUI. Also remove the obsolete wear_touch.{cpp,h}, which has been merged into ui.cpp in commit 5f8dd9951d986b65d98d6a9ea38003427e9e46df. Bug: 64307776 Test: Change the device BoardConfig.mk and test recovery image. Change-Id: Id0fb2d4e3977ab5ddd31e71f9535470cab70e41b (cherry picked from commit 0470ceea381775b09eee931858c3320be88cc637)
2017-08-10Allow customizing WearRecoveryUI via Makefile variables.Tao Bao1-3/+3
With the following Makefile variables, we can reduce the work of writing (copy/pasting) device-specific WearRecoveryUI classes. The list of Makefile variables (the ones useful for Wear devices): - TARGET_RECOVERY_UI_MARGIN_HEIGHT (default: 0) - TARGET_RECOVERY_UI_MARGIN_WIDTH (default: 0) Specify the margin space that we don't want to display texts. They replace the former outer_width and outer_height. - TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD (default: 50) - TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD (default: 90) Specify the sensitivity of recognizing a swipe. Devices give absolute positions, so for some devices we need to adjust the thresholds. - TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE Specify the progress bar vertical position, which should be adjusted to the actual height of a device. It replaces the former progress_bar_y. - TARGET_RECOVERY_UI_ANIMATION_FPS (default: 30) Specify the animation FPS if using device-specific animation images. It replaces the former animation_fps. Devices can specify "TARGET_RECOVERY_UI_LIB := librecovery_ui_wear", with optionally defined Makefile vars above, in BoardConfig.mk to customize their WearRecoveryUI. Also remove the obsolete wear_touch.{cpp,h}, which has been merged into ui.cpp in commit 5f8dd9951d986b65d98d6a9ea38003427e9e46df. Bug: 64307776 Test: Change the device BoardConfig.mk and test recovery image. Change-Id: Id0fb2d4e3977ab5ddd31e71f9535470cab70e41b
2017-07-07Restructure vr_uiLuke Song1-1/+0
Get rid of pixel offset variables, and use makefile variables in BoardConfigs. Cherry picked from commit 81a8e4cab2a20fd1b1a4716563d4d2586bd1e1de Bug: 37779982 Test: Verified vr ui has same behavior. Change-Id: Ifbf44e27d7101aedbe3c0e6db4b8181d56efadfd
2017-07-06Introduce VR recovery uiLuke Song1-2/+4
A version of screen ui with specific adjustments for vr device compatibility. Cherry picked from commit a44dba7f4e7296077f65fd571232e8a61aed9418 Bug: 37779982 Test: "adb reboot recovery" to view Change-Id: If6b0f26c1b587f8d0176060685b5efb6c67593b1
2017-07-02Update ScreenRecoveryUI::Draw* function signatures.Tao Bao1-3/+7
Move away from taking int* for the Y-offset. Change it to int and return the offset instead. Test: Check the recovery menu and 'Wipe data' menu. Change-Id: Ib15e070a0d576a0f8f66f35605cb8479e7071f26
2017-06-24Add override specifier and member constness to RecoveryUI classes.Tao Bao1-16/+17
Test: mmma bootable/recovery Change-Id: I66e328614423488a4027d7878f4569fbf3a3721e
2017-06-24Formatting RecoveryUI related files.Tao Bao1-105/+111
All cosmetic changes about indentation reformatting in this CL. Test: mmma bootable/recovery Change-Id: I4539e6244697d1f356b7eb10b961b52d7db561f7
2017-06-24Restructure vr_uiLuke Song1-1/+0
Get rid of pixel offset variables, and use makefile variables in BoardConfigs. Bug: 37779982 Test: Verified vr ui has same behavior. Change-Id: Ifbf44e27d7101aedbe3c0e6db4b8181d56efadfd (cherry picked from commit 81a8e4cab2a20fd1b1a4716563d4d2586bd1e1de)
2017-06-23Restructure vr_uiLuke Song1-1/+0
Get rid of pixel offset variables, and use makefile variables in BoardConfigs. Bug: 37779982 Test: Verified vr ui has same behavior. Change-Id: Ifbf44e27d7101aedbe3c0e6db4b8181d56efadfd
2017-06-23Use Makefile variables to specify margin settings.Tao Bao1-5/+5
Instead of defining device-specific UI class, this CL allows using Makefile variables to specify margin values directly. Values explicitly defined via TARGET_RECOVERY_UI_MARGIN_HEIGHT and TARGET_RECOVERY_UI_MARGIN_WIDTH will be used. Otherwise they will default to zero. Bug: 62732748 Test: Specify the height and width and check recovery texts. Change-Id: Icb6f7466c8d407f877b93da38aebfdf7e6b41be7 (cherry picked from commit a92d8fb45676566a56d7c27d2e8fb644523adc94)
2017-06-23screen_ui: Allow setting screen margin space.Tao Bao1-2/+9
For round screen or screens with rounded corners, we don't want to show texts within the margin which could otherwise be invisible. Move the density computation to ScreenRecoveryUI ctor so that the value can be used earlier. Note that this is similar to the existing stuff in wear UI (outer_width, outer_height). This CL gets ScreenRecoveryUI and WearRecoveryUI one-step closer. Bug: 62732748 Test: Setting and not setting margin_{width,height}_ on angler. Check the recovery texts (recovery menu as well as 'View recovery logs'). Change-Id: Ibf6238c9cc8949a42ed8a410e1c09d55b0b5a151 (cherry picked from commit 87f4650874346f1d0238e70b148a31cea5e19a2e)
2017-06-23Use Makefile variables to specify margin settings.Tao Bao1-5/+5
Instead of defining device-specific UI class, this CL allows using Makefile variables to specify margin values directly. Values explicitly defined via TARGET_RECOVERY_UI_MARGIN_HEIGHT and TARGET_RECOVERY_UI_MARGIN_WIDTH will be used. Otherwise they will default to zero. Bug: 62732748 Test: Specify the height and width and check recovery texts. Change-Id: Icb6f7466c8d407f877b93da38aebfdf7e6b41be7 (cherry picked from commit a92d8fb45676566a56d7c27d2e8fb644523adc94)
2017-06-22Use Makefile variables to specify margin settings.Tao Bao1-5/+5
Instead of defining device-specific UI class, this CL allows using Makefile variables to specify margin values directly. Values explicitly defined via TARGET_RECOVERY_UI_MARGIN_HEIGHT and TARGET_RECOVERY_UI_MARGIN_WIDTH will be used. Otherwise they will default to zero. Bug: 62732748 Test: Specify the height and width and check recovery texts. Change-Id: Icb6f7466c8d407f877b93da38aebfdf7e6b41be7
2017-06-21screen_ui: Allow setting screen margin space.Tao Bao1-2/+9
We already have outer_width and outer_height in wear UI, and x_offset and y_offset in VR UI. This CL adds margin_width_ and margin_height_ to their base class (ScreenRecoveryUI) to shorten the gap. This will be in general useful for round or round-cornered screens. Move the density computation to ScreenRecoveryUI ctor so that the value can be used earlier. Bug: 62732748 Test: Setting and not setting margin_{width,height}_ on angler. Check the recovery texts (recovery menu as well as 'View recovery logs'). Change-Id: Ibf6238c9cc8949a42ed8a410e1c09d55b0b5a151 (cherry picked from commit 87f4650874346f1d0238e70b148a31cea5e19a2e)
2017-06-20screen_ui: Allow setting screen margin space.Tao Bao1-2/+9
For round screen or screens with rounded corners, we don't want to show texts within the margin which could otherwise be invisible. Move the density computation to ScreenRecoveryUI ctor so that the value can be used earlier. Note that this is similar to the existing stuff in wear UI (outer_width, outer_height). This CL gets ScreenRecoveryUI and WearRecoveryUI one-step closer. Bug: 62732748 Test: Setting and not setting margin_{width,height}_ on angler. Check the recovery texts (recovery menu as well as 'View recovery logs'). Change-Id: Ibf6238c9cc8949a42ed8a410e1c09d55b0b5a151
2017-06-17Introduce VR recovery uiLuke Song1-2/+4
A version of screen ui with specific adjustments for vr device compatibility. (cherrypick of a44dba7f4e7296077f65fd571232e8a61aed9418 to AOSP) Bug: 37779982 Test: "adb reboot recovery" to view Change-Id: If6b0f26c1b587f8d0176060685b5efb6c67593b1
2017-06-15Introduce VR recovery uiLuke Song1-2/+4
A version of screen ui with specific adjustments for vr device compatibility. Bug: 37779982 Test: "adb reboot recovery" to view Change-Id: If6b0f26c1b587f8d0176060685b5efb6c67593b1
2017-03-23Const modifiersMikhail Lappo1-3/+3
This functions do not change class variables Would be good to mark them as const, so class variables are not changed by coincidence Change-Id: Iea34f6d26dbd1bde813035160e07ff2a681989e6
2017-01-17minui: Export minui/minui.h.Tao Bao1-1/+3
For libminui static and shared libraries. Test: build Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16
2017-01-04recovery: Fix the broken UI text.Tao Bao1-5/+3
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-09-07Remove duplicate methods and variables from WearRecoveryUIDamien Bargiacchi1-21/+24
Copy pasta is never as delicious as ones hopes. Also fix the Pike not rendering recovery bug. Change-Id: I903da7da436e3347a22ff51633e8a0f28fea2c46
2016-07-09Support landscape layouts.Elliott Hughes1-2/+2
Add support for landscape layouts to the existing portrait support. Bug: http://b/29418855 Test: tested manually with "Run graphics test" on flounder/fugu/ryu. Change-Id: Ib4a62bf5f2b8a1cef6028a01f05145104660560a
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
2016-04-27Update recovery UI.Elliott Hughes1-3/+11
* Use new animation. * Use new non-holo progress bars. * Use recommended spacing for recovery UI. Bug: http://b/26548285 Change-Id: I8411e89d6a6a9ce638b8645e19e5082d0d968cee
2016-04-15Update the system update animation.Elliott Hughes1-18/+32
Switch to a Wear-like intro/loop system. We don't have an intro yet, but hopefully this will let Wear delete more code when they move to N. Unlike them, we don't hard-code the number of frames: we just look to see what we have available. We do hard-code the fps though. Also add a graphics test mode so you can see a demo of the UI components without having to actually apply an OTA. Also fix a bug where default locale is null rather than en-US: it's more useful to show _some_ text if we don't have a locale (which should only be during development anyway). Bug: http://b/26548285 Change-Id: I63422e3fef3c41109f924d96fb5ded0b3ae7815d
2016-03-12recovery: Remove SetColor, and other refactoring for WearUIPrashant Malani1-2/+4
The only difference from SetColor in ScreenRecoveryUI is the that the LOG messages have slightly different colors. That's not enough to warrant a duplicate function. So this patch removes SetColor and uses the parent class version. This patch also moves the DrawTextLine* functions into ScreenRecoveryUI since they're mostly the same. It also moves char_width and char_height into the class instead of keeping them as static variables. Bug: 27407422 Change-Id: I30428c9433baab8410cf710a01c9b1c44c217bf1
2016-03-11recovery: Remove duplicate variables and functionsPrashant Malani1-3/+4
The function that modifies rtl_locale exists only in the base class, and so the variable should not have a duplicate in the derived class, otherwise there may be incosistent values when it is read by the derived class (the thinking being that invoking the function will modify the base class version of the variable, and not the derived class version). Remove the updateMutex variable, and instead re-use the one in the base class. Also remove LoadBitmap from WearUI since it is identical to the one in ScreenRecoveryUI. Bug: 27407422 Change-Id: Idd823fa93dfa16d7b2c9c7160f8d0c2559d28731
2016-03-10Revert "recovery: More refactoring of WearUI"Prashant Malani1-2/+1
This reverts commit 1c7b2230d8aac9f064f68c48b6aa26aca000cc9d. This change can lead to the derived class indirectly (and incorrectly) calling some functions from the base class, which can lead to unpredictable behavior. Bug: 27407422 Change-Id: I126a7489b0787dc195e942e2ceea6769de20d70c
2016-03-09recovery: More refactoring of WearUIPrashant Malani1-1/+2
This patch performs the following modifications: - Remove setBackground function, and currentIcon member variable. - Remove common Progress*, Redraw and EndMenu functions. Bug: 27407422 Change-Id: Ic3c0e16b67941484c3bc1d04c9b61288e8896808 Signed-off-by: Prashant Malani <pmalani@google.com>
2015-12-16res: Embed FPS into icon_installing.png.Tao Bao1-1/+3
We allow vendor-specific icon installing image but have defined private animation_fps that can't be overridden. This CL changes the image generator to optionally embed FPS (otherwise use the default value of 20) into the generated image. For wear devices, they are using individual images instead of the interlaced one. Change the animation_fps from private to protected so that it can be customized. Bug: 26009230 Change-Id: I9fbf64ec717029d4c54f72316f6cb079e8dbfb5e
2015-06-03Log update outputs in orderTao Bao1-0/+2
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-05-07Add an alternate screen for viewing recovery logs.Elliott Hughes1-5/+10
This makes it easier to go back and forth without losing current output. Also make the display more like regular more(1). Bug: http://b/20834540 Change-Id: Icc5703e9c8a378cc7072d8ebb79e34451267ee1b (cherry picked from commit c049163234003ef463bca018920622bc8269c69b)
2015-05-07Add an alternate screen for viewing recovery logs.Elliott Hughes1-5/+10
This makes it easier to go back and forth without losing current output. Also make the display more like regular more(1). Bug: http://b/20834540 Change-Id: Icc5703e9c8a378cc7072d8ebb79e34451267ee1b
2015-04-15Don't use typedefs that hide *s.Elliott Hughes1-10/+10
gr_surface was causing confusion for no good reason. Change-Id: If7120187f9a00dd16297877fc49352185a4d4ea6
2015-04-14Move the menu header out of the menu.Elliott Hughes1-2/+7
This makes it easier for us to deal with arbitrary information at the top, and means that headers added by specific commands don't overwrite the default ones. Add the fingerprint back, but broken up so it fits even on sprout's display. Change-Id: Id71da79ab1aa455a611d72756a3100a97ceb4c1c
2015-04-13Remove unnecessary globals.Elliott Hughes1-3/+4
Change-Id: I76a042432aede08ceaf250319cf5eeb25d601150
2015-04-11Rewritten file pager.Elliott Hughes1-1/+6
Most importantly, this one no longer skips lines because of wrapping. Change-Id: Ic1c1944682ab8cbf3d542418ee86d29819173fc9
2015-04-10Fix ScreenRecoveryUI to handle devices without power/up/down.Elliott Hughes1-2/+4
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-09Move file paging into ScreenRecoveryUI.Elliott Hughes1-3/+5
This fixes the N9 performance problem. Change-Id: I00c10d4162ff266a6243285e5a5e768217f6f799
2015-04-09Enable printf format argument checking.Elliott Hughes1-2/+2
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-09Remove the fixed screen size assumptions.Elliott Hughes1-9/+4
Dynamically allocate the text and menu arrays instead. Change-Id: Idbfc3fe4e4b50db4fee62ac2b6a7323cad369749
2014-06-06restore holo UI in recoveryDoug Zongker1-3/+0
Return to the recovery to the holo appearance. Bug: 15424396 Change-Id: Id4d3f23e0a6251a12aa42f3793cff347f38b4243
2014-06-03restore holo UI in recovery -- DO NOT MERGEDoug Zongker1-3/+0
Since we don't have quantum assets for recovery yet, go back to the holo appearance (dark background, blue glowing progress bar) for lmp-preview. Change-Id: Id4d3f23e0a6251a12aa42f3793cff347f38b4243
2014-04-04make density-specific recovery assetsDoug Zongker1-0/+3
Provide different recovery UI resources for different display densities. Right now only the text images and the progress bars are rescaled; the main icon will get scaled when it's updated for QP. Lightly quantum-ify the rest of the recovery interface. (Light background, progress bars, etc.) Change-Id: Ia639c4ce8534b01bc843524efbc4b040c1cf38b3
2014-03-17refactor image resource loading code in minuiDoug Zongker1-0/+1
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-11change how recovery animation is implementedDoug Zongker1-4/+4
Instead of one 'base' installing image and a number of overlay images that are drawn on top of it, we represent the installing animation with one PNG that contains all the animation frames, interlaced by row. The PNG is expected to have a text chunk with the keyword 'Frames' and a value that's the number of frames (as an ascii string). This representation provides better compression, removes the need to subclass ScreenRecoveryUI just to change the position of the overlay or number of frames, and doesn't require gr_blit() to support an alpha channel. We also remove the 'indeterminate' progress bar used when wiping data and/or cache. The main animation serves the same purpose (showing that the device is still alive); the spinning progress bar has been redundant for a while. This changes the default recovery animation to include the antenna-wiggling and gear-turning that's used in the Nexus 5 recovery animation. Change-Id: I51930a76035ac09969a25472f4e572b289418729 Conflicts: screen_ui.cpp screen_ui.h
2014-03-07change how recovery animation is implementedDoug Zongker1-5/+4
Instead of one 'base' installing image and a number of overlay images that are drawn on top of it, we represent the installing animation with one PNG that contains all the animation frames, interlaced by row. The PNG is expected to have a text chunk with the keyword 'Frames' and a value that's the number of frames (as an ascii string). This representation provides better compression, removes the need to subclass ScreenRecoveryUI just to change the position of the overlay or number of frames, and doesn't require gr_blit() to support an alpha channel. We also remove the 'indeterminate' progress bar used when wiping data and/or cache. The main animation serves the same purpose (showing that the device is still alive); the spinning progress bar has been redundant for a while. This changes the default recovery animation to include the antenna-wiggling and gear-turning that's used in the Nexus 5 recovery animation. Change-Id: I51930a76035ac09969a25472f4e572b289418729
2013-11-27add the functions for multi-stage packages to updaterDoug Zongker1-3/+9
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-10-03Allow child classes to override the overlay location for theMichael Runge1-1/+3
update image. b/10952479 Change-Id: I59bb834f271f702fb529054dab7926b816fa35cc
2013-07-31notify about pending long pressDoug Zongker1-0/+5
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-03-07more font improvements and cleanupDoug Zongker1-2/+1
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
2012-09-19localization for recovery messagesDoug Zongker1-0/+2
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/+2
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-2/+4
- 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
2011-11-04move key processing to RecoveryUIDoug Zongker1-23/+6
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-23/+6
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-1/+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-0/+121
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-1/+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-29refactor ui functions into a classDoug Zongker1-0/+121
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