Commit graph

228 commits

Author SHA1 Message Date
Tim Zimmermann
997277d694
minui: Support main fbdev connector in multi connector Blank function
Test: Power off device, observe display no longer stays on in offline charging
      mode after animation finished

Change-Id: I49b0fda43f0866583be04afb32214b2c2da2ed92
2022-09-03 12:10:33 +02:00
Weizhung Ding
afd0a1b666 minui: Add API to support multiple connectors detection
Add API to support multiple connectors detection

Bug: 227468133
Test: check log in recovery mode
Change-Id: I18c5e0f373a29b153aab038bd289eed18847f2af
2022-08-18 15:28:49 +08:00
Treehugger Robot
f1ac4dacd2 Merge "minui: add hall sensor event" am: 13c721f330 am: 3a012a971a am: cdebb47048 am: 44ca8b76e6
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/1870215

Change-Id: I3ecd9758baa947494daee580c1d72d77ab556a5b
2022-01-26 06:46:11 +00:00
Treehugger Robot
cb7f2064eb Merge "minui: Add support for multiple connectors" am: 80a9dcad35 am: f8d4273171 am: b1090a47f4 am: 530cd6d0a7
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/1883848

Change-Id: I510c06a1af71adbc3fa88a1d08c7e39029c55bc2
2022-01-26 06:45:53 +00:00
Jack Wu
90b94b72ff minui: add hall sensor event
Bug: 191831427
Bug: 200907986
Test: manual test
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Ibb6f1e13344d33586398ac2e09430281bbe6d718
2022-01-25 10:02:50 +00:00
Weizhung Ding
f4dfa1adbb minui: Add support for multiple connectors
Add support for multiple connectors.

Bug: 194732653
Test: charging animation can be displayed on different connectors
Change-Id: If9b9eac25ce6e4c582aeb7c52e94ca266f623438
2022-01-25 16:49:55 +08:00
Bill Yi
f368b1564b Merge sc-qpr1 to aosp-master - DO NOT MERGE
Merged-In: I15f31c6b5cb5975d25199a3e9a0d6e22afcf0bd4
Merged-In: I7cff12b3c0b96c818b7e121d2e9038d49aad9886
Change-Id: If7d4e210285bbd21e5f4f2ab4533e16776425c71
2022-01-06 18:27:54 -08:00
Patrik Torstensson
51433b94f0 minui: Add support for ARGB (LSB alpha)
- Called RGBA to follow convention in minui
  where big-endian description of format is used
  and to avoid conflict with existing ARGB
- Handle alpha being LSB in png and text rendering

Change-Id: I0d9afef55aad05028ed0b8b4204f1d52aaa683c3
(cherry picked from commit cd1c327427febe7cf76e6fa4835847f0d4f398e3)
2021-12-06 03:09:47 +00:00
Christopher Ferris
f0a760b3a1 Do not write past end of inotify event structure.
Bug: 202159709

Test: None yet.
Change-Id: If80ed957aaa93c03a97b57e818e7783fa6e38242
(cherry picked from commit ce87c78611)
(cherry picked from commit 85d7266a72)
Merged-In:If80ed957aaa93c03a97b57e818e7783fa6e38242
2021-11-24 23:20:28 +00:00
Treehugger Robot
91ce222f5f Merge "libminui for vendor" am: 67fb9e94d2 am: a582cd483a
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/1866413

Change-Id: Idb6333246f83f7a5e320a5fcabfb60f7d5c8bfe9
2021-10-22 07:30:54 +00:00
Yifan Hong
868aa50c2e libminui for vendor
Build a static variant of libminui for vendor to use.
It depends on libdrm statically, and libsync from NDK.

This is needed to move charger to vendor partition.

Test: builds
Bug: 203246116
Change-Id: I0aa7783121502bef6ed98d9060a395931523b34c
2021-10-20 22:46:29 -07:00
Christopher Ferris
8346be7882 Do not write past end of inotify event structure. am: 187a6ec548
Original change: https://googleplex-android-review.googlesource.com/c/platform/bootable/recovery/+/16033753

Change-Id: Iee43ca1dde2fbb897e228ee092100d7a739a1bb6
2021-10-12 14:23:35 +00:00
Christopher Ferris
187a6ec548 Do not write past end of inotify event structure.
Bug: 202159709

