aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'device.cpp')
-rw-r--r--device.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/device.cpp b/device.cpp
index f8fbb8a4..e717dddf 100644
--- a/device.cpp
+++ b/device.cpp
@@ -16,36 +16,15 @@
16 16
17#include "device.h" 17#include "device.h"
18 18
19#if defined(AB_OTA_UPDATER)
20
21static const char* MENU_ITEMS[] = {
22 "Reboot system now",
23 "Reboot to bootloader",
24 "Wipe data/factory reset",
25 "Mount /system",
26 "Run graphics test",
27 "Power off",
28 NULL,
29};
30
31static const Device::BuiltinAction MENU_ACTIONS[] = {
32 Device::REBOOT,
33 Device::REBOOT_BOOTLOADER,
34 Device::WIPE_DATA,
35 Device::MOUNT_SYSTEM,
36 Device::RUN_GRAPHICS_TEST,
37 Device::SHUTDOWN,
38};
39
40#else
41
42static const char* MENU_ITEMS[] = { 19static const char* MENU_ITEMS[] = {
43 "Reboot system now", 20 "Reboot system now",
44 "Reboot to bootloader", 21 "Reboot to bootloader",
45 "Apply update from ADB", 22 "Apply update from ADB",
46 "Apply update from SD card", 23 "Apply update from SD card",
47 "Wipe data/factory reset", 24 "Wipe data/factory reset",
25#ifndef AB_OTA_UPDATER
48 "Wipe cache partition", 26 "Wipe cache partition",
27#endif // !AB_OTA_UPDATER
49 "Mount /system", 28 "Mount /system",
50 "View recovery logs", 29 "View recovery logs",
51 "Run graphics test", 30 "Run graphics test",
@@ -59,14 +38,19 @@ static const Device::BuiltinAction MENU_ACTIONS[] = {
59 Device::APPLY_ADB_SIDELOAD, 38 Device::APPLY_ADB_SIDELOAD,
60 Device::APPLY_SDCARD, 39 Device::APPLY_SDCARD,
61 Device::WIPE_DATA, 40 Device::WIPE_DATA,
41#ifndef AB_OTA_UPDATER
62 Device::WIPE_CACHE, 42 Device::WIPE_CACHE,
43#endif // !AB_OTA_UPDATER
63 Device::MOUNT_SYSTEM, 44 Device::MOUNT_SYSTEM,
64 Device::VIEW_RECOVERY_LOGS, 45 Device::VIEW_RECOVERY_LOGS,
65 Device::RUN_GRAPHICS_TEST, 46 Device::RUN_GRAPHICS_TEST,
66 Device::SHUTDOWN, 47 Device::SHUTDOWN,
67}; 48};
68 49
69#endif 50static_assert(sizeof(MENU_ITEMS) / sizeof(MENU_ITEMS[0]) ==
51 sizeof(MENU_ACTIONS) / sizeof(MENU_ACTIONS[0]) + 1,
52 "MENU_ITEMS and MENU_ACTIONS should have the same length, "
53 "except for the extra NULL entry in MENU_ITEMS.");
70 54
71const char* const* Device::GetMenuItems() { 55const char* const* Device::GetMenuItems() {
72 return MENU_ITEMS; 56 return MENU_ITEMS;