Add the volume command for seeing the current recovery.fstab. Support crazy HTC chargemode.
Change-Id: I26a6e83dc5704aa03ab3aa078f24f8943cf13614
This commit is contained in:
parent
b4c5fd6305
commit
d8e21c3712
@ -66,7 +66,7 @@ LOCAL_C_INCLUDES += system/extras/ext4_utils
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
RECOVERY_LINKS := edify busybox flash_image dump_image mkyaffs2image unyaffs erase_image nandroid reboot
|
||||
RECOVERY_LINKS := edify busybox flash_image dump_image mkyaffs2image unyaffs erase_image nandroid reboot volume
|
||||
|
||||
# nc is provided by external/netcat
|
||||
RECOVERY_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(RECOVERY_LINKS))
|
||||
|
@ -1099,4 +1099,29 @@ int is_path_mounted(const char* path) {
|
||||
int has_datadata() {
|
||||
Volume *vol = volume_for_path("/datadata");
|
||||
return vol != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int volume_main(int argc, char **argv) {
|
||||
load_volume_table();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_chargemode() {
|
||||
const char* filename = "/proc/cmdline";
|
||||
struct stat file_info;
|
||||
if (0 != stat(filename, &file_info))
|
||||
return;
|
||||
|
||||
int file_len = file_info.st_size;
|
||||
char* file_data = (char*)malloc(file_len + 1);
|
||||
FILE *file = fopen(filename, "rb");
|
||||
if (file == NULL)
|
||||
return;
|
||||
fread(file_data, file_len, 1, file);
|
||||
// supposedly not necessary, but let's be safe.
|
||||
file_data[file_len] = '\0';
|
||||
fclose(file);
|
||||
|
||||
if (strstr(file_data, "androidboot.mode=offmode_charging") != NULL)
|
||||
reboot(RB_POWER_OFF);
|
||||
}
|
@ -766,6 +766,8 @@ main(int argc, char **argv) {
|
||||
{
|
||||
if (strstr(argv[0], "flash_image") != NULL)
|
||||
return flash_image_main(argc, argv);
|
||||
if (strstr(argv[0], "volume") != NULL)
|
||||
return volume_main(argc, argv);
|
||||
if (strstr(argv[0], "edify") != NULL)
|
||||
return edify_main(argc, argv);
|
||||
if (strstr(argv[0], "dump_image") != NULL)
|
||||
@ -784,6 +786,7 @@ main(int argc, char **argv) {
|
||||
return setprop_main(argc, argv);
|
||||
return busybox_driver(argc, argv);
|
||||
}
|
||||
handle_chargemode();
|
||||
__system("/sbin/postrecoveryboot.sh");
|
||||
|
||||
int is_user_initiated_recovery = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user