Commit graph

229 commits

Author SHA1 Message Date
Tianjie Xu
ccf00a2007 minui: Handle the failures from the drm backend in gr_init
In a charger mode manual test, we encounter failures from the
MinuiBackendDrm when calling DrmEnableCrtc and Flip. To make the minui
more robust, we should fall back to another backend if drm's SetCrtc
fails. And check the value of gr_draw before dereferencing.

Bug: 80249440
Test: boot to recovery
Change-Id: Ibd1ca1fb1115fe1132684586c54eccd8fb4c3ad9
2018-06-05 17:10:23 -07:00
Tianjie Xu
842f2a3dca Let gr_init proceed even if we failed to load a font file
Some users of minui don't need to draw texts; and we should let them
still be able to use the library without providing a font file. Also add
check for null pointers in gr_measure() and gr_font_size().

Bug: 80535212
Test: boot into recovery without a font file, and the buttons still work
Change-Id: I848e4410f2ce09ea0ab433573e6827b7e9b2c575
2018-05-31 21:42:58 -07:00
Tao Bao
6cd816859e tests: Add tests for ScreenRecoveryUI.
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
2018-05-08 15:53:56 -07:00
Tao Bao
3d0cd1d036 Expose PngHandler via resources.h.
As a private header for testing purpose. PngHandler additionally loads a
given filename if the one with '/res/images' prefix is not available. It
also provides color_type/bit_depth that are parsed from the PNG file.

This allows reusing the same code for the ResourcesTest (renamed from
ResourceTest).

Test: Run recovery_manual_test on marlin.
Change-Id: I3f939d79a1cb1b83a899847dbe2d51bde15d16d8
2018-04-13 15:25:50 -07:00
Tianjie Xu
55a2c4eaae Remove the obsolete mkfont.c and font_10x18.h
The font_10x18.h is used as a fall back for fonts if the
$(recovery_font) under bootable/recovery/fonts failed to reload. This
font looks very small on the screen and we haven't used it in a while.
Plus, fonts in header doesn't have many benefits if we support only
ascii characters. So we decide to remove this header along with the mkfont.c
that generates the header.

For reference, here's the steps to use mkfont:
1. Generate a picture of fonts with apps on host
2. Open the pic with GIMP
3. Export the pic as '.c' file, and rename it into '.h' file
4. Compile the generated '.h' file with mkfont.c

Bug: 76420958
Test: build and check the recovery menu on angler
Change-Id: I6c108aa43a07bf4994115ef764275bd84df725e1
2018-03-30 06:42:35 +00:00
Elliott Hughes
1d65c95fe8 StartsWith allows a std::string prefix now.
Bug: N/A
Test: builds
Change-Id: I5183ec8133f5dc9a81a438223c6d3d2ea11ef0ec
2017-12-20 12:36:31 -08:00
Dan Willemsen
2ee9266827 libdrm_platform is now libdrm
Since it's converted to Soong and is using vendor_available.

Test: mmma bootable/recovery
Change-Id: I57b40c26abc2f6031241de893b3184ed1283e1fe
2017-10-19 22:30:57 -07:00
Jiyong Park
647e396445 Build libminui with BOARD_VNDK_VERSION
Use libdrm_platform which is a platform variant of libdrm.

Bug: 63741047
Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j libminui
Test: ryu recovery graphics test shows various graphics
Change-Id: Ifd2c1432781a96538585cdf818aa728d628a2f5a
Merged-In: Ifd2c1432781a96538585cdf818aa728d628a2f5a
2017-10-19 16:45:23 -07:00
Tao Bao
a0e9742796 Merge "Drop -Wno-unused-parameter." 2017-10-12 03:22:17 +00:00
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
Dan Albert
c8686b493c Add missing includes.
Test: mma
Bug: None
Change-Id: I8b588dfbc00ef67557622d44700b331c7a31bde3
2017-10-11 11:47:54 -07:00
Tao Bao
9baa19012a Merge "graphics: add rotation logic" 2017-10-05 19:00:50 +00:00
Tianjie Xu
acba38c288 Move the png open and destroy functions into a class
The open_png() function used to open the png file but didn't close it;
and this caused the leak of fd. However, we cannot close the file inside
open_png() because the png file needs to remain open until the outer
function finishes parsing the file and destroys the png struct.