Test: None yet.
Change-Id: If80ed957aaa93c03a97b57e818e7783fa6e38242
(cherry picked from commit ce87c78611)
2021-10-11 19:11:05 +00:00
Chihhang Chuang
6f7362ab7b Add support to use preferred graphics backend
- Add #gr_init(backends) for users to use preferred graphics backend.

Bug: 196777741
Test: build, flash, and boot device.
Change-Id: I2621e879bbc7dce926a263a97a1013985d75592a
2021-09-24 03:21:55 +08:00
Kelvin Zhang
99d53f88ee Remove magic code to flash the screen
The code is originally introduced in aosp/87740 , not sure why
it's necessary to do `blank(true); blank(false);` . Partners have
complained that such code causes device's screen to flicker, so remove
it.

Test: th
Bug: 194757527
Change-Id: I271883ea8c96a5612283aa34806b18e1590288f6
2021-07-27 12:48:20 -04:00
Kelvin Zhang
90f783f3ca use create_dumb.size as size of buffer
According to `man drm-memory` , "The size field contains the absolute
size in bytes of the buffer. This can normally also be computed with
(height * pitch + width) * bpp / 4". Which suggests that we should use
the .size field to allocate buffer.

Test: th
Test: go to recovery, make sure contents are properly displayed.

BYPASS_INCLUSIVE_LANGUAGE_REASON=commit message referenced "man",
        which is a linux command for lookup manual pages.

Change-Id: I512be6b7d493ef1783f2b7f746e279bc1dfe65f2
2021-05-17 16:25:00 -04:00
Bob Badour
29be3f6ef1 [LSC] Add LOCAL_LICENSE_KINDS to bootable/recovery
Added SPDX-license-identifier-Apache-2.0 to:
  applypatch/Android.bp
  bootloader_message/Android.bp
  edify/Android.bp
  fuse_sideload/Android.bp
  install/Android.bp
  minadbd/Android.bp
  minui/Android.bp
  otautil/Android.bp
  recovery_ui/Android.bp
  recovery_utils/Android.bp
  tests/Android.bp
  tools/image_generator/Android.bp
  tools/recovery_l10n/Android.bp
  uncrypt/Android.bp
  update_verifier/Android.bp
  updater/Android.bp
  updater/Android.mk
  updater_sample/Android.bp
  updater_sample/tests/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
    SPDX-license-identifier-OFL
to:
  Android.bp
  Android.mk

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I3da761b525452838977297f773974000d4de7bd6
2021-02-14 10:37:20 -08:00
Marissa Wall
7429176260 minui: remove libadf since it is no longer supported
Libadf is being removed since there are no android common kernels
that support adf. Remove support from miniui.

Test: Compiles and boots
Bug: 150467766

Change-Id: Ic66ea7a012b0466810ddeb8f884150b50c8ae769
2021-01-21 14:05:21 -08:00
lijiazi
7d306fbf4e minui: fix mem leakage issue
Use free to release GRSurface object will not call data_'s
DataDeleter, then the buf data_ points to will leakage.
Use delete release GRSurface object.

Test: manual

Change-Id: I53a9ea5a4ad67de1662c707a5ea59d738bd9c2d8
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
2020-12-23 19:21:06 +08:00
Stephane Lee
12952cdddb Fix ioctl FIONREAD call parameters to use int instead of size_t
Test: Ensure that calls to inotify_cb succeed; Ensure charger does not
crash

Change-Id: I9a7ca304057313c74ef02fd97223d0ed570c6206
2020-01-13 16:04:44 -08:00
Adrian Salido
cc7b7eb737 minui: add ARGB_8888 format
Minui currently really only supports composing in 2 different formats
(see gr_color()) with ALPHA always as MSB. However, some devices
interpret PixelFormat as either Big Endian (i.e. ARGB has alpha at MSB)
or Little Endian (i.e. BGRA has alpha at MSB).

This change attempts to give multiple options to specify the same format
depending on device interpretation, while keeping just 2 different
composition formats supported by minui.
* ARGB + BGRA: Pixels have (A)lpha at MSB and (B)lue at LSB
* RGBX + ABGR: Pixels have (A)lpha at MSB and (R)ed at LSB

With this in mind, limiting the use of png_set_bgr() to happen only for
(ARGB/BGRA) combination while leaving (RGBX/ABGR) unchanged.

