summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorPaul Crowley <paulcrowley@google.com>2016-06-08 22:51:41 +0200
committerPaul Crowley <paulcrowley@google.com>2018-04-25 02:08:22 +0200
commit3b4d516151c622b4015fb14af4ea3223ed57f2e0 (patch)
tree5423444f5facf7dc0755e0ebbf8eb502745d57fa /recovery.cpp
parentMerge "applypatch: Drop the SHA_CTX parameter in Apply{BSDiff,Image}Patch." (diff)
downloadandroid_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.tar
android_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.tar.gz
android_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.tar.bz2
android_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.tar.lz
android_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.tar.xz
android_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.tar.zst
android_bootable_recovery-3b4d516151c622b4015fb14af4ea3223ed57f2e0.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 910cd8296..ceb19413a 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -108,6 +108,7 @@ static const char *CONVERT_FBE_DIR = "/tmp/convert_fbe";
static const char *CONVERT_FBE_FILE = "/tmp/convert_fbe/convert_fbe";
static const char *CACHE_ROOT = "/cache";
static const char *DATA_ROOT = "/data";
+static const char* METADATA_ROOT = "/metadata";
static const char *SDCARD_ROOT = "/sdcard";
static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
static const char *TEMPORARY_INSTALL_FILE = "/tmp/last_install";
@@ -752,11 +753,19 @@ static bool wipe_data(Device* device) {
modified_flash = true;
ui->Print("\n-- Wiping data...\n");
- bool success =
- device->PreWipeData() &&
- erase_volume("/data") &&
- (has_cache ? erase_volume("/cache") : true) &&
- device->PostWipeData();
+ bool success = device->PreWipeData();
+ if (success) {
+ success &= erase_volume(DATA_ROOT);
+ if (has_cache) {
+ success &= erase_volume(CACHE_ROOT);
+ }
+ if (volume_for_mount_point(METADATA_ROOT) != nullptr) {
+ success &= erase_volume(METADATA_ROOT);
+ }
+ }
+ if (success) {
+ success &= device->PostWipeData();
+ }
ui->Print("Data wipe %s.\n", success ? "complete" : "failed");
return success;
}