aboutsummaryrefslogtreecommitdiffstats
path: root/wear_ui.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-09-02 11:20:30 -0700
committerSteve Kondik <steve@cyngn.com>2015-11-07 19:21:20 -0800
commit568d2b60266bf1583e57bb27ba5f23b3d8777c4e (patch)
treef8f6f7e2960cb6a2dbb2f3ae1bbfbb6a917b75b8 /wear_ui.cpp
parentf4442a83782f09ab0460544fac1b627eecf93051 (diff)
downloadbootable_recovery-568d2b60266bf1583e57bb27ba5f23b3d8777c4e.zip
bootable_recovery-568d2b60266bf1583e57bb27ba5f23b3d8777c4e.tar.gz
bootable_recovery-568d2b60266bf1583e57bb27ba5f23b3d8777c4e.tar.bz2
recovery: Fix the bug that truncates menu entries.
When there are 20 entries (like 10 last_log* and 10 last_kmg* in "view recovery logs"), there's no "Back" entry. Because the number of entries (21) exceeds text_rows (20) in WearRecoveryUI::StartMenu(). Since we have scrollable menu, having more entries than text_rows won't be an issue. Bug: 23752519 Change-Id: I12573d7a34852a1a3d130c9e88522cee737eb08f
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 4ae42c4..55b7afc 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -482,7 +482,12 @@ void WearRecoveryUI::StartMenu(const char* const * headers, const char* const *
if (text_rows > 0 && text_cols > 0) {
menu_headers_ = headers;
size_t i = 0;
- for (; i < text_rows && items[i] != nullptr; i++) {
+ // "i < text_rows" is removed from the loop termination condition,
+ // which is different from the one in ScreenRecoveryUI::StartMenu().
+ // Because WearRecoveryUI supports scrollable menu, it's fine to have
+ // more entries than text_rows. The menu may be truncated otherwise.
+ // Bug: 23752519
+ for (; items[i] != nullptr; i++) {
strncpy(menu[i], items[i], text_cols - 1);
menu[i][text_cols - 1] = '\0';
}