fastbootd looks too much like recovery, even if you're carefully reading
the menu. It's not obvious the device is in a flashing mode, and it's
too tempting to reboot or unplug the device in this state.
As a first step, this patch adds a big red "fastbootd" logo so it's less
obviously in recovery mode.
Bug: 120429730
Test: manual test
Change-Id: I73359f1fdfdc0b1694993f760fe7f35c5713b24e
After we generate the localized confirmation text images for certain dpi,
we can now load these images and display them under recovery. Devices that
cannot load the images will use the backup text strings as before.
Bug: 74397117
Test: check the menu with multiple locales, and check all the images locally
with locale test, check the fall back strings.
Change-Id: Ic31a55670026c909ec7a05cb0bb4a0fc1d5d15c7
GRSurface::Create() doesn't need to rely on caller specifying the buffer
size, as it can compute that info based on the given args.
This CL also uses `size_t` for all the parameters in
GRSurface::Create().
Test: Run recovery_unit_test on marlin.
Test: Build and boot into blueline recovery. `Run graphics test`.
Test: Build and boot into blueline charger mode.
Change-Id: Idec9381079196abf13553a475006fefcfca10950
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
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
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
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
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
gr_init() does general initialization works, in addition to loading font
file. InitTextParams() handles text related works.
Also check the font initialization result before using, as gr_init()
would ignore font initialization failures.
Test: recovery_unit_test on marlin.
Test: Boot into recovery. Run graphics test.
Change-Id: I12da22dfe8d13448cfbc83dbc51cd96f23c2deee
ScreenRecoveryUI calls gr_init() during Init(), and should release any
allocated resource upon destructing. It's a no-op to call gr_exit() if
gr_init() was not called or didn't finish successfully.
Test: recovery_unit_test on marlin.
Test: Boot into recovery. Run graphics test.
Change-Id: Ib9632170174cdacd51d382f23c8daf6a9bc59f7a
The threads in RecoveryUI only get initialized if their Init()s finish
successfully.
Test: recovery_unit_test on marlin.
Change-Id: Ic4b62300a3cbd47887d9f4a90dc26f8a7deab616
Test: Build and boot into recovery on walleye. Check the long press
detection; `Run graphics test`.
Change-Id: Ic3e9b0652fc3ff6fb3ad118df5ebb9bb4abda2cd
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
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
The CL in [1] moved android.os.RecoverySystem to send the locale
argument in well-formed BCP 47 language tags (e.g. "en-US" instead of
"en_US"), with the matching changes to recovery code in [2]. However,
the one in ScreenRecoveryUI::SetLocale() was missed, which broke RTL
locale detection when using new format.
[1] commit 38715228 in platform/frameworks/base
[2] commit 2078b22e in platform/bootable/recovery
Test: Set the locale to "ar-EG". `Run graphics test` under recovery.
Check the progress bar.
Test: Run recovery_unit_test on marlin.
Change-Id: I7c7f5e0725bfb096109c7192c19f3f008e8e47e3
In order to support that, this CL adds Paths::set_resource_dir() to
override the default resource dir ("/res/images/") that's only available
under recovery. Note that since there're external modules depending on
libminui, it adds a separate function of res_set_resource_dir(), instead
of requiring the dependency on libotautil for everyone.
Test: mmma -j bootable/recovery
Test: Run recovery_unit_test on marlin.
Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
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
This removes some reliance on the global
locale and ui variables.
Test: Recovery works
Bug: 78793464
Change-Id: I78f1a2b321f5d50aa58b10735a73ae137283353a
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
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
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
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
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
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
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
Localized texts only make sense on devices with screens.
Test: Run fake OTA on angler; check the on-screen texts.
Change-Id: I3a644294c8b1f2056cfb78b2d61a598b8ddf2acf
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
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
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
ScreenRecoveryUI::DrawWrappedTextLines() should be called with
kMarginWidth only. Because it's using a line limit of text_cols_,
which is unaware of kMenuIdent.
Bug: 64293520
Test: No missing char with long header text.
Change-Id: Ib4d08de2c56473a483ff9964eb6cec31f8a74c9a
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
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 5f8dd9951d.
Bug: 64307776
Test: Change the device BoardConfig.mk and test recovery image.
Change-Id: Id0fb2d4e3977ab5ddd31e71f9535470cab70e41b
This is a regression when adding support for margin space in commit
171b4c4c.
We're losing one char when showing long log lines. Because text_ is
aware of kMarginWidth, but not the the added indent (TEXT_INDENT).
Test: 'View recovery logs' on angler, with no missing character.
Change-Id: I284d54681d603e85e69d8e9c25173b1437a704df
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
We're not actually following the gaps as in the comments. For example,
Nexus 6P is supposed to use 220dp and 194dp gaps (top and bottom
respectively), but the actual numbers are 185dp and 194dp. Because the
animation icon and text sizes don't match the ones claimed (animation:
expected 200dp or 700px, actual 800px; text: claimed 14sp, actual 76px).
The top gap changes (shrinks) as we compute the baselines bottom-up.
This CL switches to using computed gaps: the major UI elements always
stay vertically centered, with identical top and bottom gaps.
Bug: 63093285
Test: 'Run graphics test' on angler/volantis/fugu/ryu.
Change-Id: I3cadbb34f728cf034afa47ac02a6deba8cb6b4e7
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 81a8e4cab2)