Skip to content

Commit f88a3fe

Browse files
committed
Horizontal scrolling + Get rid of internal busybox to reduce size. (We have busybox on /xbin) + Fix of writing on the line
1 parent 254b0db commit f88a3fe

7 files changed

+66
-22
lines changed

Android.mk

+13-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ LOCAL_MODULE := recovery
4444

4545
LOCAL_FORCE_STATIC_EXECUTABLE := true
4646

47-
RECOVERY_VERSION := CM Recovery v2.5.1.0 & LK+XM0.4
47+
RECOVERY_VERSION := CM Recovery v2.5.1.0 & LK+XM0.5
4848
LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
4949
RECOVERY_API_VERSION := 2
5050
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
@@ -147,15 +147,15 @@ ifeq ($(BOARD_CUSTOM_RECOVERY_KEYMAPPING),)
147147
else
148148
LOCAL_SRC_FILES += $(BOARD_CUSTOM_RECOVERY_KEYMAPPING)
149149
endif
150-
LOCAL_STATIC_LIBRARIES += libbusybox libclearsilverregex libmkyaffs2image libunyaffs liberase_image libdump_image libflash_image libmtdutils
150+
LOCAL_STATIC_LIBRARIES += libclearsilverregex libmkyaffs2image libunyaffs liberase_image libdump_image libflash_image libmtdutils
151151
LOCAL_STATIC_LIBRARIES += libamend
152152
LOCAL_STATIC_LIBRARIES += libminzip libunz libmtdutils libmmcutils libmincrypt
153153
LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
154154
LOCAL_STATIC_LIBRARIES += libstdc++ libc
155155

156156
include $(BUILD_EXECUTABLE)
157157

158-
RECOVERY_LINKS := amend busybox flash_image dump_image mkyaffs2image unyaffs erase_image nandroid reboot
158+
RECOVERY_LINKS := amend flash_image dump_image mkyaffs2image unyaffs erase_image nandroid reboot
159159

160160
# nc is provided by external/netcat
161161
SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(RECOVERY_LINKS))
@@ -169,16 +169,16 @@ $(SYMLINKS): $(LOCAL_INSTALLED_MODULE)
169169
ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
170170

171171
# Now let's do recovery symlinks
172-
BUSYBOX_LINKS := $(shell cat external/busybox/busybox-minimal.links)
173-
SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS))))
174-
$(SYMLINKS): BUSYBOX_BINARY := busybox
175-
$(SYMLINKS): $(LOCAL_INSTALLED_MODULE)
176-
@echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
177-
@mkdir -p $(dir $@)
178-
@rm -rf $@
179-
$(hide) ln -sf $(BUSYBOX_BINARY) $@
180-
181-
ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
172+
#BUSYBOX_LINKS := $(shell cat external/busybox/busybox-minimal.links)
173+
#SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS))))
174+
#$(SYMLINKS): BUSYBOX_BINARY := /xbin/busybox
175+
#$(SYMLINKS): $(LOCAL_INSTALLED_MODULE)
176+
# @echo "Symlink: $@ -> $(BUSYBOX_BINARY)"
177+
# @mkdir -p $(dir $@)
178+
# @rm -rf $@
179+
# $(hide) ln -sf $(BUSYBOX_BINARY) $@
180+
181+
#ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
182182

183183
include $(CLEAR_VARS)
184184
LOCAL_MODULE := nandroid-md5.sh

common.h

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ int ui_wait_key(); // waits for a key/button press, returns the code
2727
int ui_key_pressed(int key); // returns >0 if the code is currently pressed
2828
int ui_text_visible(); // returns >0 if text log is currently visible
2929
void ui_clear_key_queue();
30+
void ui_menu_offset_inc(); //for horizontal scrolling
31+
void ui_menu_offset_dec();
3032

3133
// Write a message to the on-screen log shown with Alt-L (also to stderr).
3234
// The screen is small, and users may need to report these messages to support,
@@ -118,6 +120,8 @@ void ui_reset_progress();
118120
#define KEY_I5700_CENTER 204
119121
#define KEY_I5700_DOWN 210
120122
#define KEY_I5700_UP 202
123+
#define KEY_I5700_LEFT 218 //For horizontal scrolling
124+
#define KEY_I5700_RIGHT 203
121125

122126
//Redefine defaults
123127
#undef KEY_HOME
@@ -150,6 +154,10 @@ void ui_reset_progress();
150154
#define KEY_DOWN KEY_I5700_DOWN
151155
#undef KEY_UP
152156
#define KEY_UP KEY_I5700_UP
157+
#undef KEY_LEFT
158+
#define KEY_LEFT KEY_I5700_LEFT
159+
#undef KEY_RIGHT
160+
#define KEY_RIGHT KEY_I5700_RIGHT
153161
#undef KEY_SEND
154162
#define KEY_SEND KEY_I5700_CENTER
155163