This CL addresses this issue by implementing a PngReader class to handle
the creation/destruction of the png struct.

Bug: 67010912
Test: Run graphic tests; also run locale tests and check fd.
Change-Id: I9a803b3cd8c16f16a9ffe8f0acc7fe0f42e95eb0
2017-09-28 15:29:37 -07:00
Luke Song
846012fc44 graphics: add rotation logic
Bug: 65556996
Bug: 63541890
Test: Tried 4 rotations, viewed logs and graphics test
Change-Id: I2a6c18c28df03f0461663f63bf16db32c45211ec
2017-09-28 14:11:35 -07:00
Tianjie Xu
29d5575fa8 Add a new option in recovery menu to test the background texts
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-27 00:27:38 -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
5daa000068 Merge "ui: Move the support for touch inputs into RecoveryUI."
am: faa5b1f773

Change-Id: Id81f4dca012f5af9000409e93c76a176f4f5b4d3
2017-08-03 18:24:22 +00:00
Tao Bao
5f8dd9951d ui: Move the support for touch inputs into RecoveryUI.
- Added detection for EV_ABS events in minui/events.cpp, if it's
  allowed;
- Added listening and processing touch inputs in ui.cpp;
- Fixed an issue in recognizing swipe with multi-touch protocol A;
- Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It
  now allows turning on text mode with <power> + <swipe-up>.

The last change also fixed an issue on devices with protocol A: prior
to this CL, user may accidentally toggle the text mode during an OTA.
Because it was considered as a single-button device, a long tap that
sent BTN_TOUCH event would turn on text mode.

Test: Allow detecting touch inputs. Swiping (up, down, enter) works on
      angler, angelfish, dorado respectively.
Bug: 36169090
Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd
2017-08-01 18:30:48 -07:00
Tianjie Xu
6d8827e0d3 Merge "Fix the android-cloexec-* warnings in bootable/recovery"
am: 94a8ea1797

Change-Id: I57ae57bab58f603540654bb24df9facca9a7d625
2017-07-19 23:06:50 +00:00
Tianjie Xu
de6735e80c Fix the android-cloexec-* warnings in bootable/recovery
Add the O_CLOEXEC or 'e' accordingly.

Bug: 63510015
Test: recovery tests pass
Change-Id: I7094bcc6af22c9687eb535116b2ca6a59178b303
2017-07-19 12:17:41 -07:00
Tao Bao
895e6fdf36 Merge "minui: Fix breakage in graphics_adf." am: 54da112277 am: d66f05b82c
am: 4cc6889da8

Change-Id: Id405586d2ff8a94a49c9cb649483dbb7ec645fd1
2017-04-29 18:55:26 +00:00
Alistair Strachan
4697d8b11b minui: Fix breakage in graphics_adf.
When graphics_adf was refactored in 557fa1f, a class member was introduced
that was not initialized to zero. This meant that the first time Flip()
was called, current_surface would have a junk value and cause a bad
pointer rereference, crashing recovery.

Make sure current_surface is initialized to 0 for the first Flip().

Test: Ran recovery on a device using the ADF backend.
Change-Id: I9b8fac0a4d48cac990e5e9808a071c232de1ebfb
2017-04-28 16:13:02 -07:00
Tianjie Xu
9166f66eee Merge "Add the missing sr-Latn into png files and rename the png locale header" am: 713d915636 am: dc235b5ab9
am: 5ec12126f0

Change-Id: Ia6b861c91958d3be23a4a7456d6d5d8e4a1607c8
2017-03-28 20:11:15 +00:00
Tianjie Xu
2078b22e41 Add the missing sr-Latn into png files and rename the png locale header
Switch the locale header in the png files from Locale.toString() to
Locale.toLanguageTag(). For example, en_US --> en-us and sr__#Latn
--> sr-Latn. Also clean up recovery a bit to expect the new locale
format.

