Add ScreenRecoveryUI::ShowMenu().
From caller's PoV, RecoveryUI::{Start,Select,End}Menu should always be
used together, i.e. to show a menu and get user's selection. This CL
provides ShowMenu() as one-stop service (which is based on
get_menu_selection() from recovery.cpp).
Also move RecoveryUI::{Start,Select,End}Menu into ScreenRecoveryUI, with
a dropped access level from public to protected.
Due to the dependency on recovery / librecovery refactoring, will add
testcases in follow-up CLs.
Test: Build and boot into recovery image. Check the menus (main menu,
'View recovery logs', 'Wipe data/factory reset').
Change-Id: Ie17aa78144871a12affd6f9075e045f76608a0ba
diff --git a/stub_ui.h b/stub_ui.h
index 1f6b29a..3c36fcf 100644
--- a/stub_ui.h
+++ b/stub_ui.h
@@ -54,12 +54,11 @@
void ShowFile(const char* /* filename */) override {}
// menu display
- void StartMenu(const char* const* /* headers */, const char* const* /* items */,
- int /* initial_selection */) override {}
- int SelectMenu(int sel) override {
- return sel;
+ int ShowMenu(const char* const* /* headers */, const char* const* /* items */,
+ int initial_selection, bool /* menu_only */,
+ const std::function<int(int, bool)>& /* key_handler */) override {
+ return initial_selection;
}
- void EndMenu() override {}
};
#endif // RECOVERY_STUB_UI_H