diff options
| author | Amith Yamasani <yamasani@google.com> | 2017-07-19 16:49:52 -0700 |
|---|---|---|
| committer | Amith Yamasani <yamasani@google.com> | 2017-07-20 13:50:23 -0700 |
| commit | 74bf71b23c5deca47166d6627361f26ee5d62a7c (patch) | |
| tree | 728e1d96b06251dbd0c7d8f9821ab3dcedce5e67 /core/java/android/util/AtomicFile.java | |
| parent | 479b762f995c2cfc5938124681ab8f5a8e33b519 (diff) | |
Handle an edge case that can reset settings provider data
If the AtomicFile does the rename and fails when writing the
original, make sure we can at least use the backup on reboot.
Bug: 63753300
Test: Stop shell, move settings_global.xml to backup, start shell.
Change-Id: I2049b48af05161bb2c68717a71c1700a95150a6c
Diffstat (limited to 'core/java/android/util/AtomicFile.java')
| -rw-r--r-- | core/java/android/util/AtomicFile.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/util/AtomicFile.java b/core/java/android/util/AtomicFile.java index 2f1abe9a4c8d..0122e49eb462 100644 --- a/core/java/android/util/AtomicFile.java +++ b/core/java/android/util/AtomicFile.java @@ -202,6 +202,15 @@ public class AtomicFile { } /** + * @hide + * Checks if the original or backup file exists. + * @return whether the original or backup file exists. + */ + public boolean exists() { + return mBaseName.exists() || mBackupName.exists(); + } + + /** * Gets the last modified time of the atomic file. * {@hide} * |