Bug: 35215015
Test: sr-Latn shows correctly under graphic tests && recovery tests pass
Change-Id: Ic62bab7756cdc6e5f98f26076f7c2dd046f811db
2017-03-24 16:54:52 -07:00
Tao Bao
edc96fdc44 Merge "Add the missing #include of <functional>." am: dd553d280f am: 965021ab8d
am: 26d00e87f9

Change-Id: Ib707f1282c3280374a014fadd7f27580f8bedaf0
2017-03-17 15:55:49 +00:00
Tao Bao
9468fc0429 Add the missing #include of <functional>.
For the use of std::function and std::bind. They were relying on the
transitive inclusion from <minui/minui.h>.

Test: mmma bootable/recovery
Change-Id: Ia138e1cbdd035b11d6cdca9e16c5591303b6ee13
2017-03-17 01:00:25 -07:00
Elliott Hughes
1de1c7124e Merge "Add a missing #include for openat(2)." am: 3ac0dd2a56 am: cdfe2895b4
am: a82df97dd8

Change-Id: Ie157634ac0e83d168a980fe1b3c72664179551ce
2017-02-24 17:03:37 +00:00
Elliott Hughes
25a29d452e Add a missing #include for openat(2).
Bug: https://code.google.com/p/android/issues/detail?id=64374
Test: builds
Change-Id: I7d7650463197710657820a1adce51f71c1b01415
2017-02-23 10:45:42 -08:00
Tao Bao
16b509535b Merge "minui: Move graphics_{adf,drm,fbdev} into classes." am: 0d14cc279c am: 6585a3c368 am: b8997adc20
am: 1cb8964aac

Change-Id: I8b1fb8ba115f7313f7382b7669e35184eaea3a79
2017-02-13 18:42:16 +00:00
Tao Bao
557fa1f45e minui: Move graphics_{adf,drm,fbdev} into classes.
This CL defines minui_backend as an interface, and expresses the three
backends (adf, drm and fbdev) as subclasses to the interface.

Test: 'Run graphics test' on N9, Pixel C and N5X.
Change-Id: I0e23951c7b2e2ff918957a8d9fc8b0085b6e5952
2017-02-10 17:05:15 -08:00
Tao Bao
70cbe1d2e7 Merge "minui: Save errno before calling close()." am: df464dbe79 am: 8075089ca1 am: 30c164411f
am: 0b4641724b

Change-Id: I494ad8c5749290645f9850410789247e35d3bd41
2017-02-10 00:31:29 +00:00
Tao Bao
f04592ba23 minui: Save errno before calling close().
Otherwise errno would be overwritten when calling close(2).

Test: mmma bootable/recovery
Change-Id: I661e46b1b040f550639a728aa2683e91621b4307
2017-02-09 12:59:19 -08:00
Tao Bao
6812a80433 Merge "minui: Clean up graphics_fbdev.cpp." am: 5121961421 am: e91a2d23ca am: c441edd1c3
am: e799840d8d

Change-Id: I4d9b1ddb2819b59234a32cca15009adf018c91e6
2017-02-09 20:43:49 +00:00
Treehugger Robot
5121961421 Merge "minui: Clean up graphics_fbdev.cpp." 2017-02-09 20:31:02 +00:00
Tao Bao
3a683a0272 Merge "minui: Clean up graphics_adf.cpp." am: d592e1d5e1 am: 46829c326e am: ffd5c03711
am: ff7a320971

Change-Id: I5d6139d8ffd8f65f19caf24d3c17b090fe59bb4b
2017-02-09 20:18:47 +00:00
Tao Bao
d592e1d5e1 Merge "minui: Clean up graphics_adf.cpp." 2017-02-09 20:07:09 +00:00
Tao Bao
a40303bafc Merge "minui: Clean up graphics_drm.cpp." am: 648f252c71 am: f6b6b75916 am: ed5ee5292c
am: 0f38c6da12

