Commit graph

44 commits

Author SHA1 Message Date
Tao Bao
99f0d9e52b Drop -Wno-unused-parameter.
The only one left is libedify. Will handle that in a separate CL.

Test: mmma bootable/recovery
Change-Id: I732a5f85229da90fd767bee2e46c5c95f529c396
2017-10-11 16:56:12 -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
fa4f014063 Merge "wear_ui: Remove Print()/ShowFile()/PutChar()." 2017-09-08 21:44:40 +00:00
Tao Bao
f05e2bcff2 wear_ui: Remove Print()/ShowFile()/PutChar().
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 c049163234 ('Add an alternate
screen for viewing recovery logs.').

Test: Build a wearable target recovery; `View recovery logs`.
Change-Id: Ic9208c42a11c037469f5b073ef7d9b721c14d1f3
2017-09-08 12:22:43 -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
ee8a96a581 wear_ui: Remove PrintOnScreenOnly() and PrintV().
They're just copy/pastes from the base class (ScreenRecoveryUI).

Test: mmma bootable/recovery
Change-Id: I341416107a14d89d3366bba757da0b1abb988b15
2017-09-01 11:51:11 -07:00
Tao Bao
79127102e4 wear_ui: Remove backgroundIcon.
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
2017-08-30 15:32:41 -07:00
Tianjie Xu
c89d1e7e2a Turn on -Wall for recovery modules
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
2017-08-28 21:56:33 -07:00
Tao Bao
e9605b8ca0 Merge "wear_ui: Remove kMaxCols/kMaxRows/visible_text_rows/menu_headers_." 2017-08-28 19:42:12 +00:00
Tao Bao
1e27d14eea wear_ui: Remove kMaxCols/kMaxRows/visible_text_rows/menu_headers_.
We've deprecated kMaxCols/kMaxRows in ScreenRecoveryUI since commit
aa0d6afb61. 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
2017-08-26 08:47:43 -07:00
Tao Bao
cff8269e5c wear_ui: Remove dead 'self' and 'progress_t'.
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 ad8b5a6c11).

Also add the missing include of <pthread.h> for pthread_mutex_lock().

Test: lunch a watch target and `m recoveryimage`.
Change-Id: I748cf4511434ac4ce97dddf89b0e42e68a5da04b
2017-08-26 08:17:36 -07:00
Tao Bao
eea3af3f91 wear_ui: Expose menu_unusable_rows via Makefile var.
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
2017-08-11 13:53:58 -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
0bc54dd83f wear_ui: Remove dead/duplicate codes.
WearRecoveryUI::draw_progress_locked() has declaration only, where
the definition was deleted in commit
5e7cfb9af6.

WearRecoveryUI::ClearText() is a duplicates of
ScreenRecoveryUI::ClearText().

Test: Build swordfish recovery image. 'Run graphics test' and 'View
      recovery logs'.
Change-Id: Ib66955d1d496f04359b4d6487160218e8f954478
2017-06-28 15:32:23 -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
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
Tim Kryger
825b6b0c0b Remove outdated reference to icon_installing.png
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 48be23c8ed)
2017-01-03 16:28:13 -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
Elliott Hughes
130f6c86f5 resolve merge conflicts of d5c7d6b to nyc-mr1-dev-plus-aosp
Change-Id: Ia041044547351a3e65b647bb9913aa18c7d2c97c
2016-09-26 12:53:52 -07:00
Elliott Hughes
cb22040c63 Switch to <android-base/properties.h>.
Bug: http://b/23102347
Test: boot into recovery.
Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e
Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
2016-09-26 09:51:37 -07:00
Elliott Hughes
bd76bb0aa8 resolve merge conflicts of ad8b5a6 to nyc-mr1-dev-plus-aosp
Change-Id: Ib1453d1bf3c6b83ef47a383d9d171b1059240477
2016-09-09 14:23:31 -07:00
Damien Bargiacchi
ad8b5a6c11 Remove duplicate thread loop
Fixes animation running at 2x speed

Change-Id: Ieec353097b6eee1cf40530e6f4f1e69927d2bc98
2016-09-09 08:22:49 -07:00
Damien Bargiacchi
49e2aeb353 Remove duplicate methods and variables from WearRecoveryUI
am: 5e7cfb9af6

Change-Id: I0f4dda0f92dcb6b3a230d2ad5d26f9855acb8c82
2016-09-07 23:38:24 +00: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
Damien Bargiacchi
e3c7184911 Support use of custom fonts in miniui
am: 35fff61b1c

Change-Id: Iac50e95c15c0b4337435d47d3666c2aaf5eb203d
2016-08-24 20:45:14 +00:00
Damien Bargiacchi
35fff61b1c Support use of custom fonts in miniui
Bug: 29547343
Change-Id: I398160c85daac90ffab2fa9bb2e96795b9e9885a
2016-08-18 19:51:45 -07:00
Alain Vongsouvanh
2a697feb39 resolve merge conflicts of 6aa6ddb to nyc-dev
am: 771b6eb8d9

Change-Id: Ie0dabf5fb0930b75117193ae31e73df62d885903
2016-06-08 15:46:40 +00:00
Alain Vongsouvanh
771b6eb8d9 resolve merge conflicts of 6aa6ddb to nyc-dev
Change-Id: I3696fe3e86e0222c7c26b0aa2bf1dd8e03ac5315
2016-06-08 08:30:48 -07:00
Alain Vongsouvanh
5b00110e3d recovery: Make wear recovery more customizable.
Making animation_fps protected and adding support for 0 frames intro.

BUG: 29085786
Change-Id: I07b44570022bad89661973178d453592c01f3f10
2016-06-07 10:05:29 -07:00
Chih-hung Hsieh
0231e7016d Merge "Fix google-runtime-int warnings." am: a1f4a1e
am: bcad1d1

* commit 'bcad1d1ced730478c94f951034d252e777661332':
  Fix google-runtime-int warnings.

Change-Id: Ifad31026502e3375f4833899056662da540319b5
2016-04-18 22:34:41 +00:00
Chih-Hung Hsieh
54a2747ef3 Fix google-runtime-int warnings.
Bug: 28220065
Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
2016-04-18 12:29:30 -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
Prashant Malani
7d9fd96dc9 recovery: Begin refactor of WearUI to use ScreenRecoveryUI
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
2016-03-08 14:37:49 -08:00
Prashant Malani
0eb41c3f37 Fixes to wear recovery for N
Bug: 27336841

Change-Id: If4632e9791cce2c39590a4012687271f59a60af1
2016-02-26 17:01:37 -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
Elliott Hughes
4b166f0e69 Track rename from base/ to android-base/.
Change-Id: I354a8c424d340a9abe21fd716a4ee0d3b177d86f
2015-12-04 15:30:20 -08:00
Tao Bao
8e9c68019f recovery: Fix the bug that truncates menu entries.
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
2015-09-02 14:38:23 -07:00
Tao Bao
337db14f27 recovery: Factor out wear_ui.{cpp,h} into bootable/recovery.
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
2015-08-24 17:31:47 -07:00