Merge "Added Power off capability" into gingerbread
This commit is contained in:
commit
75b2fa023b
@ -30,6 +30,7 @@ char* MENU_ITEMS[] = { "reboot system now",
|
||||
"backup and restore",
|
||||
"mounts and storage",
|
||||
"advanced",
|
||||
"power off",
|
||||
NULL };
|
||||
|
||||
int device_recovery_start() {
|
||||
|
15
recovery.c
15
recovery.c
@ -61,6 +61,7 @@ static const char *LOG_FILE = "/cache/recovery/log";
|
||||
static const char *LAST_LOG_FILE = "/cache/recovery/last_log";
|
||||
static const char *SDCARD_ROOT = "/sdcard";
|
||||
static int allow_display_toggle = 1;
|
||||
static int poweroff = 0;
|
||||
static const char *SDCARD_PACKAGE_FILE = "/sdcard/update.zip";
|
||||
static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
|
||||
static const char *SIDELOAD_TEMP_DIR = "/tmp/sideload";
|
||||
@ -707,6 +708,7 @@ prompt_and_wait() {
|
||||
|
||||
switch (chosen_item) {
|
||||
case ITEM_REBOOT:
|
||||
poweroff=0;
|
||||
return;
|
||||
|
||||
case ITEM_WIPE_DATA:
|
||||
@ -751,6 +753,9 @@ prompt_and_wait() {
|
||||
case ITEM_ADVANCED:
|
||||
show_advanced_menu();
|
||||
break;
|
||||
case ITEM_POWEROFF:
|
||||
poweroff=1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -782,6 +787,9 @@ main(int argc, char **argv) {
|
||||
return nandroid_main(argc, argv);
|
||||
if (strstr(argv[0], "reboot"))
|
||||
return reboot_main(argc, argv);
|
||||
if (strstr(argv[0], "poweroff")){
|
||||
return reboot_main(argc, argv);
|
||||
}
|
||||
if (strstr(argv[0], "setprop"))
|
||||
return setprop_main(argc, argv);
|
||||
return busybox_driver(argc, argv);
|
||||
@ -939,9 +947,12 @@ main(int argc, char **argv) {
|
||||
|
||||
// Otherwise, get ready to boot the main system...
|
||||
finish_recovery(send_intent);
|
||||
ui_print("Rebooting...\n");
|
||||
if(!poweroff)
|
||||
ui_print("Rebooting...\n");
|
||||
else
|
||||
ui_print("Shutting down...\n");
|
||||
sync();
|
||||
reboot(RB_AUTOBOOT);
|
||||
reboot((!poweroff) ? RB_AUTOBOOT : RB_POWER_OFF);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ int device_wipe_data();
|
||||
#define ITEM_NANDROID 5
|
||||
#define ITEM_PARTITION 6
|
||||
#define ITEM_ADVANCED 7
|
||||
#define ITEM_POWEROFF 8
|
||||
|
||||
// Header text to display above the main menu.
|
||||
extern char* MENU_HEADERS[];
|
||||
|
Loading…
Reference in New Issue
Block a user