Commit Graph

20 Commits

Author SHA1 Message Date
Tom Marshall
4e181538a1 recovery: calibrate touchscreen
Change-Id: I5a32a59691dea5fa2aa867e6594cec15b1b24ccf
2023-10-08 18:28:03 +03:00
Tom Marshall
66ced9526c recovery: touch UI
[aleasto] make scrolling natural
[DD3Boh] Adapt to Android 11

Change-Id: Ibf64aa70e21d88f9d0b2c60fc1b66a9995837464
2023-10-08 18:28:01 +03:00
Tom Marshall
3547109e3f recovery: Provide sideload cancellation
We can't use InterruptWaitKey() as it hangs recovery
when called from the minadbd listener thread, so provide
our own 'CancelWaitKey' implementation.
[forkbomb: rework for Q]

Squashed:
  recovery: Move sideload (non)cancellation to its own key

   * We use KEY_REFRESH for actually refreshing menus, which is
     useful when handling hotpluggable storage.
     We don't want that to interact with the sideload menu.

  Change-Id: Id7f5c06385e613648b3f727fc5e91eb3206406cf

Change-Id: I13f0c9ae5444652a2141442ef24258679a78d320
2023-10-08 18:27:23 +03:00
Tom Marshall
1d09093530 recovery: ui: Support hardware virtual keys
* Also swipe left -> KEY_BACK

Change-Id: I6bd8054485d680df35abb86cb79f1dda683e4459
2023-10-08 18:27:23 +03:00
Tom Marshall
52113a5b36 recovery: ui: Minor cleanup for touch code
* Better naming for some touch vars and funcs

 * Introduce Point class

Change-Id: Idfcab54ac356face52efd69fdfdc0a6f4633a3f3
2023-10-08 18:27:23 +03:00
Tom Marshall
55a315dd33 recovery: ui: Default to touch enabled
Change-Id: I048905cda2ea0439338e0dea43029041bff22c00
2023-10-08 18:27:23 +03:00
fredchiou
b44702a80a recovery_ui:Add support for multiple connectors switch
Bug: 199253219
Test: display can switch in recovery
Change-Id: If58ea5423f64420db3e5bd9307194b56129d6543
2022-08-29 13:16:29 +00:00
Lincoln Atkinson
fcf4b6bca0 Add support for controlling recovery brightness at exynos-compatible sysfs path
Test: manual
Bug: 139537581
Exempt-From-Owner-Approval: wear branch
Change-Id: I163ea0d5e716c9fad28fb2c64306ed24362c53c7
(cherry picked from commit c9c5fcf8d6c9a6be7a5e07bcf94a3f841eaaca25)
(cherry picked from commit 526bd581bca75f93778eb773674773de21fe8f54)
2020-12-03 22:24:19 +00:00
Tianjie Xu
00c4aba9bf Consolidate the wait in recovery's reboot
After a reboot function call, we should always wait for it to finish
without executing other instructions.

Bug: 151110322
Test: build
Change-Id: I1dda291a0835ff96df7eaf42eba1a38267a3beeb
2020-03-13 16:09:48 -07:00
Tianjie Xu
e5032219fe Create a new function to return the help message for menu
Then we can override this function in the device specific recovery ui;
and allow customizing the help message.

Bug: 137965958
Test: Check the menu on sailfish
Change-Id: I09f23166f4205c5edf6c62eb42c8ada0fa710b26
2019-07-25 13:22:03 -07:00
Tianjie Xu
33bb113af2 Merge "Add a new key_pressed_mutex" 2019-07-10 17:46:27 +00:00
Tianjie Xu
b8a959b00f Add a new key_pressed_mutex
The following variables in recovery ui were protected by
key_queue_mutex. But the purpose of key_queue_mutex is to protect the
key_queue, which will be changed after we already have a key code. So
getting the key pressed should be orthogonal to the key queue. And
adding a mutex will help to avoid deadlocks in b/135078366.

Variables include:
  char key_pressed[KEY_MAX + 1];
  int key_last_down;
  bool key_long_press;
  int key_down_count;
  bool enable_reboot;

Bug: 135078366
Test: boot into recovery and press keys
Change-Id: Ie2cfcf1f2fec49b53f8fac97aa9a2c60f15b84f9
2019-07-09 16:47:07 -07:00
Tao Bao
1df3ce7ea8 recovery_ui: Remove RecoveryUI::last_key.
It's a private member, and the last user has been removed in [1] in
2015.

[1] commit ec28340cf3,
https://android-review.googlesource.com/c/platform/bootable/recovery/+/146330