Change-Id: I20e3c6b46345df5035d7077dbd3aaf0a2be58670
2017-02-09 20:01:17 +00:00
Tao Bao
76be34cb34 minui: Clean up graphics_drm.cpp.
Remove unneeded header includes. Switch a few memset() to '= {}'
style. Otherwise mostly cosmetic changes like reformatting.

Test: 'Run graphics test' on ryu (which is a DRM device).

Change-Id: I4b0ab2dc0da69a690f09e4f0674b8377de662962
2017-02-07 14:47:59 -08:00
Tao Bao
acf4dd157a minui: Clean up graphics_fbdev.cpp.
Remove unneeded header includes. Otherwise mostly cosmetic changes like
reformatting.

Test: 'Run graphics test' on bullhead (which uses fbdev).

Change-Id: I9b92c96128fa332ac940f73764f9c5fc93ff6c8c
2017-02-07 14:46:31 -08:00
Tao Bao
8f0e21b271 minui: Clean up graphics_adf.cpp.
Remove unneeded header includes. Switch a few memset() to '= {}' style.
Otherwise mostly cosmetic changes like reformatting.

Test: 'Run graphics test' on N9 (which is an ADF device).

Change-Id: If008af18ddae9521f53216b581d882d5eed76d41
2017-02-07 13:20:55 -08:00
Tao Bao
89c56ce014 Merge "minui: Minor clean up to graphics.cpp." am: b04bc0540d am: ec8d74580d am: 7d8e13a535
am: cdd7b47545

Change-Id: Ib8e921d63f067bdf3547419e072cdb1a7ad9f0fc
2017-02-03 21:04:16 +00:00
Tao Bao
e8020f4fa3 minui: Minor clean up to graphics.cpp.
Remove unneeded header includes.

Remove the dead code in gr_test() (already commented out). Similar tests
have been covered by the "Run graphics test" from recovery menu.

Test: mmma -j32 bootable/recovery
Change-Id: If977c1b780602f5c5054469a3dae4fd85f34ab1a
2017-02-03 09:33:36 -08:00
Tao Bao
a7915380bb Merge "minui: Move callback functions to std::function." am: a476312714 am: 343987b2a1 am: 19856bcb2e
am: 6b26798b3a

Change-Id: I8fb3757de81e2d15e72df61951590653752df20c
2017-01-25 00:59:04 +00:00
Tao Bao
a476312714 Merge "minui: Move callback functions to std::function." 2017-01-25 00:49:48 +00:00
Tao Bao
0b1118d6b9 minui: Move callback functions to std::function.
Also make minor clean up to the header includes.

Test: mmma bootable/recovery system/core/healthd system/extra/slideshow
Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
2017-01-23 16:59:56 +00:00
Tianjie Xu
444732f7a0 Merge "Add checkers and tests for empty locale in PNG file" am: 69e73ab7a9 am: a38224eadb am: 18098b7de3
am: 98cf72d3aa

Change-Id: I1fb6b0898d347ca1187241e495fe28b260c6d905
2017-01-19 19:28:37 +00:00
Tianjie Xu
d17a688525 Add checkers and tests for empty locale in PNG file
match_locale() will return false for empty locale string in the PNG
file. Also add a manual test to validate if a PNG file is qualified to
use under recovery.

Bug: 34054052
Test: recovery_manual_test catches invalid PNG files successfully & Locale_test passed

Change-Id: Id7e2136e1d8abf20da15825aa7901effbced8b03
2017-01-18 19:37:06 -08:00
Tao Bao
274e065782 Merge "minui: Export minui/minui.h." am: 13d15af08f am: ad20b76397 am: 54890af615
am: 397c6c5382

Change-Id: Ib72aea7ad125286d1d347ff3b25fb5f90c408bd3
2017-01-17 19:27:31 +00: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
Rahul Chaudhry
eca28fb8c0 Merge "Remove unnecessary uses of reinterpret_cast." am: c470dc8681 am: 849a911dee am: 6a6e54da04
am: 8ef4c38abe

