diff options
| author | Doug Zongker <dougz@android.com> | 2011-04-12 09:23:51 -0700 |
|---|---|---|
| committer | Doug Zongker <dougz@android.com> | 2011-04-12 09:23:51 -0700 |
| commit | 3d5040f8d474713a1e148b0d64f16bb0435d6388 (patch) | |
| tree | ff7e1106f810531742bc9e3609a28d20e4e7d8fb /core/java/android/os/RecoverySystem.java | |
| parent | a58ee55f490953247882298d56003cbf94285344 (diff) | |
protect all /cache/recovery/last_* files from deletion
Preserve any files name /cache/recovery/last_*, not just last_log,
when booting.
Change-Id: Ie36da5b9552e4a7100ecf3774fb1a8aaa22bfdbd
Diffstat (limited to 'core/java/android/os/RecoverySystem.java')
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index c1dd9119e4cc..ae605fb3ac5d 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -70,7 +70,7 @@ public class RecoverySystem { private static File RECOVERY_DIR = new File("/cache/recovery"); private static File COMMAND_FILE = new File(RECOVERY_DIR, "command"); private static File LOG_FILE = new File(RECOVERY_DIR, "log"); - private static String LAST_LOG_FILENAME = "last_log"; + private static String LAST_PREFIX = "last_"; // Length limits for reading files. private static int LOG_FILE_MAX_LENGTH = 64 * 1024; @@ -415,10 +415,11 @@ public class RecoverySystem { Log.e(TAG, "Error reading recovery log", e); } - // Delete everything in RECOVERY_DIR except LAST_LOG_FILENAME + // Delete everything in RECOVERY_DIR except those beginning + // with LAST_PREFIX String[] names = RECOVERY_DIR.list(); for (int i = 0; names != null && i < names.length; i++) { - if (names[i].equals(LAST_LOG_FILENAME)) continue; + if (names[i].startsWith(LAST_PREFIX)) continue; File f = new File(RECOVERY_DIR, names[i]); if (!f.delete()) { Log.e(TAG, "Can't delete: " + f); |