Test: mmma -j bootable/recovery
Change-Id: I65a2370cb20a7b296888425a44a42c8b90abc766
2019-07-09 11:21:18 -07:00
Treehugger Robot
eb33356544 Merge "Avoid key_queue_mutex deadlock in waitkey()" 2019-06-13 00:01:49 +00:00
Zhang, GaofengX
852d9fec6d Avoid key_queue_mutex deadlock in waitkey()
Waitkey() is designed to obtain lock "key_queue_mutex" in
the very beginning of function.

  int RecoveryUI::WaitKey() {
    std::unique_lock<std::mutex> lk(key_queue_mutex);
    ...
  }

However, there's case "key_queue_mutex" being applied again in
waitkey(), thus cause deadlock. There are two reproduce
scenario:
1.Executing "fastboot reboot recovery" in userspace
  fastboot
2.Executing "adb reboot fastboot" in recovery os

When entering userspace fastboot/recovery, waitkey()
will wait there for user action. fastboot/adb commands
will trigger ui->interruptkey() to notify the thread
waitkey() in. In the next, waitkey() will move on and call
SetScreenSaveState(), which do LOG(ERROR) in fail case of
brightness set. LOG(ERROR) is designed to print log on
UI. Unfortunately, UI->print() applies lock "key_queue_mutex"
too, so deadlock happen.

Note:
Here is details how lock "key_queue_mutex" applied in
UI->print():
Function Print() call
   Function PrintV() call
      Function update_screen_locked() call
         Function draw_screen_locked() call
            Function draw_menu_and_test_buffer_locked() call
               Function IsLongPress()

  bool RecoveryUI::IsLongPress() {
    std::lock_guard<std::mutex> lg(key_queue_mutex);
    bool result = key_long_press;
    return result;
  }

Bug: 135078366
Test: no errors when running "fastboot reboot recovery" in userspace
      fastboot & "adb reboot fastboot" in recovery os

Change-Id: Ida6b3c4ba9896a70021373f02a94954f0a60cf31
Signed-off-by: Zhang, GaofengX <gaofengx.zhang@intel.com>
Signed-off-by: Xihua Chen <xihua.chen@intel.com>
2019-06-12 14:48:37 +08:00
Mark Salyzyn
488cc05c96 recovery: report compliant reboot reason (Part Deux)
shutdown and reboot should have a corresponding sub-reason.

Adding:
    "reboot,userrequested,fastboot"
    "reboot,userrequested,recovery"
    "reboot,userrequested,recovery,ui"
    "shutdown,userrequested,fastboot"
    "shutdown,userrequested,recovery"
    "reboot,unknown#" (Can't happen, debug)

Test: manual, multiple targets, enter recovery, be able to exit recovery
Bug: 133326470
Change-Id: Ibfcb2a23158e8e99922e8053edd815fb592150f2
2019-05-23 13:58:53 -07:00
Tao Bao
feefbf2f56 Revert "recovery: report compliant reboot reason"
This reverts commit 6f4e4db4f9.

Reason for revert: Booting out of recovery (choose `Reboot system now`)
on taimen is broken. Device keeps booting back into recovery.

Bug: 133326470
Test: Choose `Reboot system now` from recovery menu. Deivce attempts
      normal boot.
Change-Id: I6e85fc248e18953a6fb94513c3abc7e7e0fb0477
2019-05-22 11:06:26 -07:00
Mark Salyzyn
6f4e4db4f9 recovery: report compliant reboot reason
shutdown and reboot should have a corresponding sub-reason.

Adding:
    "reboot,fastboot_menu"
    "reboot,recovery_menu"
    "reboot,recovery_ui"
    "shutdown,fastboot"
    "shutdown,recovery"
    "reboot,unknown#"

Test: none
Change-Id: Icf1ab0d462ec2de2272914a36994a095998d6186
2019-05-20 13:52:10 -07:00
Tao Bao
782dcc1996 Consolidate the codes that handle reboot/shutdown.
Test: Choose `Reboot system now`, `Power off`, `Reboot to bootloader`
      from recovery UI respectively.
Test: `adb reboot recovery` while under sideload mode.
Change-Id: I0f3d55b80b472178ea4f6970b29cd9df0778b639
2019-04-29 12:12:25 -07:00
Tianjie Xu
8f397309b4 Move librecovery_ui to a sub-directory
This helps to expose librecovery_ui for device specific RecoveryUi.

Bug: 76436783
Test: mma, unit tests pass
Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
(cherry picked from commit b5108c372c)
2019-03-21 10:46:11 -07:00