From da584a2e6df7045c080aceca9d3a8a3fee0081db Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Tue, 8 Dec 2015 16:24:35 -0800 Subject: recovery: Menu rewrites and cleanups * Introduce a menu stack for navigating sub-menus. The menu data structure format is a bit messy, but necessary in order to provide a string list for the ui. * Create "advanced" sub-menu for rarely used and dangerous commands. * Create "factory reset" sub-menu for various reset and wipe commands. * Separate "wipe data" and "factory reset" items. Change-Id: Ib9bc6967b98d022880cfe7fa8e324cd64b07d248 --- device.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'device.h') diff --git a/device.h b/device.h index 1241982..dba4ac1 100644 --- a/device.h +++ b/device.h @@ -19,11 +19,15 @@ #include "ui.h" +#include + #define KEY_FLAG_ABS 0x8000 +struct menu; + class Device : public VoldWatcher { public: - Device(RecoveryUI* ui) : ui_(ui) { } + explicit Device(RecoveryUI* ui); virtual ~Device() { } // Called to obtain the UI object that should be used to display @@ -59,18 +63,17 @@ class Device : public VoldWatcher { virtual int HandleMenuKey(int key, int visible); enum BuiltinAction { - NO_ACTION = 0, - REBOOT = 1, - APPLY_UPDATE = 2, - // APPLY_CACHE was 3. - // APPLY_ADB_SIDELOAD was 4. - WIPE_DATA = 5, - WIPE_CACHE = 6, - WIPE_MEDIA = 7, - REBOOT_BOOTLOADER = 8, - SHUTDOWN = 9, - VIEW_RECOVERY_LOGS = 10, - MOUNT_SYSTEM = 11, + NO_ACTION, + REBOOT, + APPLY_UPDATE, + WIPE_DATA, + WIPE_FULL, + WIPE_CACHE, + REBOOT_RECOVERY, + REBOOT_BOOTLOADER, + SHUTDOWN, + VIEW_RECOVERY_LOGS, + MOUNT_SYSTEM, }; // Return the list of menu items (an array of strings, @@ -117,6 +120,8 @@ class Device : public VoldWatcher { private: RecoveryUI* ui_; + + std::stack menu_stack; }; // The device-specific library must define this function (or the -- cgit v1.1