Since JB4.3, we have added a customer library in myandroid/devices/fsl/common/recovery to give a chance for customer to customize their UI menu in recovery.img
Be sure you define the TARGET_RECOVERY_UI_LIB to be same as your defined in Android.mk in myandroid/devices/fsl/common/recovery, as we did in myandroid/devices/fsl/imx6/BoardConfigCommon.mk
TARGET_RECOVERY_UI_LIB := librecovery_ui_imx
Once you defined TARGET_RECOVERY_UI_LIB, myandroid/bootable/recovery will use the one to replace the default ui lib as the source code myandroid/bootable/recovery/default_device.cpp.
By default, we define below menu as below:
const char* ITEMS[] = { "reboot system now",
"apply update from ADB",
"wipe data/factory reset",
"wipe cache partition",
NULL };
Below is an example to add a new menu as "apply update from SD Card":
diff --git a/common/recovery/recovery_ui.cpp b/common/recovery/recovery_ui.cpp
index ccf8ccd..9cbd91e 100644
--- a/common/recovery/recovery_ui.cpp
+++ b/common/recovery/recovery_ui.cpp
@@ -31,6 +31,7 @@ const char* HEADERS[] = { "Volume up/down to move highlight;",
const char* ITEMS[] = { "reboot system now",
"apply update from ADB",
+ "apply update from SD Card",
"wipe data/factory reset",
"wipe cache partition",
NULL };
@@ -77,8 +78,9 @@ class ImxDevice : public Device {
switch (menu_position) {
case 0: return REBOOT;
case 1: return APPLY_ADB_SIDELOAD;
- case 2: return WIPE_DATA;
- case 3: return WIPE_CACHE;
+ case 2: return APPLY_EXT;
+ case 3: return WIPE_DATA;
+ case 4: return WIPE_CACHE;
default: return NO_ACTION;
}
}
The handle on the menu is defined in function prompt_and_wait(Device* device, int status) in myandroid/bootable/recovery/recovery.cpp. Below is the buildin menu function in recovery.
enum BuiltinAction { NO_ACTION, REBOOT, APPLY_EXT, APPLY_CACHE,
APPLY_ADB_SIDELOAD, WIPE_DATA, WIPE_CACHE };