Bug: 143480444
Test: Boot device with TARGET_RECOVERY_PIXEL_FORMAT := <<all>>
Change-Id: Ia0f94ccbc564b8def7c9416483712ff1abbbf49a
2019-12-13 10:53:33 -08:00
Xihua Chen
a7952ac141 minui: Support input device hotplug in recovery mode.
In the old code, the recovery only enumerated the input devices at the
startup, and read the input events from these devices.
So if a USB input device is probed after the recovery startup, then the
recovery can't read the events from this device.
This patch use inotify to monitor /dev/input for new added input
device, then support input device hotplug in recovery mode.

Bug: 111847510
Test: can use USB keyboard hotplugged in recovery mode
Change-Id: I7e7dcbd619d3c66a2f40a43418f5dac6a50c859e
Signed-off-by: Liu Shuo A <shuo.a.liu@intel.com>
Signed-off-by: Ming Tan <ming.tan@intel.com>
2019-08-14 14:18:58 -07:00
xunchang
34723087fe matches_locale no longer accept empty locales in the png file
The legacy png files have an empty line in the end. And the recovery
used to match any missing locale, e.g. "he" with that line and gets an
empty image.

Since the empty image is barely useful, we should just error out and
fall back to the default locale.

This reversed the unit test check added in d17a688525

Bug: 128934634
Test: run locale test with "he" and legacy images, recovery reports
error and doesn't crash even without default locale fall back

Change-Id: Ibdb7dd0b42348de5e392c834cce67ff02be85c24
2019-04-22 15:32:17 -07:00
xunchang
9d05c8a357 Fall back to en-US if localized bitmap is missing for a locale
We used to show the image for the last locale or an empty image, if
the localized image is missing for a specific locale. As the default
english one is more meaningful to users, we should just error out and
fall back to use the default locale when the image loading fails.

Bug: 128934634
Test: run graphic test, locale test
Change-Id: Iafd3e8466aec63b4952d1959b2a3d37e358677d4
2019-04-22 14:39:51 -07:00
Tao Bao
835bf09a14 minui: Managed FDs with smart pointers.
Also clean up a few variable names.

Test: Boot into recovery. Check key inputs.
Change-Id: I058475ac22f3db8523bd8aa30ccb61be1ef45559
2019-03-11 15:59:09 -07:00
Tao Bao
dfdf63501e minui: Fix the wrong move of the callback.
The input_cb in ev_init() should be shared among the detected input
devices.

Test: Boot into recovery. Check key inputs.
Change-Id: I0315f6a23625bacedd333fefacbf4ac6797bc1fd
2019-03-11 12:07:11 -07:00
Tao Bao
b549243b27 Use O_CLOEXEC at a few places.
Found these FDs unintentionally propagated into forked processes (e.g.
updater) during my local debugging. Use O_CLOEXEC to avoid that.

Test: Dump open FDs in updater process.
Test: Sideload a package on taimen (which uses framebuffer).
Test: Run graphics test on taimen.
Change-Id: I1fb65dd4a103c47d28b15973def9e9359c251ca3
2019-03-01 14:24:41 -08:00
Nick Kralevich
39c53c8ac9 use epoll_create1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC)
instead.

Bug: 120983106
Test: compiles and boots
Change-Id: I91f213ebb2dd05330dd25ec1ca1fec59b611e7f2
2018-12-17 08:51:38 -08:00
Tao Bao
dd78982d58 minui: GRSurface::Create() computes data_size on its own.
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
2018-11-26 22:46:19 -08:00
Tao Bao
2201d08f8d minui: Fix a wrong arg in calling GRSurface::Create().
This is a bug introduced while refactoring init_display_surface(), in
[1]. As a result, user of res_create_multi_display_surface(), which is
effectively `charger` right now, crashes due to buffer overrun.

This CL fixes the wrong arg and adds a sanity test for
res_create_multi_display_surface(). The testdata (battery_scale.png) is
copied from system/core/healthd/images/battery_scale.png.

[1] commit 44820ac1e3.

Bug: 119122296
Test: Run recovery_unit_test on marlin.
Test: Build and boot into charger mode on blueline. Verify that
      `charger` no longer crashes.
