diff options
author | Elliott Hughes <enh@google.com> | 2015-06-11 00:47:51 +0200 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-06-11 00:47:51 +0200 |
commit | 12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad (patch) | |
tree | fcfc300d139ccddd9de4219453358f39e9f5e9b2 /recovery.cpp | |
parent | am 915fc970: am 280cb6e9: Merge "Zero blocks before BLKDISCARD" (diff) | |
parent | am a1009c34: Merge "Split WipeData into PreWipeData and PostWipeData." (diff) | |
download | android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.tar android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.tar.gz android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.tar.bz2 android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.tar.lz android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.tar.xz android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.tar.zst android_bootable_recovery-12c8ea6827f2de5b4376524790dd9d2c9d6ef6ad.zip |
Diffstat (limited to 'recovery.cpp')
-rw-r--r-- | recovery.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/recovery.cpp b/recovery.cpp index 76149cd98..6cda10c21 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -421,8 +421,7 @@ typedef struct _saved_log_file { struct _saved_log_file* next; } saved_log_file; -static int -erase_volume(const char *volume) { +static bool erase_volume(const char* volume) { bool is_cache = (strcmp(volume, CACHE_ROOT) == 0); ui->SetBackground(RecoveryUI::ERASING); @@ -503,7 +502,7 @@ erase_volume(const char *volume) { copy_logs(); } - return result; + return (result == 0); } static int @@ -677,13 +676,13 @@ static bool wipe_data(int should_confirm, Device* device) { modified_flash = true; ui->Print("\n-- Wiping data...\n"); - if (device->WipeData() == 0 && erase_volume("/data") == 0 && erase_volume("/cache") == 0) { - ui->Print("Data wipe complete.\n"); - return true; - } else { - ui->Print("Data wipe failed.\n"); - return false; - } + bool success = + device->PreWipeData() && + erase_volume("/data") && + erase_volume("/cache") && + device->PostWipeData(); + ui->Print("Data wipe %s.\n", success ? "complete" : "failed"); + return success; } // Return true on success. @@ -695,13 +694,9 @@ static bool wipe_cache(bool should_confirm, Device* device) { modified_flash = true; ui->Print("\n-- Wiping cache...\n"); - if (erase_volume("/cache") == 0) { - ui->Print("Cache wipe complete.\n"); - return true; - } else { - ui->Print("Cache wipe failed.\n"); - return false; - } + bool success = erase_volume("/cache"); + ui->Print("Cache wipe %s.\n", success ? "complete" : "failed"); + return success; } static void choose_recovery_file(Device* device) { |