Merge "Disable the meaningless parts of the UI for A/B." am: aa4924cab1

am: 8477a03a4a

Change-Id: I55c5febd094ada3a1147ab3ebefc866108ce33e8
This commit is contained in:
Tao Bao 2016-10-09 21:13:47 +00:00 committed by android-build-merger
commit 09ab9a6838
2 changed files with 44 additions and 14 deletions

View file

@ -101,6 +101,10 @@ LOCAL_HAL_STATIC_LIBRARIES := libhealthd
LOCAL_C_INCLUDES += system/extras/ext4_utils LOCAL_C_INCLUDES += system/extras/ext4_utils
LOCAL_STATIC_LIBRARIES += libext4_utils_static libz LOCAL_STATIC_LIBRARIES += libext4_utils_static libz
ifeq ($(AB_OTA_UPDATER),true)
LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
endif
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
ifeq ($(TARGET_RECOVERY_UI_LIB),) ifeq ($(TARGET_RECOVERY_UI_LIB),)

View file

@ -16,6 +16,29 @@
#include "device.h" #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[] = { static const char* MENU_ITEMS[] = {
"Reboot system now", "Reboot system now",
"Reboot to bootloader", "Reboot to bootloader",
@ -27,27 +50,30 @@ static const char* MENU_ITEMS[] = {
"View recovery logs", "View recovery logs",
"Run graphics test", "Run graphics test",
"Power off", "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() { const char* const* Device::GetMenuItems() {
return MENU_ITEMS; return MENU_ITEMS;
} }
Device::BuiltinAction Device::InvokeMenuItem(int menu_position) { Device::BuiltinAction Device::InvokeMenuItem(int menu_position) {
switch (menu_position) { return menu_position < 0 ? NO_ACTION : MENU_ACTIONS[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;
}
} }
int Device::HandleMenuKey(int key, int visible) { int Device::HandleMenuKey(int key, int visible) {