Commit graph

59 commits

Author SHA1 Message Date
Tao Bao
efb49add97 ui: Move locale and friends into ScreenRecoveryUI class.
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-11 12:19:32 -07:00
Tao Bao
568644197f Merge "ui: Remove text_top_." 2017-09-11 19:06:12 +00:00
Tao Bao
7577965ba1 ui: Refactor the declaration orders.
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-10 11:36:54 -07:00
Tao Bao
cb5524c23a ui: Remove text_top_.
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-08 23:31:31 -07:00
Tao Bao
e15d7a5104 ui: Manage menu_ with std::vector.
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-09-08 10:50:07 -07:00
Tao Bao
89ad02206a Merge changes I5d7a6baa,Id0fb2d4e
* changes:
  wear_ui: Expose menu_unusable_rows via Makefile var.
  Allow customizing WearRecoveryUI via Makefile variables.
2017-08-22 17:44:16 +00:00
Tao Bao
2bbc6d642d screen_ui: Word-wrap menu headers.
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-15 15:10:21 -07:00
Tao Bao
0470ceea38 Allow customizing WearRecoveryUI via Makefile variables.
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
2017-08-10 09:31:17 -07:00
Tao Bao
ea78d86b44 Update ScreenRecoveryUI::Draw* function signatures.
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-07-01 17:41:24 -07:00
Tao Bao
99b2d77475 Add override specifier and member constness to RecoveryUI classes.
Test: mmma bootable/recovery
Change-Id: I66e328614423488a4027d7878f4569fbf3a3721e
2017-06-23 23:06:01 -07:00
Tao Bao
5d2e3bd109 Formatting RecoveryUI related files.
All cosmetic changes about indentation reformatting in this CL.

Test: mmma bootable/recovery
Change-Id: I4539e6244697d1f356b7eb10b961b52d7db561f7
2017-06-23 23:05:56 -07:00
Luke Song
9d4839c60f Restructure vr_ui
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)
2017-06-23 16:51:00 -07:00
Tao Bao
4521b7027f Use Makefile variables to specify margin settings.
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 a92d8fb456)
2017-06-23 09:22:34 -07:00
Tao Bao
171b4c4cbe screen_ui: Allow setting screen margin space.
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 87f4650874)
2017-06-20 15:47:06 -07:00
Luke Song
e2bd876043 Introduce VR recovery ui
A version of screen ui with specific adjustments for vr device
compatibility.

(cherrypick of a44dba7f4e to AOSP)

Bug: 37779982
Test: "adb reboot recovery" to view
Change-Id: If6b0f26c1b587f8d0176060685b5efb6c67593b1
2017-06-16 15:33:02 -07:00
Mikhail Lappo
b49767c0ba Const modifiers
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-03-23 21:52:30 +01:00
Tao Bao
0ecbd76b22 minui: Export minui/minui.h.
For libminui static and shared libraries.