Change-Id: Ib6d083e1512a9c3c6eb63874d26d22658921d693
2018-11-26 17:06:53 -08:00
Tao Bao
9cf163e673 minui: GRSurface manages data with std::unique_ptr.
Test: Run recovery_unit_test on marlin.
Test: `Run graphics test` on taimen.
Change-Id: I34bd862049900b0030f2840a92a7fa3e02fa2c10
2018-11-07 14:36:45 -08:00
Tao Bao
f65d48bb5a minui: Use android::base::unique_fd in MinuiBackendFbdev.
Test: mmma -j bootable/recovery
Test: `Run graphics test` on taimen.
Change-Id: I5b25cafbd0107943606a87f0619242cf950174ac
2018-11-02 09:35:08 -07:00
Tao Bao
63b59dcead minui: Add GRSurface::Clone().
Clone() allows duplicating the image that's stored in the GRSurface.

Test: Run recovery_unit_test.
Change-Id: Ia50d507c6200f2de5f17143775de805247a60e1f
2018-11-01 12:14:46 -07:00
Tao Bao
710bc535f4 minui: Remove the default and copy ctors for GRSurface.
As well as all the derived classes. Instances must be created with
Create(). A default copy ctor would mess up the ownership of the
mapped or allocated buffer in these classes, so that has been explicitly
removed.

Test: mmma -j bootable/recovery
Test: Run recovery_unit_test on marlin.
Test: `Run graphics test` on blueline.
Change-Id: I69ce001a9ec9e3ac851edb6ec4d3fa11f4aaea08
2018-10-31 20:28:29 -07:00
Tao Bao
1b18cf56e2 minui: Refactor GRSurfaceAdf.
Test: mmma -j bootable/recovery
Change-Id: I14514017aace4b7043a9db1f5a93ec130a6f89c4
2018-10-31 20:28:29 -07:00
Tao Bao
4a22b28bea minui: Refactor GRSurfaceFbdev.
- Adds Create() that returns a GRSurfaceFbdev instance.
- Moves away from using the copy ctor (precisely assignment operator) of
  GRSurfaceFbdev.
- Moves the GRSurfaceFbdev deallocation code into GRSurfaceFbdev's dtor.
- Manages MinuiBackendFbdev::gr_framebuffer with std::unique_ptr.

Test: mmma -j bootable/recovery
Test: `Run graphics test` on taimen.
Change-Id: I8e67cda7bc3a2feec0790124d035caa36fb58a89
2018-10-31 20:28:29 -07:00
Tao Bao
44820ac1e3 minui: Add a protected GRSurface ctor.
This prepares for the removal of the default and copy ctors, by making
GRSurface::Create() as the only way to get GRSurface instances.

Test: mmma -j bootable/recovery
Test: Run recovery_unit_test on marlin.
Change-Id: I0c34c3f3967e252deb020907c83acbac8a8f36b9
2018-10-31 11:19:28 -07:00
Tao Bao
d096d7e5a9 minui: Cleanup GRSurfaceDrm and MinuiBackendDrm.
This CL adds a dtor to GRSurfaceDrm that handles the resource
deallocation. It also manages MinuiBackendDrm::GRSurfaceDrms with smart
pointers.

Test: Build and boot into recovery on blueline. `Run graphics test`.
Change-Id: Iff7bbdddbc0b5ab16483d00870794fca9f832bd5
2018-10-24 09:38:34 -07:00
Tao Bao
92bdb5a389 minui: Move GRSurface into a class.
This CL adds GRSurface::Create() and dtor for managing the allocated
memory in GRSurface class. It also adds GRSurface::data() that hides the
underlying implementation, with both of const and non-const overloads.
This allows `const GRSurface&` to be more useful - previously it only
ensured a const member variable of `data`, instead of a read-only buffer
it points to.

