allow toggling of software back menu item. add recovery checkpoint file. mount auto now uses busybox mount.
This commit is contained in:
parent
efa6530dbd
commit
4ca9b4c3a0
@ -26,7 +26,7 @@ LOCAL_MODULE := recovery
|
||||
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
|
||||
RECOVERY_VERSION := ClockworkMod Recovery v2.0.2.2
|
||||
RECOVERY_VERSION := ClockworkMod Recovery v2.0.2.4
|
||||
LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
|
||||
RECOVERY_API_VERSION := 3
|
||||
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
|
||||
|
3
common.h
3
common.h
@ -47,6 +47,9 @@ int ui_menu_select(int sel);
|
||||
// statements will be displayed.
|
||||
void ui_end_menu();
|
||||
|
||||
int ui_get_showing_back_button();
|
||||
void ui_set_showing_back_button(int showBackButton);
|
||||
|
||||
// Set the icon (normally the only thing visible besides the progress bar).
|
||||
enum {
|
||||
BACKGROUND_ICON_NONE,
|
||||
|
@ -41,11 +41,10 @@ int device_toggle_display(volatile char* key_pressed, int key_code) {
|
||||
if (alt && key_code == KEY_L)
|
||||
return 1;
|
||||
// allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
|
||||
#ifdef KEY_POWER_IS_SELECT_ITEM
|
||||
return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
|
||||
#else
|
||||
if (ui_get_showing_back_button()) {
|
||||
return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
|
||||
}
|
||||
return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
|
||||
#endif
|
||||
}
|
||||
|
||||
int device_reboot_now(volatile char* key_pressed, int key_code) {
|
||||
@ -63,9 +62,13 @@ int device_handle_key(int key_code, int visible) {
|
||||
case KEY_VOLUMEUP:
|
||||
return HIGHLIGHT_UP;
|
||||
|
||||
#ifdef KEY_POWER_IS_SELECT_ITEM
|
||||
case KEY_POWER:
|
||||
#endif
|
||||
if (ui_get_showing_back_button()) {
|
||||
return SELECT_ITEM;
|
||||
}
|
||||
if (!get_allow_toggle_display())
|
||||
return GO_BACK;
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
case BTN_MOUSE:
|
||||
case KEY_CENTER:
|
||||
@ -74,9 +77,6 @@ int device_handle_key(int key_code, int visible) {
|
||||
case KEY_SEND:
|
||||
return SELECT_ITEM;
|
||||
|
||||
#ifndef KEY_POWER_IS_SELECT_ITEM
|
||||
case KEY_POWER:
|
||||
#endif
|
||||
case KEY_END:
|
||||
case KEY_BACKSPACE:
|
||||
case KEY_BACK:
|
||||
|
@ -627,6 +627,7 @@ int run_and_remove_extendedcommand()
|
||||
char tmp[PATH_MAX];
|
||||
sprintf(tmp, "cp %s /tmp/%s", EXTENDEDCOMMAND_SCRIPT, basename(EXTENDEDCOMMAND_SCRIPT));
|
||||
__system(tmp);
|
||||
__system("rm /sdcard/clockworkmod/.recoverycheckpoint");
|
||||
remove(EXTENDEDCOMMAND_SCRIPT);
|
||||
int i = 0;
|
||||
for (i = 20; i > 0; i--) {
|
||||
|
30
recovery.c
30
recovery.c
@ -338,12 +338,19 @@ get_menu_selection(char** headers, char** items, int menu_only) {
|
||||
int selected = 0;
|
||||
int chosen_item = -1;
|
||||
|
||||
// Some users with dead enter keys need a way to turn on power to select.
|
||||
// Jiggering across the wrapping menu is one "secret" way to enable it.
|
||||
// We can't rely on /cache or /sdcard since they may not be available.
|
||||
int wrap_count = 0;
|
||||
|
||||
while (chosen_item < 0 && chosen_item != GO_BACK) {
|
||||
int key = ui_wait_key();
|
||||
int visible = ui_text_visible();
|
||||
|
||||
int action = device_handle_key(key, visible);
|
||||
|
||||
int old_selected = selected;
|
||||
|
||||
if (action < 0) {
|
||||
switch (action) {
|
||||
case HIGHLIGHT_UP:
|
||||
@ -356,11 +363,11 @@ get_menu_selection(char** headers, char** items, int menu_only) {
|
||||
break;
|
||||
case SELECT_ITEM:
|
||||
chosen_item = selected;
|
||||
#ifdef KEY_POWER_IS_SELECT_ITEM
|
||||
if (chosen_item == item_count) {
|
||||
chosen_item = GO_BACK;
|
||||
if (ui_get_showing_back_button()) {
|
||||
if (chosen_item == item_count) {
|
||||
chosen_item = GO_BACK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case NO_ACTION:
|
||||
break;
|
||||
@ -371,6 +378,21 @@ get_menu_selection(char** headers, char** items, int menu_only) {
|
||||
} else if (!menu_only) {
|
||||
chosen_item = action;
|
||||
}
|
||||
|
||||
if (abs(selected - old_selected) > 1) {
|
||||
wrap_count++;
|
||||
if (wrap_count == 3) {
|
||||
wrap_count = 0;
|
||||
if (ui_get_showing_back_button()) {
|
||||
ui_print("Back button disabled.\n");
|
||||
ui_set_showing_back_button(0);
|
||||
}
|
||||
else {
|
||||
ui_print("Back button enabled.\n");
|
||||
ui_set_showing_back_button(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui_end_menu();
|
||||
|
17
roots.c
17
roots.c
@ -21,6 +21,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "mtdutils/mtdutils.h"
|
||||
#include "mtdutils/mounts.h"
|
||||
#include "minzip/Zip.h"
|
||||
@ -205,6 +207,18 @@ is_root_path_mounted(const char *root_path)
|
||||
return internal_root_mounted(info) >= 0;
|
||||
}
|
||||
|
||||
static int mount_internal(const char* device, const char* mount_point, const char* filesystem)
|
||||
{
|
||||
if (strcmp(filesystem, "auto") != 0) {
|
||||
return mount(device, mount_point, filesystem, MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
|
||||
}
|
||||
else {
|
||||
char mount_cmd[PATH_MAX];
|
||||
sprintf(mount_cmd, "mount -onoatime,nodiratime,nodev %s %s", device, mount_point);
|
||||
return __system(mount_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ensure_root_path_mounted(const char *root_path)
|
||||
{
|
||||
@ -245,8 +259,7 @@ ensure_root_path_mounted(const char *root_path)
|
||||
}
|
||||
|
||||
mkdir(info->mount_point, 0755); // in case it doesn't already exist
|
||||
if (mount(info->device, info->mount_point, info->filesystem,
|
||||
MS_NOATIME | MS_NODEV | MS_NODIRATIME, "")) {
|
||||
if (mount_internal(info->device, info->mount_point, info->filesystem)) {
|
||||
if (info->device2 == NULL) {
|
||||
LOGE("Can't mount %s\n(%s)\n", info->device, strerror(errno));
|
||||
return -1;
|
||||
|
2
roots.h
2
roots.h
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SDEXT_FILESYSTEM
|
||||
#define SDEXT_FILESYSTEM "ext4"
|
||||
#define SDEXT_FILESYSTEM "auto"
|
||||
#endif
|
||||
|
||||
#ifndef DATA_DEVICE
|
||||
|
30
ui.c
30
ui.c
@ -29,6 +29,12 @@
|
||||
#include "minui/minui.h"
|
||||
#include "recovery_ui.h"
|
||||
|
||||
#ifdef KEY_POWER_IS_SELECT_ITEM
|
||||
static int gShowBackButton = 1;
|
||||
#else
|
||||
static int gShowBackButton = 0;
|
||||
#endif
|
||||
|
||||
#define MAX_COLS 64
|
||||
#define MAX_ROWS 32
|
||||
|
||||
@ -500,10 +506,11 @@ int ui_start_menu(char** headers, char** items) {
|
||||
strncpy(menu[i] + MENU_ITEM_HEADER_LENGTH, items[i-menu_top], text_cols-1 - MENU_ITEM_HEADER_LENGTH);
|
||||
menu[i][text_cols-1] = '\0';
|
||||
}
|
||||
#ifdef KEY_POWER_IS_SELECT_ITEM
|
||||
strcpy(menu[i], " - +++++Go Back+++++");
|
||||
++i;
|
||||
#endif
|
||||
|
||||
if (gShowBackButton) {
|
||||
strcpy(menu[i], " - +++++Go Back+++++");
|
||||
++i;
|
||||
}
|
||||
|
||||
menu_items = i - menu_top;
|
||||
show_menu = 1;
|
||||
@ -511,11 +518,10 @@ int ui_start_menu(char** headers, char** items) {
|
||||
update_screen_locked();
|
||||
}
|
||||
pthread_mutex_unlock(&gUpdateMutex);
|
||||
#ifdef KEY_POWER_IS_SELECT_ITEM
|
||||
return menu_items - 1;
|
||||
#else
|
||||
if (gShowBackButton) {
|
||||
return menu_items - 1;
|
||||
}
|
||||
return menu_items;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ui_menu_select(int sel) {
|
||||
@ -591,3 +597,11 @@ void ui_clear_key_queue() {
|
||||
void ui_set_show_text(int value) {
|
||||
show_text = value;
|
||||
}
|
||||
|
||||
void ui_set_showing_back_button(int showBackButton) {
|
||||
gShowBackButton = showBackButton;
|
||||
}
|
||||
|
||||
int ui_get_showing_back_button() {
|
||||
return gShowBackButton;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user