Test: build
Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16
2017-01-16 21:28:18 -08:00
Tao Bao
736d59c567 recovery: Fix the broken UI text.
UI text is broken (doesn't show any text during FDR) due to commit
d530449e54, 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
2017-01-03 22:40:03 -08:00
Sen Jiang
d530449e54 Add a stub recovery UI.
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-12-13 13:29:33 -08:00
Damien Bargiacchi
5e7cfb9af6 Remove duplicate methods and variables from WearRecoveryUI
Copy pasta is never as delicious as ones hopes.

Also fix the Pike not rendering recovery bug.

Change-Id: I903da7da436e3347a22ff51633e8a0f28fea2c46
2016-09-07 02:26:50 -07:00
Elliott Hughes
6d089a955f Support landscape layouts.
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-07-08 18:21:45 -07:00
Tianjie Xu
35926c4b89 Add ability to show "installing security update"
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-29 12:19:43 -07:00
Elliott Hughes
faf36e04ed Update recovery UI.
* Use new animation.
* Use new non-holo progress bars.
* Use recommended spacing for recovery UI.

Bug: http://b/26548285
Change-Id: I8411e89d6a6a9ce638b8645e19e5082d0d968cee
2016-04-27 14:46:01 -07:00
Elliott Hughes
498cda6ef6 Update the system update animation.
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-04-14 22:44:23 -07:00
Prashant Malani
7a491225bb recovery: Remove SetColor, and other refactoring for WearUI
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-11 15:22:20 -08:00
Prashant Malani
0ba21cff07 recovery: Remove duplicate variables and functions
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-10 15:36:31 -08:00
Prashant Malani
f7f9e50528 Revert "recovery: More refactoring of WearUI"
This reverts commit 1c7b2230d8.

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-10 03:40:20 +00:00
Prashant Malani
1c7b2230d8 recovery: More refactoring of WearUI
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>
2016-03-08 15:56:54 -08:00
Tao Bao
b723f4f38f res: Embed FPS into icon_installing.png.
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-12-16 11:35:52 -08:00
Tao Bao
b6918c7c43 Log update outputs in order
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-06-02 22:15:40 -07:00
Elliott Hughes
c049163234 Add an alternate screen for viewing recovery logs.
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-05-06 21:17:05 -07:00
Elliott Hughes
0a5cb0c7cd Don't use typedefs that hide *s.
gr_surface was causing confusion for no good reason.

Change-Id: If7120187f9a00dd16297877fc49352185a4d4ea6
2015-04-15 10:58:56 -07:00
Elliott Hughes
8fd86d77f1 Move the menu header out of the menu.
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-13 15:46:15 -07:00
Elliott Hughes
985022a623 Remove unnecessary globals.
Change-Id: I76a042432aede08ceaf250319cf5eeb25d601150
2015-04-13 13:04:32 -07:00
Elliott Hughes
95fc63e87b Rewritten file pager.
Most importantly, this one no longer skips lines because of wrapping.

Change-Id: Ic1c1944682ab8cbf3d542418ee86d29819173fc9
2015-04-10 19:12:01 -07:00
Elliott Hughes
642aaa7a3e Fix ScreenRecoveryUI to handle devices without power/up/down.
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-10 12:47:46 -07:00
Elliott Hughes
8de52078a4 Move file paging into ScreenRecoveryUI.
This fixes the N9 performance problem.

Change-Id: I00c10d4162ff266a6243285e5a5e768217f6f799
2015-04-08 20:06:50 -07:00
Elliott Hughes
018ed31c51 Enable printf format argument checking.
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-08 16:56:17 -07:00
Elliott Hughes
aa0d6afb61 Remove the fixed screen size assumptions.
Dynamically allocate the text and menu arrays instead.

Change-Id: Idbfc3fe4e4b50db4fee62ac2b6a7323cad369749
2015-04-08 16:16:52 -07:00
Doug Zongker
5b5f6c2fd3 restore holo UI in recovery
Return to the recovery to the holo appearance.

Bug: 15424396
Change-Id: Id4d3f23e0a6251a12aa42f3793cff347f38b4243
2014-06-06 09:01:57 -07:00
Bill Yi
ff5fc6c809 am ddaaccb3: am 29759e9d: Merge commit \'25c2b2f670a3b11f7ce78eccde10c1a79188c9a8\' into HEAD
* commit 'ddaaccb3db623ff6f19b7dadf51d41cc46bb05c3':
2014-04-30 00:52:59 +00:00
Doug Zongker
9551cf9121 make density-specific recovery assets
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-04-04 13:48:33 -07:00
Doug Zongker
a68c517c62 am 80c1a386: resolved conflicts for merge of d90da130 to klp-modular-dev-plus-aosp
* commit '80c1a386d3f614919708b37986919ecaf74ee738':
  refactor image resource loading code in minui
2014-03-17 23:33:14 +00:00
Doug Zongker
c4025e90f4 resolved conflicts for merge of d90da130 to klp-dev-plus-aosp
Change-Id: I19f9f460145fdcf5cdc58ee4fa25ff3c9ba398f0
2014-03-17 16:13:08 -07:00
Doug Zongker
80c1a386d3 resolved conflicts for merge of d90da130 to klp-modular-dev-plus-aosp
Change-Id: Ib95b5bcd8d24014e1f2a956d2f31c99a471d3e30
2014-03-17 16:11:02 -07:00
Doug Zongker
a418aa7dd5 refactor image resource loading code in minui
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-17 12:27:08 -07:00
Doug Zongker
cfcec9e1d4 Merge commit 'ea868b38' into manualmerge
Conflicts:
	screen_ui.cpp
	screen_ui.h

Change-Id: Iefe7dde04cc76639f56730a19238436073f18ffb
2014-03-13 08:44:07 -07:00
Doug Zongker
c15b7865ba resolved conflicts for merge of ea868b38 to klp-modular-dev-plus-aosp
Change-Id: I8cc3b8101bccf7fd697f9a7b73732d1000dc27a1
2014-03-11 19:39:26 -07:00
Doug Zongker
469954fe3d change how recovery animation is implemented
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-11 14:06:35 -07:00
Doug Zongker
eac881c952 change how recovery animation is implemented
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
2014-03-07 09:45:44 -08:00