summaryrefslogtreecommitdiffstats
path: root/device.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-05-24 02:43:41 +0200
committerTao Bao <tbao@google.com>2016-10-09 21:55:50 +0200
commitb0c3f6ffebded0bc9a55e593456ff5e30e17201e (patch)
tree6f811017650c25e772167b06a586c7534025f513 /device.cpp
parentMerge "edify: Move State.script and State.errmsg to std::string." (diff)
downloadandroid_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.tar
android_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.tar.gz
android_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.tar.bz2
android_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.tar.lz
android_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.tar.xz
android_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.tar.zst
android_bootable_recovery-b0c3f6ffebded0bc9a55e593456ff5e30e17201e.zip
Diffstat (limited to 'device.cpp')
-rw-r--r--device.cpp54
1 files changed, 40 insertions, 14 deletions
diff --git a/device.cpp b/device.cpp
index 2465b0778..f8fbb8a49 100644
--- a/device.cpp
+++ b/device.cpp
@@ -16,6 +16,29 @@
#include "device.h"
+#if defined(AB_OTA_UPDATER)
+
+static const char* MENU_ITEMS[] = {
+ "Reboot system now",
+ "Reboot to bootloader",
+ "Wipe data/factory reset",
+ "Mount /system",
+ "Run graphics test",
+ "Power off",
+ NULL,
+};
+
+static const Device::BuiltinAction MENU_ACTIONS[] = {
+ Device::REBOOT,
+ Device::REBOOT_BOOTLOADER,
+ Device::WIPE_DATA,
+ Device::MOUNT_SYSTEM,
+ Device::RUN_GRAPHICS_TEST,
+ Device::SHUTDOWN,
+};
+
+#else
+
static const char* MENU_ITEMS[] = {
"Reboot system now",
"Reboot to bootloader",
@@ -27,27 +50,30 @@ static const char* MENU_ITEMS[] = {
"View recovery logs",
"Run graphics test",
"Power off",
- NULL
+ NULL,
};
+static const Device::BuiltinAction MENU_ACTIONS[] = {
+ Device::REBOOT,
+ Device::REBOOT_BOOTLOADER,
+ Device::APPLY_ADB_SIDELOAD,
+ Device::APPLY_SDCARD,
+ Device::WIPE_DATA,
+ Device::WIPE_CACHE,
+ Device::MOUNT_SYSTEM,
+ Device::VIEW_RECOVERY_LOGS,
+ Device::RUN_GRAPHICS_TEST,
+ Device::SHUTDOWN,
+};
+
+#endif
+
const char* const* Device::GetMenuItems() {
return MENU_ITEMS;
}
Device::BuiltinAction Device::InvokeMenuItem(int menu_position) {
- switch (menu_position) {
- case 0: return REBOOT;
- case 1: return REBOOT_BOOTLOADER;
- case 2: return APPLY_ADB_SIDELOAD;
- case 3: return APPLY_SDCARD;
- case 4: return WIPE_DATA;
- case 5: return WIPE_CACHE;
- case 6: return MOUNT_SYSTEM;
- case 7: return VIEW_RECOVERY_LOGS;
- case 8: return RUN_GRAPHICS_TEST;
- case 9: return SHUTDOWN;
- default: return NO_ACTION;
- }
+ return menu_position < 0 ? NO_ACTION : MENU_ACTIONS[menu_position];
}
int Device::HandleMenuKey(int key, int visible) {