aboutsummaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2016-02-04 13:18:36 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-02-08 00:28:12 -0800
commite1d7843fdb4340eb89cabac07d716711ff1d6de9 (patch)
tree1ee85064c9aff73e6fb571c2da6d3f12641986d9 /recovery.cpp
parent5e36ad0a45f33b688f80fc8ea30ac7e71b5d7724 (diff)
downloadbootable_recovery-e1d7843fdb4340eb89cabac07d716711ff1d6de9.zip
bootable_recovery-e1d7843fdb4340eb89cabac07d716711ff1d6de9.tar.gz
bootable_recovery-e1d7843fdb4340eb89cabac07d716711ff1d6de9.tar.bz2
recovery: Show menu headers
Most headers in recovery aren't very useful and so have historically not been shown in the touch UI. But certain headers, such as those shown by yes_no(), should be shown. Change-Id: I8536c528d3b4b4fd6d506ecef25378149b4e9746
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 72ce09e..82df0ec 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -649,6 +649,11 @@ get_menu_selection(const char* const * headers, const char* const * items,
ui->FlushKeys();
// Count items to detect valid values for absolute selection
+ int header_count = 0;
+ if (headers) {
+ while (headers[header_count] != NULL)
+ ++header_count;
+ }
int item_count = 0;
while (items[item_count] != NULL)
++item_count;
@@ -679,15 +684,15 @@ get_menu_selection(const char* const * headers, const char* const * items,
int action = device->HandleMenuKey(key, visible);
if (action >= 0) {
- if ((action & ~KEY_FLAG_ABS) >= item_count) {
+ action &= ~KEY_FLAG_ABS;
+ if (action < header_count || action >= header_count + item_count) {
action = Device::kNoAction;
}
else {
// Absolute selection. Update selected item and give some
// feedback in the UI by selecting the item for a short time.
- selected = action & ~KEY_FLAG_ABS;
+ selected = ui->SelectMenu(action, true);
action = Device::kInvokeItem;
- selected = ui->SelectMenu(selected, true);
usleep(50*1000);
}
}