Skip to content

Commit

Permalink
wear_ui: Expose menu_unusable_rows via Makefile var.
Browse files Browse the repository at this point in the history
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
(cherry picked from commit eea3af3)
  • Loading branch information
Tao Bao committed Aug 13, 2017
1 parent 016120f commit f2be3bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Android.mk
Expand Up @@ -131,6 +131,12 @@ else
LOCAL_CFLAGS += -DRECOVERY_UI_ANIMATION_FPS=30
endif

ifneq ($(TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS),)
LOCAL_CFLAGS += -DRECOVERY_UI_MENU_UNUSABLE_ROWS=$(TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS)
else
LOCAL_CFLAGS += -DRECOVERY_UI_MENU_UNUSABLE_ROWS=9
endif

ifneq ($(TARGET_RECOVERY_UI_VR_STEREO_OFFSET),)
LOCAL_CFLAGS += -DRECOVERY_UI_VR_STEREO_OFFSET=$(TARGET_RECOVERY_UI_VR_STEREO_OFFSET)
else
Expand Down
7 changes: 4 additions & 3 deletions wear_ui.cpp
Expand Up @@ -51,8 +51,9 @@ static double now() {
}

WearRecoveryUI::WearRecoveryUI()
: kProgressBarBaseline(RECOVERY_UI_PROGRESS_BAR_BASELINE), menu_unusable_rows(9) {
// TODO: menu_unusable_rows should be computed based on the lines in draw_screen_locked().
: kProgressBarBaseline(RECOVERY_UI_PROGRESS_BAR_BASELINE),
kMenuUnusableRows(RECOVERY_UI_MENU_UNUSABLE_ROWS) {
// TODO: kMenuUnusableRows should be computed based on the lines in draw_screen_locked().

// TODO: The following three variables are likely not needed. The first two are detected
// automatically in ScreenRecoveryUI::LoadAnimation(), based on the actual files seen on device.
Expand Down Expand Up @@ -268,7 +269,7 @@ void WearRecoveryUI::StartMenu(const char* const* headers, const char* const* it
show_menu = true;
menu_sel = initial_selection;
menu_start = 0;
menu_end = visible_text_rows - 1 - menu_unusable_rows;
menu_end = visible_text_rows - 1 - kMenuUnusableRows;
if (menu_items <= menu_end) menu_end = menu_items;
update_screen_locked();
}
Expand Down
2 changes: 1 addition & 1 deletion wear_ui.h
Expand Up @@ -46,7 +46,7 @@ class WearRecoveryUI : public ScreenRecoveryUI {

// Unusable rows when displaying the recovery menu, including the lines for headers (Android
// Recovery, build id and etc) and the bottom lines that may otherwise go out of the screen.
int menu_unusable_rows;
const int kMenuUnusableRows;

int GetProgressBaseline() const override;

Expand Down

0 comments on commit f2be3bd

Please sign in to comment.