diff options
author | Doug Zongker <dougz@android.com> | 2009-06-19 00:07:14 +0200 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2009-06-19 00:07:14 +0200 |
commit | b128f54d0daa749d301b99a6637f42aa35822a76 (patch) | |
tree | 889519250f40824c6df6ea197a8edee75cf95e10 | |
parent | am 47cace98: add file_getprop() to updater (diff) | |
download | android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.gz android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.bz2 android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.lz android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.xz android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.zst android_bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.zip |
-rw-r--r-- | default_recovery_ui.c | 4 | ||||
-rw-r--r-- | recovery.c | 9 | ||||
-rw-r--r-- | recovery_ui.h | 8 | ||||
-rw-r--r-- | roots.c | 1 |
4 files changed, 20 insertions, 2 deletions
diff --git a/default_recovery_ui.c b/default_recovery_ui.c index 76fa43ea9..a2e4beafe 100644 --- a/default_recovery_ui.c +++ b/default_recovery_ui.c @@ -59,3 +59,7 @@ int device_handle_key(int key_code, int visible) { int device_perform_action(int which) { return which; } + +int device_wipe_data() { + return 0; +} diff --git a/recovery.c b/recovery.c index 8ad133948..499fda574 100644 --- a/recovery.c +++ b/recovery.c @@ -354,6 +354,7 @@ prompt_and_wait() case ITEM_WIPE_DATA: ui_print("\n-- Wiping data...\n"); + device_wipe_data(); erase_root("DATA:"); erase_root("CACHE:"); ui_print("Data wipe complete.\n"); @@ -463,10 +464,14 @@ main(int argc, char **argv) if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted.\n"); - } else if (wipe_data || wipe_cache) { - if (wipe_data && erase_root("DATA:")) status = INSTALL_ERROR; + } else if (wipe_data) { + if (device_wipe_data()) status = INSTALL_ERROR; + if (erase_root("DATA:")) status = INSTALL_ERROR; if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed.\n"); + } else if (wipe_cache) { + if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR; + if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed.\n"); } else { status = INSTALL_ERROR; // No command specified } diff --git a/recovery_ui.h b/recovery_ui.h index 86f540b6e..671fe40ce 100644 --- a/recovery_ui.h +++ b/recovery_ui.h @@ -48,6 +48,14 @@ extern int device_handle_key(int key, int visible); // information to the screen. extern int device_perform_action(int which); +// Called when we do a wipe data/factory reset operation (either via a +// reboot from the main system with the --wipe_data flag, or when the +// user boots into recovery manually and selects the option from the +// menu.) Can perform whatever device-specific wiping actions are +// needed. Return 0 on success. The userdata and cache partitions +// are erased after this returns (whether it returns success or not). +int device_wipe_data(); + #define NO_ACTION -1 #define HIGHLIGHT_UP -2 @@ -52,6 +52,7 @@ static RootInfo g_roots[] = { { "RECOVERY:", g_mtd_device, NULL, "recovery", "/", g_raw }, { "SDCARD:", "/dev/block/mmcblk0p1", "/dev/block/mmcblk0", NULL, "/sdcard", "vfat" }, { "SYSTEM:", g_mtd_device, NULL, "system", "/system", "yaffs2" }, + { "MBM:", g_mtd_device, NULL, "mbm", NULL, g_raw }, { "TMP:", NULL, NULL, NULL, "/tmp", NULL }, }; #define NUM_ROOTS (sizeof(g_roots) / sizeof(g_roots[0])) |