How to customized UI on recovery mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to customized UI on recovery mode

How to customized UI on recovery mode

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 };

Tags (2)
%3CLINGO-SUB%20id%3D%22lingo-sub-1111503%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20customized%20UI%20on%20recovery%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111503%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%2C%20sans-serif%3B%20font-size%3A%2011pt%3B%20line-height%3A%201.5em%3B%22%3ESince%20JB4.3%2C%20we%20have%20added%20a%20customer%20library%20in%20myandroid%2Fdevices%2Ffsl%2Fcommon%2Frecovery%20to%20give%20a%20chance%20for%20customer%20to%20customize%20their%20UI%20menu%20in%20recovery.img%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%20font-family%3A%20Calibri%2C%20sans-serif%3B%22%3EBe%20sure%20you%20define%20the%20%3CSPAN%20style%3D%22font-family%3A%20Calibri%2C%20sans-serif%3B%20font-size%3A%2015px%3B%22%3ETARGET_RECOVERY_UI_LIB%20to%20be%20same%20as%20your%20defined%20in%20Android.mk%20in%20%3C%2FSPAN%3E%20%3CSPAN%20style%3D%22font-family%3A%20Calibri%2C%20sans-serif%3B%20font-size%3A%2015px%3B%22%3Emyandroid%2Fdevices%2Ffsl%2Fcommon%2Frecovery%3C%2FSPAN%3E%2C%20as%20we%20did%20in%20myandroid%2Fdevices%2Ffsl%2Fimx6%2FBoardConfigCommon.mk%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%20font-family%3A%20Calibri%2C%20sans-serif%3B%22%3ETARGET_RECOVERY_UI_LIB%20%3A%3D%20librecovery_ui_imx%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%20font-family%3A%20Calibri%2C%20sans-serif%3B%22%3EOnce%20you%20defined%20%3CSPAN%20style%3D%22font-family%3A%20Calibri%2C%20sans-serif%3B%20font-size%3A%2015px%3B%22%3ETARGET_RECOVERY_UI_LIB%3C%2FSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%2C%20sans-serif%3B%20font-size%3A%2015px%3B%20line-height%3A%201.5em%3B%22%3Emyandroid%2Fbootable%2Frecovery%20will%20use%20the%20one%20to%20replace%20the%20default%20ui%20lib%26nbsp%3B%20as%20the%20source%20code%20myandroid%2Fbootable%2Frecovery%2Fdefault_device.cpp.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%2C%20sans-serif%3B%20font-size%3A%2015px%3B%20line-height%3A%201.5em%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2011pt%3B%20font-family%3A%20Calibri%2C%20sans-serif%3B%22%3EBy%20default%2C%20we%20define%20below%20menu%20as%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Econst%20char*%20ITEMS%5B%5D%20%3D%20%7B%20%22reboot%20system%20now%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20%22apply%20update%20from%20ADB%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20%22wipe%20data%2Ffactory%20reset%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20%22wipe%20cache%20partition%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20NULL%20%7D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2011pt%3B%20font-family%3A%20Calibri%2C%20sans-serif%3B%22%3EBelow%20is%20an%20example%20to%20add%20a%20new%20menu%20as%20%22apply%20update%20from%20SD%20Card%22%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Ediff%20--git%20a%2Fcommon%2Frecovery%2Frecovery_ui.cpp%20b%2Fcommon%2Frecovery%2Frecovery_ui.cpp%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Eindex%20ccf8ccd..9cbd91e%20100644%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E---%20a%2Fcommon%2Frecovery%2Frecovery_ui.cpp%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%2B%2B%2B%20b%2Fcommon%2Frecovery%2Frecovery_ui.cpp%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%40%40%20-31%2C6%20%2B31%2C7%20%40%40%20const%20char*%20HEADERS%5B%5D%20%3D%20%7B%20%22Volume%20up%2Fdown%20to%20move%20highlight%3B%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Econst%20char*%20ITEMS%5B%5D%20%3D%20%7B%20%22reboot%20system%20now%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20%22apply%20update%20from%20ADB%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%2B%20%22apply%20update%20from%20SD%20Card%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20%22wipe%20data%2Ffactory%20reset%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20%22wipe%20cache%20partition%22%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20NULL%20%7D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%40%40%20-77%2C8%20%2B78%2C9%20%40%40%20class%20ImxDevice%20%3A%20public%20Device%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Eswitch%20(menu_position)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Ecase%200%3A%20return%20REBOOT%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Ecase%201%3A%20return%20APPLY_ADB_SIDELOAD%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E-%20case%202%3A%20return%20WIPE_DATA%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E-%20case%203%3A%20return%20WIPE_CACHE%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%2B%20case%202%3A%20return%20APPLY_EXT%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%2B%20case%203%3A%20return%20WIPE_DATA%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%2B%20case%204%3A%20return%20WIPE_CACHE%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3Edefault%3A%20return%20NO_ACTION%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2011pt%3B%20font-family%3A%20Calibri%2C%20sans-serif%3B%22%3EThe%20handle%20on%20the%20menu%20is%20defined%20in%20function%20prompt_and_wait(Device*%20device%2C%20int%20status)%20in%20myandroid%2Fbootable%2Frecovery%2Frecovery.cpp.%20Below%20is%20the%20buildin%20menu%20function%20in%20recovery.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20enum%20BuiltinAction%20%7B%20NO_ACTION%2C%20REBOOT%2C%20APPLY_EXT%2C%20APPLY_CACHE%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%22%3E%26nbsp%3B%20APPLY_ADB_SIDELOAD%2C%20WIPE_DATA%2C%20WIPE_CACHE%20%7D%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎08-27-2014 06:42 PM
Updated by: