aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2013-08-15 17:55:04 -0700
committerKoushik Dutta <koushd@gmail.com>2013-09-26 18:13:56 -0700
commit03ad1bfa8585391b88826dde41e66623c2f355a3 (patch)
treef8da5dd44bd54738ca0a91459c4082b3157f49f8
parent0f7f15cb1bd8e8811dbb8a427557d13993761478 (diff)
downloadandroid_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.mk2
-rw-r--r--extendedcommands.c4
-rw-r--r--recovery.c4
-rw-r--r--roots.c11
-rw-r--r--roots.h2
5 files changed, 14 insertions, 9 deletions
diff --git a/Android.mk b/Android.mk
index 29404ae3..8bc63e0f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -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) {
diff --git a/recovery.c b/recovery.c
index 60eb224d..2145b60e 100644
--- a/recovery.c
+++ b/recovery.c
@@ -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");
diff --git a/roots.c b/roots.c
index 44fa14ae..aedbdd92 100644
--- a/roots.c
+++ b/roots.c
@@ -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;
}
diff --git a/roots.h b/roots.h
index e9af4b62..4b139bf8 100644
--- a/roots.h
+++ b/roots.h
@@ -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_