diff options
author | Koushik Dutta <koushd@gmail.com> | 2013-08-15 17:55:04 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2013-09-26 18:13:56 -0700 |
commit | 03ad1bfa8585391b88826dde41e66623c2f355a3 (patch) | |
tree | f8da5dd44bd54738ca0a91459c4082b3157f49f8 | |
parent | 0f7f15cb1bd8e8811dbb8a427557d13993761478 (diff) | |
download | android_bootable_recovery-cm-10.1.tar.gz android_bootable_recovery-cm-10.1.tar.bz2 android_bootable_recovery-cm-10.1.zip |
Fix issue where android device manager, etc, dont actually wipe data.cm-10.1
--wipe_data issues via /cache/recovery/command will now completely format data.
All other manual wipe commands will preserve data on /data/media.
There is another mounts/storage option that will do a true data format.
Change-Id: Ie8ecd2b0e14c3bb1d8a404ea868cdf703455d2ab
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | extendedcommands.c | 4 | ||||
-rw-r--r-- | recovery.c | 4 | ||||
-rw-r--r-- | roots.c | 11 | ||||
-rw-r--r-- | roots.h | 2 |
5 files changed, 14 insertions, 9 deletions
@@ -38,7 +38,7 @@ RECOVERY_NAME := CWM-based Recovery endif endif -RECOVERY_VERSION := $(RECOVERY_NAME) v6.0.3.6 +RECOVERY_VERSION := $(RECOVERY_NAME) v6.0.3.7 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 diff --git a/extendedcommands.c b/extendedcommands.c index 7ceed7cf..2a42778a 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -936,13 +936,13 @@ void show_partition_menu() else { if (!confirm_selection("format /data and /data/media (/sdcard)", confirm)) continue; - handle_data_media_format(1); + ignore_data_media_workaround(1); ui_print("Formatting /data...\n"); if (0 != format_volume("/data")) ui_print("Error formatting /data!\n"); else ui_print("Done.\n"); - handle_data_media_format(0); + ignore_data_media_workaround(0); } } else if (chosen_item < mountable_volumes) { @@ -758,7 +758,9 @@ setup_adbd() { check_and_fclose(file_src, key_src); } } + ignore_data_media_workaround(1); ensure_path_unmounted("/data"); + ignore_data_media_workaround(0); // Trigger (re)start of adb daemon property_set("service.adb.root", "1"); @@ -924,7 +926,9 @@ main(int argc, char **argv) { if (status != INSTALL_SUCCESS) ui_print("Installation aborted.\n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; + ignore_data_media_workaround(1); if (erase_volume("/data")) status = INSTALL_ERROR; + ignore_data_media_workaround(0); if (has_datadata() && erase_volume("/datadata")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed.\n"); @@ -306,9 +306,11 @@ int ensure_path_mounted_at_mount_point(const char* path, const char* mount_point return -1; } +static int ignore_data_media = 0; + int ensure_path_unmounted(const char* path) { // if we are using /data/media, do not ever unmount volumes /data or /sdcard - if (strstr(path, "/data") == path && is_data_media()) { + if (strstr(path, "/data") == path && is_data_media() && !ignore_data_media) { return 0; } @@ -343,7 +345,6 @@ int ensure_path_unmounted(const char* path) { } extern struct selabel_handle *sehandle; -static int handle_data_media = 0; int format_volume(const char* volume) { Volume* v = volume_for_path(volume); @@ -359,7 +360,7 @@ int format_volume(const char* volume) { } // check to see if /data is being formatted, and if it is /data/media // Note: the /sdcard check is redundant probably, just being safe. - if (strstr(volume, "/data") == volume && is_data_media() && !handle_data_media) { + if (strstr(volume, "/data") == volume && is_data_media() && !ignore_data_media) { return format_unknown_device(NULL, volume, NULL); } if (strcmp(v->fs_type, "ramdisk") == 0) { @@ -419,6 +420,6 @@ int format_volume(const char* volume) { return format_unknown_device(v->device, volume, v->fs_type); } -void handle_data_media_format(int handle) { - handle_data_media = handle; +void ignore_data_media_workaround(int ignore) { + ignore_data_media = ignore; } @@ -46,6 +46,6 @@ Volume* get_device_volumes(); int is_data_media(); void setup_data_media(); int is_data_media_volume_path(const char* path); -void handle_data_media_format(int handle); +void ignore_data_media_workaround(int ignore); #endif // RECOVERY_ROOTS_H_ |