Change-Id: I795ab2874d6fc8c6087c89df72e7a2341e97e387
2016-11-16 21:59:56 +00:00
Rahul Chaudhry
1cf93f5f74 Remove unnecessary uses of reinterpret_cast.
Discovered while looking at compiler warnings (b/26936282).

Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma
Change-Id: I66f8f6026ed732a504504ade93ff196dc8b727ca
2016-11-15 23:25:57 -08:00
Rahul Chaudhry
b29f23f7e7 Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.
static_cast is preferable to reinterpret_cast when casting from void*
pointers returned by malloc/calloc/realloc/mmap calls.

Discovered while looking at compiler warnings (b/26936282).

Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma
Change-Id: Iaffd537784aa857108f6981fdfd82d0496eb5592
Merged-In: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-11-15 23:24:54 -08:00
Damien Bargiacchi
97eda9db70 Have gr_init_font alloc memory for the font
Change-Id: I8ccf369d52011bc5d07d8e041fe558ce734a78fc
(cherry picked from commit d00f5eb63a)
2016-11-15 16:40:32 -08:00
Damien Bargiacchi
d5d34d70a5 Support use of custom fonts in miniui
Bug: 29547343
Change-Id: I398160c85daac90ffab2fa9bb2e96795b9e9885a
(cherry picked from commit 35fff61b1c)
2016-11-15 14:24:06 -08:00
Tao Bao
b99b9099e8 Merge "Fix "ordered comparison between pointer and zero"." am: a844bc9649 am: 08c4130493 am: 0f81984970
am: c6bed0ab3f

Change-Id: I95702aa4777ac1a8b85b8458c7ab4d1f3a1d365d
2016-11-14 18:49:55 +00:00
Tao Bao
08c4130493 Merge "Fix "ordered comparison between pointer and zero"."
am: a844bc9649

Change-Id: If12e825a23c17730a35a2875c14d1d25d9d41038
2016-11-14 18:28:18 +00:00
MinSeong Kim
126cf8cda8 Fix "ordered comparison between pointer and zero".
From Clang 4.x releases, DR583 and DR1512 will be addressed.
This patch, in advance, fixes the error(s).

Test: `mmma bootable/recovery`
Change-Id: I29dc85ae681307c322ab3a698c3f3bbad1c784ee
Signed-off-by: MinSeong Kim <minseong.kim@linaro.org>
2016-11-11 07:00:57 +00:00
Rahul Chaudhry
4f7faac8d7 Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.
static_cast is preferable to reinterpret_cast when casting from void*
pointers returned by malloc/calloc/realloc/mmap calls.

Discovered while looking at compiler warnings (b/26936282).

Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma
Change-Id: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-11-08 16:34:01 -08:00
Tianjie Xu
17e316cce0 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
(cherry picked from commit 7aa88748f6)
2016-09-30 11:18:01 -07:00
Tianjie Xu
7aa88748f6 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
2016-09-29 19:21:24 -07:00
Damien Bargiacchi
8568d7e558 Have gr_init_font alloc memory for the font
am: d00f5eb63a

Change-Id: Ic5394da1aff31adb7dda5160414a4831204fddc2
2016-09-13 15:50:25 +00:00
Damien Bargiacchi
d00f5eb63a Have gr_init_font alloc memory for the font
Change-Id: I8ccf369d52011bc5d07d8e041fe558ce734a78fc
2016-09-09 08:32:21 -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
xinglong.zhu
a5734c2ad8 Merge "Recovery mode UI flicker"
am: 629bde8c6c

Change-Id: I2d9c2a88e8df9d5a096aa70a4a420754c668de26
2016-08-08 18:01:42 +00:00
Treehugger Robot
629bde8c6c Merge "Recovery mode UI flicker" 2016-08-08 17:55:15 +00:00
xinglong.zhu
c4fa2c2c40 Recovery mode UI flicker
[root cause  ] miniui has no mechanism to protect
               the buffer which is displaying
[changes     ] recovery
[side effects] ui show
[self test   ] sc9850-2 general operation has not display abnormal
[reviewers   ] xinglong.zhu

Signed-off-by: xinglong.zhu <xinglong.zhu@spreadtrum.com>
[change_type ] AOB --> google_original
[tag_product ] common