default_recovery_ui.c

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ int device_handle_key(int key_code, int visible) {
6565
case KEY_VOLUMEUP:
6666
return HIGHLIGHT_UP;
6767

68+
case KEY_LEFT:
69+
return SCROLL_LEFT;
70+
case KEY_RIGHT:
71+
return SCROLL_RIGHT;
72+
6873
case KEY_POWER:
6974
if (ui_get_showing_back_button()) {
7075
return SELECT_ITEM;

extendedcommands.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ void show_choose_zip_menu()
329329

330330
// This was pulled from bionic: The default system command always looks
331331
// for shell in /system/bin/sh. This is bad.
332-
#define _PATH_BSHELL "/sbin/ash"
332+
#define _PATH_BSHELL "/xbin/busybox"
333333

334334
extern char **environ;
335335
int

recovery.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,15 @@ get_menu_selection(char** headers, char** items, int menu_only) {
373373

374374
int action = device_handle_key(key, visible);
375375
int old_selected = selected;
376-
376+
377377
if (action < 0) {
378378
switch (action) {
379+
case SCROLL_LEFT:
380+
ui_menu_offset_dec();
381+
break;
382+
case SCROLL_RIGHT:
383+
ui_menu_offset_inc();
384+
break;
379385
case HIGHLIGHT_UP:
380386
--selected;
381387
selected = ui_menu_select(selected);
@@ -985,7 +991,7 @@ main(int argc, char **argv) {
985991
return reboot_main(argc, argv);
986992
if (strstr(argv[0], "setprop"))
987993
return setprop_main(argc, argv);
988-
return busybox_driver(argc, argv);
994+
//return busybox_driver(argc, argv);
989995
}
990996
//create_fstab();
991997

recovery_ui.h

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ int device_wipe_data();
6565
#define HIGHLIGHT_DOWN -3
6666
#define SELECT_ITEM -4
6767
#define GO_BACK -5
68+
#define SCROLL_LEFT -6
69+
#define SCROLL_RIGHT -7
6870

6971
#define ITEM_REBOOT 0
7072
#define ITEM_APPLY_SDCARD 1

ui.c

+29-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ static int gShowBackButton = 0;
3838
#define MAX_COLS 64
3939
#define MAX_ROWS 32
4040

41-
#define MENU_MAX_COLS 64
41+
//#define MENU_MAX_COLS 64
42+
#define MENU_MAX_COLS 255
4243
#define MENU_MAX_ROWS 250
4344

4445
#define CHAR_WIDTH 10
@@ -93,6 +94,7 @@ static char menu[MENU_MAX_ROWS][MENU_MAX_COLS];
9394
static int show_menu = 0;
9495
static int menu_top = 0, menu_items = 0, menu_sel = 0;
9596
static int menu_show_start = 0; // this is line which menu display is starting at
97+
static unsigned int menu_start_char = 0; //The first char to be displayed (If not higher than the last char of an item)
9698

9799
// Key event input queue
98100
static pthread_mutex_t key_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -195,23 +197,28 @@ static void draw_screen_locked(void)
195197
j = menu_items - menu_show_start;
196198

197199
gr_color(MENU_TEXT_COLOR);
200+
unsigned int max=0;
198201
for (i = menu_show_start + menu_top; i < (menu_show_start + menu_top + j); ++i) {
202+
unsigned int x;
203+
if ( strlen(menu[i]) > max ) max = strlen(menu[i]);
204+
for (x=menu_start_char; x >= strlen(menu[i]) || menu[i][x] == '\0'; --x);
199205
if (i == menu_top + menu_sel) {
200206
gr_color(255, 255, 255, 255);
201-
draw_text_line(i - menu_show_start , menu[i]);
207+
draw_text_line(i - menu_show_start , &(menu[i][x]));
202208
gr_color(MENU_TEXT_COLOR);
203209
} else {
204210
gr_color(MENU_TEXT_COLOR);
205-
draw_text_line(i - menu_show_start, menu[i]);
211+
draw_text_line(i - menu_show_start, &(menu[i][x]));
206212
}
207213
row++;
208214
}
215+
if ( menu_start_char >= max ) menu_start_char = max-1;
209216
gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
210217
gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
211218
}
212219

213220
gr_color(NORMAL_TEXT_COLOR);
214-
for (; row < text_rows; ++row) {
221+
for (++row; row < text_rows; ++row) { //Fix for writing on the line
215222
draw_text_line(row, text[(row+text_top) % text_rows]);
216223
}
217224
}
@@ -502,8 +509,8 @@ int ui_start_menu(char** headers, char** items) {
502509
for (; i < MENU_MAX_ROWS; ++i) {
503510
if (items[i-menu_top] == NULL) break;
504511
strcpy(menu[i], MENU_ITEM_HEADER);
505-
strncpy(menu[i] + MENU_ITEM_HEADER_LENGTH, items[i-menu_top], text_cols-1 - MENU_ITEM_HEADER_LENGTH);
506-
menu[i][text_cols-1] = '\0';
512+
strncpy(menu[i] + MENU_ITEM_HEADER_LENGTH, items[i-menu_top], MENU_MAX_COLS-1 - MENU_ITEM_HEADER_LENGTH);
513+
menu[i][MENU_MAX_COLS-1] = '\0';
507514
}
508515

509516
if (gShowBackButton) {
@@ -514,6 +521,7 @@ int ui_start_menu(char** headers, char** items) {
514521
menu_items = i - menu_top;
515522
show_menu = 1;
516523
menu_sel = menu_show_start = 0;
524+
menu_start_char = 0;
517525
update_screen_locked();
518526
}
519527
pthread_mutex_unlock(&gUpdateMutex);
@@ -523,6 +531,21 @@ int ui_start_menu(char** headers, char** items) {
523531
return menu_items;
524532
}
525533

534+
void ui_menu_offset_inc() {
535+
pthread_mutex_lock(&gUpdateMutex);
536+
++menu_start_char;
537+
update_screen_locked();
538+
pthread_mutex_unlock(&gUpdateMutex);
539+
}
540+
541+
void ui_menu_offset_dec() {
542+
pthread_mutex_lock(&gUpdateMutex);
543+
if ( menu_start_char > 0 )
544+
--menu_start_char;
545+
update_screen_locked();
546+
pthread_mutex_unlock(&gUpdateMutex);
547+
}
548+
526549
int ui_menu_select(int sel) {
527550
int old_sel;
528551
pthread_mutex_lock(&gUpdateMutex);

0 commit comments

Comments
 (0)