summaryrefslogtreecommitdiffstats
path: root/wear_ui.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move librecovery_ui to a sub-directoryTianjie Xu2019-03-211-108/+0
| | | | | | | | This helps to expose librecovery_ui for device specific RecoveryUi. Bug: 76436783 Test: mma, unit tests pass Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
* ui: Manage loaded resources with smart pointers.Tao Bao2018-11-051-3/+3
| | | | | | Test: Run recovery_unit_test on marlin. Test: `Run graphics test` on marlin. Change-Id: I8239c3d9fb288f80ee11f615402768ff8ef8ecd0
* Add function to show localized rescue party menuTianjie Xu2018-10-231-7/+8
| | | | | | | | | | | | | 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
* Implement the graphic menusTianjie Xu2018-10-131-3/+4
| | | | | | | | | | | | | | | | | | 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
* ui: Read custom recovery UI values via system property.Tao Bao2018-08-011-5/+10
| | | | | | | | | | | | | | | 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
* Updates Wear UI to Display Localized Recovery Text.Karl Shaffer2018-07-201-0/+7
| | | | | | | | | | Updates Wear Recovery UI to fix bug. Recovery UI now will display the proper Recovery Text during progress actions above the ProgressBarBaseline as defined in device make files. Change-Id: Idef0cb046dd06979042ca877ba0c61e9faaedec1 Bug: 64330124 (cherry picked from commit 19f6cccdafe53e14b9cd083e69da5887028070a0)
* recovery: c++ify pthread use in UIJerry Zhang2018-05-301-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
* wear_ui: Address a TODO regarding {intro,loop}_frames.Tao Bao2018-05-141-5/+0
| | | | | | | Also add tests for LoadAnimation that cover the change. Test: Run `recovery_unit_test` on marlin. Change-Id: I0380a5cdd0d85d55baecf7759eb647b6a9f3a085
* Move menu headers/items to std::vector<std::string>.Tao Bao2018-05-031-3/+3
| | | | | | | | | 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
* screen_ui: Merge Menu::Start() into its ctor.Tao Bao2018-05-031-2/+1
| | | | | | | | | | | 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
* screen_ui: Use std::string in DrawTextLine() and siblings.Tao Bao2018-05-031-8/+8
| | | | | | | 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
* Factor out a menu class for screen uiTianjie Xu2018-03-241-107/+9
| | | | | | | | | | | 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
* Drop -Wno-unused-parameter.Tao Bao2017-10-121-2/+1
| | | | | | | The only one left is libedify. Will handle that in a separate CL. Test: mmma bootable/recovery Change-Id: I732a5f85229da90fd767bee2e46c5c95f529c396
* ui: Remove text_top_.Tao Bao2017-09-091-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
* Merge "wear_ui: Remove Print()/ShowFile()/PutChar()."Tao Bao2017-09-081-113/+1
|\
| * wear_ui: Remove Print()/ShowFile()/PutChar().Tao Bao2017-09-081-113/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | They're mostly identical to the ones in ScreenRecoveryUI, except for the (legacy) use of 'text_top_'. Because wear_ui.cpp misses the change in [1] that uses an alternate screen for viewing recovery logs. Also clean up the included headers. [1] commit c049163234003ef463bca018920622bc8269c69b ('Add an alternate screen for viewing recovery logs.'). Test: Build a wearable target recovery; `View recovery logs`. Change-Id: Ic9208c42a11c037469f5b073ef7d9b721c14d1f3
* | ui: Manage menu_ with std::vector.Tao Bao2017-09-081-7/+6
|/ | | | | | | | | | | | | 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
* wear_ui: Remove PrintOnScreenOnly() and PrintV().Tao Bao2017-09-011-33/+1
| | | | | | | They're just copy/pastes from the base class (ScreenRecoveryUI). Test: mmma bootable/recovery Change-Id: I341416107a14d89d3366bba757da0b1abb988b15
* wear_ui: Remove backgroundIcon.Tao Bao2017-08-311-34/+6
| | | | | | | | | | | It's covered by the equivalent variable in ScreenRecoveryUI: GRSurface* error_icon; Also refactor WearRecoveryUI::draw_background_locked() to get it closer to ScreenRecoveryUI code. Test: Build a wearable target recovery; Run graphics test. Change-Id: I3a8d0e4dbf6fe170e4f3adde7eaf4a2043132a57
* Turn on -Wall for recovery modulesTianjie Xu2017-08-291-8/+0
| | | | | | | | | | | | | Turn on -Wall for all modules. Also remove the obsolete file_cmp() in apply_patch test and now() in wear_ui. The only exception is lib_edify due to the unused functions in the intermediate cpp files generated from the lex files. It will be handled in a seperate CL. Bug: 64939312 Test: mma, unit tests pass Change-Id: Ic53f76b60b6401ab20db3d98130d674c08e3702f
* Merge "wear_ui: Remove kMaxCols/kMaxRows/visible_text_rows/menu_headers_."Tao Bao2017-08-281-15/+1
|\
| * wear_ui: Remove kMaxCols/kMaxRows/visible_text_rows/menu_headers_.Tao Bao2017-08-261-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | We've deprecated kMaxCols/kMaxRows in ScreenRecoveryUI since commit aa0d6afb61f4cf928e87c7a21bcb59fc973f15a0. They unnecessarily limit the screen size to 96x96 characters. Also remove the recomputations of text_cols, visible_text_rows (which is the same as text_rows_). Remove the unintentional hiding of menu_headers_. Test: mmma bootable/recovery Change-Id: I7d1526b651943312d62d52cd200414b42bf9b12a
* | wear_ui: Remove dead 'self' and 'progress_t'.Tao Bao2017-08-261-7/+1
|/ | | | | | | | | | | They were once used for progress_thread() that's pthread_create'd by WearRecoveryUI::Init(). They have become dead since the removal of progress_thread() (commit ad8b5a6c1195b94d8d80671e1bf791c32008fbef). Also add the missing include of <pthread.h> for pthread_mutex_lock(). Test: lunch a watch target and `m recoveryimage`. Change-Id: I748cf4511434ac4ce97dddf89b0e42e68a5da04b
* wear_ui: Expose menu_unusable_rows via Makefile var.Tao Bao2017-08-111-3/+4
| | | | | | | | | | | | This variable is useful on small screens (e.g. on watches) to handle long menus. We should have better way to handle this value smartly. Prior to that, expose the value to be overridable by using the generic wearable UI module (librecovery_ui_wear). Bug: 64307776 Test: Define the variable, build and boot into recovery image and check the UI menu. Change-Id: I5d7a6baa8bb4cc852bfcc2a7b3cc9686c1c8817e
* Allow customizing WearRecoveryUI via Makefile variables.Tao Bao2017-08-101-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update ScreenRecoveryUI::Draw* function signatures.Tao Bao2017-07-021-5/+5
| | | | | | | | 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
* wear_ui: Remove dead/duplicate codes.Tao Bao2017-06-291-11/+0
| | | | | | | | | | | | | WearRecoveryUI::draw_progress_locked() has declaration only, where the definition was deleted in commit 5e7cfb9af64d5f6bf616d9b6fa40bd0ae82e781a. WearRecoveryUI::ClearText() is a duplicates of ScreenRecoveryUI::ClearText(). Test: Build swordfish recovery image. 'Run graphics test' and 'View recovery logs'. Change-Id: Ib66955d1d496f04359b4d6487160218e8f954478
* Add override specifier and member constness to RecoveryUI classes.Tao Bao2017-06-241-1/+1
| | | | | Test: mmma bootable/recovery Change-Id: I66e328614423488a4027d7878f4569fbf3a3721e
* Formatting RecoveryUI related files.Tao Bao2017-06-241-256/+247
| | | | | | | All cosmetic changes about indentation reformatting in this CL. Test: mmma bootable/recovery Change-Id: I4539e6244697d1f356b7eb10b961b52d7db561f7
* minui: Export minui/minui.h.Tao Bao2017-01-171-3/+5
| | | | | | | For libminui static and shared libraries. Test: build Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16
* recovery: Fix the broken UI text.Tao Bao2017-01-041-36/+35
| | | | | | | | | | | | | | | 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
* Remove outdated reference to icon_installing.pngTim Kryger2017-01-041-2/+4
| | | | | | | | | | | | The Wear recovery UI doesn't draw the installing icon but it was still trying to open it. Ever since these images were removed eight months ago, this has resulted in an error printing to the screen at runtime. Since the image wasn't really used, the lines to open it can simply be removed. Bug: 33203397 Change-Id: Id820f6d75e316c51d19b6095df407ecd61c0410e (cherry picked from commit 48be23c8ed0bcceda1abd80e1df4d1abc20f042f)
* Add a stub recovery UI.Sen Jiang2016-12-131-4/+10
| | | | | | | | | | | 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
* resolve merge conflicts of d5c7d6b to nyc-mr1-dev-plus-aospElliott Hughes2016-09-261-3/+3
|\ | | | | | | Change-Id: Ia041044547351a3e65b647bb9913aa18c7d2c97c
| * Switch to <android-base/properties.h>.Elliott Hughes2016-09-261-3/+3
| | | | | | | | | | | | | | Bug: http://b/23102347 Test: boot into recovery. Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
* | resolve merge conflicts of ad8b5a6 to nyc-mr1-dev-plus-aospElliott Hughes2016-09-091-52/+4
|\ \ | | | | | | | | | Change-Id: Ib1453d1bf3c6b83ef47a383d9d171b1059240477
| * | Remove duplicate thread loopDamien Bargiacchi2016-09-091-52/+4
| | | | | | | | | | | | | | | | | | Fixes animation running at 2x speed Change-Id: Ieec353097b6eee1cf40530e6f4f1e69927d2bc98
* | | Remove duplicate methods and variables from WearRecoveryUIDamien Bargiacchi2016-09-081-236/+77
|\| | | | | | | | | | | | | | | | | am: 5e7cfb9af6 Change-Id: I0f4dda0f92dcb6b3a230d2ad5d26f9855acb8c82
| * | Remove duplicate methods and variables from WearRecoveryUIDamien Bargiacchi2016-09-071-236/+77
| | | | | | | | | | | | | | | | | | | | | | | | Copy pasta is never as delicious as ones hopes. Also fix the Pike not rendering recovery bug. Change-Id: I903da7da436e3347a22ff51633e8a0f28fea2c46
* | | Support use of custom fonts in miniuiDamien Bargiacchi2016-08-241-6/+6
|\| | | |/ |/| | | | | | | am: 35fff61b1c Change-Id: Iac50e95c15c0b4337435d47d3666c2aaf5eb203d
| * Support use of custom fonts in miniuiDamien Bargiacchi2016-08-191-6/+6
| | | | | | | | | | Bug: 29547343 Change-Id: I398160c85daac90ffab2fa9bb2e96795b9e9885a
* | resolve merge conflicts of 6aa6ddb to nyc-devAlain Vongsouvanh2016-06-081-1/+1
|\| | | | | | | | | | | am: 771b6eb8d9 Change-Id: Ie0dabf5fb0930b75117193ae31e73df62d885903
| * resolve merge conflicts of 6aa6ddb to nyc-devAlain Vongsouvanh2016-06-081-1/+1
| |\ | | | | | | | | | Change-Id: I3696fe3e86e0222c7c26b0aa2bf1dd8e03ac5315
| | * recovery: Make wear recovery more customizable.Alain Vongsouvanh2016-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | Making animation_fps protected and adding support for 0 frames intro. BUG: 29085786 Change-Id: I07b44570022bad89661973178d453592c01f3f10
* | | Merge "Fix google-runtime-int warnings." am: a1f4a1eChih-hung Hsieh2016-04-191-5/+5
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | am: bcad1d1 * commit 'bcad1d1ced730478c94f951034d252e777661332': Fix google-runtime-int warnings. Change-Id: Ifad31026502e3375f4833899056662da540319b5
| * | Fix google-runtime-int warnings.Chih-Hung Hsieh2016-04-181-5/+5
| | | | | | | | | | | | | | | Bug: 28220065 Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
* | | recovery: Remove SetColor, and other refactoring for WearUIPrashant Malani2016-03-121-47/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | recovery: Remove duplicate variables and functionsPrashant Malani2016-03-111-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Revert "recovery: More refactoring of WearUI"Prashant Malani2016-03-101-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | recovery: More refactoring of WearUIPrashant Malani2016-03-091-69/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | recovery: Begin refactor of WearUI to use ScreenRecoveryUIPrashant Malani2016-03-081-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first of a series of changes which move WearUI to subclass ScreenRecoveryUI, to take advantage of several functions which are common between the two recovery UI implementations, and already defined in ScreenRecoveryUI. This patch changes the base class of WearUI, removes redundant header includes, and also removes a common function. Bug: 27407422 Change-Id: I8fd90826900f69272a82e23bd099790e8004d511
* | | Fixes to wear recovery for NPrashant Malani2016-02-271-0/+33
|/ / | | | | | | | | | | Bug: 27336841 Change-Id: If4632e9791cce2c39590a4012687271f59a60af1
* | res: Embed FPS into icon_installing.png.Tao Bao2015-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Track rename from base/ to android-base/.Elliott Hughes2015-12-051-1/+1
|/ | | | Change-Id: I354a8c424d340a9abe21fd716a4ee0d3b177d86f
* recovery: Fix the bug that truncates menu entries.Tao Bao2015-09-021-1/+6
| | | | | | | | | | | When there are 20 entries (like 10 last_log* and 10 last_kmg* in "view recovery logs"), there's no "Back" entry. Because the number of entries (21) exceeds text_rows (20) in WearRecoveryUI::StartMenu(). Since we have scrollable menu, having more entries than text_rows won't be an issue. Bug: 23752519 Change-Id: I12573d7a34852a1a3d130c9e88522cee737eb08f
* recovery: Factor out wear_ui.{cpp,h} into bootable/recovery.Tao Bao2015-08-251-0/+650
Every watch has a (mostly identical) copy of the wear_ui. Factor them out into a single copy for easier maintenance. Device-specific settings should be defined in recovery_ui.cpp that inherits WearRecoveryUI class. Bug: 22451422 Change-Id: Id07efca37d1b1d330e6327506c7b73ccf6ae9241