Change-Id: I989a0b2943ff6070a0e98718cfbe95144510d3a2
2016-08-05 22:30:14 +00:00
Tianjie Xu
b02a58740e Merge \"Add docs on regeneration background text image\"
am: 5aa2e104c0

Change-Id: I565fa63de18e0c806f2452c009d97c5ad4ebebc3
2016-07-29 00:09:45 +00:00
Tianjie Xu
9a259772cc Add docs on regeneration background text image
Also add a missing string in the recovery_l10n APP.

Bug: 30415666
Change-Id: Ice2a9f7cad4ebe332b427bc0c7a9adccb6cf3af3
2016-07-28 23:45:45 +00:00
Chih-Hung Hsieh
977903da49 Merge \"Fix clang-tidy performance warnings.\"
am: 2a3b695168

Change-Id: I55cadf517ec612f1b03de71ce7ca5cff69bc80d0
2016-07-27 20:49:34 +00:00
Chih-Hung Hsieh
23abfd37a5 Fix clang-tidy performance warnings.
* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.

Bug: 30407689
Bug: 30411878
Change-Id: Iefab05c077367f272abf545036b853e8a295c8cd
Test: build with WITH_TIDY=1
2016-07-27 10:19:47 -07:00
Jonathan Hamilton
0cc7e28ffd Merge "Keep ADF device alive for the lifetime of the minui backend" am: 14352497f0
am: 32c2e78726

* commit '32c2e78726fe9c7cdc927c8435352b2f8e824735':
  Keep ADF device alive for the lifetime of the minui backend

Change-Id: If28a4b4c7098f1a5fcf8e46e03d0df575fc68fce
2016-05-12 17:36:44 +00:00
Jonathan Hamilton
bab6e492ef Keep ADF device alive for the lifetime of the minui backend
Some ADF drivers do some amount of state cleanup when the ADF device
node is closed, making and attempts to draw using it fail.

This changes the minui ADF backend to keep the adf_device open until it
is exited, fixing issues on such devices.
2016-05-05 15:30:57 -07:00
Tianjie Xu
45609d37ef Merge "Fix matches_locale function" into nyc-dev
am: 8b86373

* commit '8b86373fd954276b18a6fba81afbe42c9caa49d3':
  Fix matches_locale function

Change-Id: If7726c2f381ba0e4ab0519b77c167e75a9d46104
2016-04-20 22:12:11 +00:00
Tianjie Xu
2430e2978b Fix matches_locale function
matches_locale was expecting input locale string to have at most one
underscore; as a result "zh_CN_#Hans" ignores "zh_CN" and matches into
"zh". Fix the match function and add unit tests.

Bug: 27837319
Change-Id: I4e8a66f91cae6ac2a46b6bf21f670d5ea564c7c8
2016-04-20 14:50:35 -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
Elliott Hughes
4846bc461c Merge "Update the system update animation." into nyc-dev
am: e8d0ecc

* commit 'e8d0ecccf7e54e73418cac94b0b136bfed94d51a':
  Update the system update animation.

Change-Id: I5d0ad44b13a505bca62a5316447603fab4d280aa
2016-04-15 20:00:26 +00: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
Elliott Hughes
af38cd9330 Merge "Fix minui cleanup path on error."
am: fa9af7dae6

* commit 'fa9af7dae68aad09ed624a9786f6cd57713f7b7f':
  Fix minui cleanup path on error.
2016-02-20 00:40:46 +00:00
Elliott Hughes
7d626df079 Fix minui cleanup path on error.
bootable/recovery/minui/resources.cpp:321:21: warning: Branch condition evaluates to a garbage value
                if (surface[i]) free(surface[i]);
                    ^~~~~~~~~~
  bootable/recovery/minui/resources.cpp:424:13: warning: Value stored to 'len' during its initialization is never read
        int len = row[4];
            ^~~   ~~~~~~

