diff options
author | Doug Zongker <dougz@android.com> | 2009-06-18 15:07:14 -0700 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2009-06-18 15:07:14 -0700 |
commit | b128f54d0daa749d301b99a6637f42aa35822a76 (patch) | |
tree | 889519250f40824c6df6ea197a8edee75cf95e10 | |
parent | f8aaf0a77f72cc5614d9b9135c0d00f8a8160f20 (diff) | |
download | bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.zip bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.gz bootable_recovery-b128f54d0daa749d301b99a6637f42aa35822a76.tar.bz2 |
add function for device-specific wipe data features
Some devices want to do special things when recovery wipes data (eg,
wipe data in their baseband processor as well). Add a hook in the
device-specific recovery library that gets called when data is wiped.
Also add an amend root for the "mbm" partition.
-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 76fa43e..a2e4bea 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; +} @@ -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 86f540b..671fe40 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])) |