From 50732e3c67454e174f008ba5443b21070f360a56 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 7 Jul 2011 12:44:05 -0700 Subject: [PATCH] backup and restore of /sdcard/Android (see getExternalFilesDir) Change-Id: I6306464cdce4e3b48e0d109284e5606f65a84ee2 --- Android.mk | 2 +- edifyscripting.c | 4 ++++ nandroid.c | 13 +++++++++++++ recovery.c | 3 ++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Android.mk b/Android.mk index 519b8ca..d65f650 100644 --- a/Android.mk +++ b/Android.mk @@ -26,7 +26,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.5 +RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.8 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) diff --git a/edifyscripting.c b/edifyscripting.c index 89554d7..1634a9e 100644 --- a/edifyscripting.c +++ b/edifyscripting.c @@ -145,6 +145,10 @@ Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) { free(path); return StringValue(strdup("")); } + if (0 != format_volume("/sdcard/Android")) { + free(path); + return StringValue(strdup("")); + } } done: diff --git a/nandroid.c b/nandroid.c index af97e86..8bb82f1 100644 --- a/nandroid.c +++ b/nandroid.c @@ -277,6 +277,16 @@ int nandroid_backup(const char* backup_path) return ret; } + if (0 != stat("/sdcard/Android", &s)) + { + ui_print("No /sdcard/Android found. Skipping backup of application files on external storage.\n"); + } + else + { + if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/sdcard/Android", 0))) + return ret; + } + if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/cache", 0))) return ret; @@ -514,6 +524,9 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/.android_secure", 0))) return ret; + if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/Android", 0))) + return ret; + if (restore_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/cache", 0))) return ret; diff --git a/recovery.c b/recovery.c index 89fb214..e69a461 100644 --- a/recovery.c +++ b/recovery.c @@ -686,6 +686,7 @@ wipe_data(int confirm) { } erase_volume("/sd-ext"); erase_volume("/sdcard/.android_secure"); + erase_volume("/sdcard/Android"); ui_print("Data wipe complete.\n"); } @@ -826,7 +827,7 @@ main(int argc, char **argv) { case 'p': previous_runs = atoi(optarg); break; case 's': send_intent = optarg; break; case 'u': update_package = optarg; break; - case 'w': + case 'w': #ifndef BOARD_RECOVERY_ALWAYS_WIPES wipe_data = wipe_cache = 1; #endif