Bug: http://b/27264652
Change-Id: Icc1a914c59d6a89dab1b752b2cd2b40549566481
2016-02-19 10:33:01 -08:00
Bill Yi
dfe43869cb Merge commit 'ce46828e08281dc507d4e40ba9e8b770bc21cf0b' into HEAD 2016-02-17 09:50:14 -08:00
Yabin Cui
4425c1d960 Fix some memory leaks.
Bug: 26906328
Change-Id: Iebaf03db0cb3054f91715f8c849be6087d01b27b
2016-02-10 15:32:19 -08:00
Andriy Naborskyy
2d127a1d4a Revert "Byte swap to support BGRA in recovery mode" am: a5d5082222
am: 40cce13094

* commit '40cce13094cc7cabebe9577f6bb849dcb46b9d81':
  Revert "Byte swap to support BGRA in recovery mode"
2016-01-12 20:42:52 +00:00
Andriy Naborskyy
40cce13094 Revert "Byte swap to support BGRA in recovery mode"
am: a5d5082222

* commit 'a5d5082222b7420801cdb77f09305dd4c3afb4db':
  Revert "Byte swap to support BGRA in recovery mode"
2016-01-12 19:16:25 +00:00
Andriy Naborskyy
a5d5082222 Revert "Byte swap to support BGRA in recovery mode"
This reverts commit e5879c3639.

The swap in page flip code is not needed any more.
New changes take care of ABGR and BGRA formats swapping bytes in
png and drawing routines

See commit fd778e3e40

Bug: 26243152
Change-Id: I313ee41bee2c143b4e5412515285a65ac394ec77
2016-01-08 10:15:57 -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
7101b2e285 recovery: Switch to clang
And a few trival fixes to suppress warnings.

Change-Id: Id28e3581aaca4bda59826afa80c0c1cdfb0442fc
(cherry picked from commit 80e46e08de)
2015-11-16 14:28:40 -08:00
Vincent Palatin
6284431df5 am 8409b088: Merge "Add drm support to minui" into mnc-dev
* commit '8409b08888d5ec914d7b4aae552bc78f23bcddd5':
  Add drm support to minui
2015-07-02 00:58:36 +00:00
Stéphane Marchesin
1a92c4458d Add drm support to minui
Bug: 22231636

Change-Id: I103c8e906b7dd9862b7bb89d8642268e9a3006b4
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
2015-07-01 15:27:48 -07:00
Tao Bao
80e46e08de recovery: Switch to clang
And a few trival fixes to suppress warnings.

Change-Id: I38734b5f4434643e85feab25f4807b46a45d8d65
2015-06-03 11:30:03 -07:00
Elliott Hughes
2f5feedf1d Check all lseek calls succeed.
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek.

Bug: http://b/20625546
Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
(cherry picked from commit 7bad7c4646)
2015-04-29 21:14:56 -07:00
Elliott Hughes
7bad7c4646 Check all lseek calls succeed.
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek.

Bug: http://b/20625546
Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
2015-04-29 17:46:43 -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
07cfb8fe79 Switch minui over to C++.
Change-Id: I59e08a304ae514a3fdb6fab58721f11670bc1b01
2015-04-10 13:42:55 -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
0713819fd2 Add ev_iterate_available_keys to minui.
This lets us recognize whether we have up/down/power, say, and tailor
the UI accordingly.

Change-Id: If94e454f14243b59d2f473ac9a436bd60591da01
2015-04-10 09:40:53 -07:00
Elliott Hughes
59156bdeda Remove support for Cupcake kernels.
Change-Id: I7376b9d3c1e11d19e164072d6e9d09c1183114a0
2015-03-24 15:58:15 -07:00
Elliott Hughes
01a4d08010 Fix recovery image text rendering.
Previously most devices would lose the character before a line wrap.
The log's text rendering was starting at offset 4 but none of the
arithmetic was taking this into account. It just happened to work
on the Nexus 9's 1536-pixel wide display (1536/18=85.3) but not on
a device such as the Nexus 5 (1080/18=60).

The only active part of this change is the change from 4 to 0 in the
gr_text call. The rest is just a few bits of trivial cleanup while I
was working out what was going on.

Change-Id: I9279ae323c77bc8b6ea87dc0fe009aaaec6bfa0e
2015-03-24 15:21:48 -07:00