It also marks the parameters in gr_texticon() and gr_blit() as const, as
they're incoming source that shouldn't be altered. It corrects the type
of gr_draw, which is the sink to be painted on (an earlier attempt was
made in [1], but didn't get the full picture correctly).

[1] https://android-review.googlesource.com/c/platform/bootable/recovery/+/704757/

Test: mmma -j bootable/recovery
Test: recovery_unit_test on marlin
Test: Run graphics test on marlin (fbdev).
Test: Run graphics test on blueline (drm).
Change-Id: I7904df084cd6c08fa04a9da97d01b4b1a6e3a20c
2018-10-22 18:18:02 -07:00
Tao Bao
050feb0153 minui: Track the name change to minui related properties.
These properties need to be exposed to both of charger and recovery.
This CL tracks the name change.

Bug: 113567255
Test: Build along with other CLs in the topic (for Makefile and
      sepolicy changes). Boot into charger mode.
Test: Boot into recovery. Run graphics test.
Change-Id: I4d90778c1767c9bd7e00830a34ee2d4875ce0b83
2018-09-05 21:47:19 -07:00
Tao Bao
818f938188 recovery uses more shared libraries.
Bug: 110380063
Test: `m -j installclean && mmma -j bootable/recovery` with
      aosp_taimen-userdebug
Test: Build (`m -j bootimage`) and boot into recovery. Check that
      `adb sideload` and `Run graphics test` both work.
Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: Ie6ed0e7cafa352d5faff9d1b6ccef724a0415e65
2018-08-08 14:26:27 -07:00
Tao Bao
60924fa89a Merge "minui: Track libsync module name change." 2018-08-08 00:26:38 +00:00
Tao Bao
1c4d4bf4f4 minui: Track libsync module name change.
Needs the matching change to libsync_recovery.

Test: `mmma -j bootable/recovery`
Change-Id: I69b5c978e9b4d16957ffecd360796b29cd95865c
2018-08-07 11:04:27 -07:00
tangrobin
13bec76662 Fix the DRM_FORMAT match with corresponding PixelFormat
The DRM_FORMAT settings in DrmCreateSurface should match with the
correct PixelFormat

Bug: 112245291
Test: build and flash boot image to device.
Change-Id: I3ee0de38256d1109cd5174b666e2f47dceb637e6
2018-08-07 10:10:33 -07:00
Tao Bao
7ee83f627e minui: Move to Soong.
Note that although libminui says "shared_libs" in Android.bp file,
`recovery` binary will still statically link the libs, until we drop the
`LOCAL_FORCE_STATIC_EXECUTABLE := true` flag from `recovery` module.

Bug: 110380063
Test: `mmma -j bootable/recovery` with aosp_taimen-userdebug
Test: Boot into recovery and `Run graphics test`.
Change-Id: I48785d161dfe52eb01667e938d9c3f0a497b61a2
2018-08-05 14:42:26 -07:00
Tao Bao
ed876a7175 minui: Use runtime properties instead of build time vars.
This CL removes the use of the following build time macros, and uses the
runtime property values instead.
- TARGET_RECOVERY_PIXEL_FORMAT
- TARGET_RECOVERY_OVERSCAN_PERCENT
- TARGET_RECOVERY_DEFAULT_ROTATION

Bug: 110380063
Test: Set up taimen with `TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_LEFT`.
      Build and check recovery UI.
Test: Set up taimen with `TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888`.
      Build and check recovery UI.
Change-Id: I4439556a03fde4805a18011ef72eff1373f31d47
2018-08-01 15:36:41 -07:00
Tao Bao
44478dfb7d minui: Clean up the use of rotation.
This CL uses scoped enum for GRRotation. It also refactors the previous
comparisions to improve readability -- it was hard to tell the meaning
of `if (rotation % 2)` unless by checking the exact values.

It also temporarily adds STRINGFY to expand the macro of
DEFAULT_ROTATION. This will be removed once minui is changed from
reading build time vars to runtime properties.

Test: Build and boot into recovery image on marlin.
Test: Set `TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_LEFT` and check
      the display under recovery with `Run graphics test`.
Change-Id: Ieb08b1cd13c284f8dcf906cb2a1430c6bae2835b
2018-08-01 12:30:27 -07:00
Jeremy Compostella
955da1e26d minui/drm: wait for page flip completion
If two consecutive call are made to drmModePageFlip, the second call
may fail with -EBUSY because the first flip is not completed yet.

This patch adds a wait for completion mechanism based on
drmHandleEvent.

Change-Id: Ied13ebefc7523003431b1b307bae70d1a70cb24b
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Benoit Fradin <benoit.fradin@intel.com>
2018-07-03 17:43:06 +00:00
Tao Bao
9f4263346b minui: Add constness to GRSurface* in gr_get_{width,height}.
Also free gr_font in gr_exit(), as it's owned by minui.

Test: mmma -j bootable/recovery system/core/healthd
Test: recovery_unit_test on marlin
Test: Boot into recovery. Run graphics test.
Change-Id: I00457bb97ed3dc95ef5aad493827fb5a62a258dc
2018-06-13 13:24:58 -07:00
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