aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2016-05-23 19:43:41 -0500
committerElliott Hughes2016-05-23 19:44:50 -0500
commit01fcbe160bd49891c0680b80c5688cd4feb2adbc (patch)
treef2f6c428f7b751fe2e589bbe73d7d77f9777a738 /device.cpp
parent3aabd770d916019d0656bbcd8b102a4033a26a38 (diff)
downloadplatform-bootable-recovery-01fcbe160bd49891c0680b80c5688cd4feb2adbc.tar.gz
platform-bootable-recovery-01fcbe160bd49891c0680b80c5688cd4feb2adbc.tar.xz
platform-bootable-recovery-01fcbe160bd49891c0680b80c5688cd4feb2adbc.zip
Disable the meaningless parts of the UI for A/B.
Bug: http://b/28748484 Change-Id: Ie86a265f4699503471e7c717d65677a916dbd25b
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 2465b077..f8fbb8a4 100644
--- a/device.cpp
+++ b/device.cpp
@@ -16,6 +16,29 @@
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
19static const char* MENU_ITEMS[] = { 42static const char* MENU_ITEMS[] = {
20 "Reboot system now", 43 "Reboot system now",
21 "Reboot to bootloader", 44 "Reboot to bootloader",
@@ -27,27 +50,30 @@ static const char* MENU_ITEMS[] = {
27 "View recovery logs", 50 "View recovery logs",
28 "Run graphics test", 51 "Run graphics test",
29 "Power off", 52 "Power off",
30 NULL 53 NULL,
31}; 54};
32 55
56static const Device::BuiltinAction MENU_ACTIONS[] = {
57 Device::REBOOT,
58 Device::REBOOT_BOOTLOADER,
59 Device::APPLY_ADB_SIDELOAD,
60 Device::APPLY_SDCARD,
61 Device::WIPE_DATA,
62 Device::WIPE_CACHE,
63 Device::MOUNT_SYSTEM,
64 Device::VIEW_RECOVERY_LOGS,
65 Device::RUN_GRAPHICS_TEST,
66 Device::SHUTDOWN,
67};
68
69#endif
70
33const char* const* Device::GetMenuItems() { 71const char* const* Device::GetMenuItems() {
34 return MENU_ITEMS; 72 return MENU_ITEMS;
35} 73}
36 74
37Device::BuiltinAction Device::InvokeMenuItem(int menu_position) { 75Device::BuiltinAction Device::InvokeMenuItem(int menu_position) {
38 switch (menu_position) { 76 return menu_position < 0 ? NO_ACTION : MENU_ACTIONS[menu_position];
39 case 0: return REBOOT;
40 case 1: return REBOOT_BOOTLOADER;
41 case 2: return APPLY_ADB_SIDELOAD;
42 case 3: return APPLY_SDCARD;
43 case 4: return WIPE_DATA;
44 case 5: return WIPE_CACHE;
45 case 6: return MOUNT_SYSTEM;
46 case 7: return VIEW_RECOVERY_LOGS;
47 case 8: return RUN_GRAPHICS_TEST;
48 case 9: return SHUTDOWN;
49 default: return NO_ACTION;
50 }
51} 77}
52 78
53int Device::HandleMenuKey(int key, int visible) { 79int Device::HandleMenuKey(int key, int visible) {