diff options
| author | Hung-ying Tyan <tyanh@google.com> | 2012-05-09 10:38:11 +0800 |
|---|---|---|
| committer | Hung-ying Tyan <tyanh@google.com> | 2012-05-09 10:46:51 +0800 |
| commit | b1c26fab4316980663e50f49d617e6e14d340c74 (patch) | |
| tree | 290b45573f7ff2d364d5903be6f64ac6d45f886e /gallerycommon/src/com/android | |
| parent | b79e762798b55d6551c5b78ec09c8234415ac3b5 (diff) | |
| download | android_packages_apps_Gallery2-b1c26fab4316980663e50f49d617e6e14d340c74.tar.gz android_packages_apps_Gallery2-b1c26fab4316980663e50f49d617e6e14d340c74.tar.bz2 android_packages_apps_Gallery2-b1c26fab4316980663e50f49d617e6e14d340c74.zip | |
Mark FileCache initialized after init really goes through.
Bug: 5988196
Change-Id: Ia826ce6a33c200a2cd09c21d7ef22f4dd161caa9
Diffstat (limited to 'gallerycommon/src/com/android')
| -rw-r--r-- | gallerycommon/src/com/android/gallery3d/common/FileCache.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/FileCache.java b/gallerycommon/src/com/android/gallery3d/common/FileCache.java index 938ef8c1a..a69487f4c 100644 --- a/gallerycommon/src/com/android/gallery3d/common/FileCache.java +++ b/gallerycommon/src/com/android/gallery3d/common/FileCache.java @@ -191,7 +191,6 @@ public class FileCache implements Closeable { private synchronized void initialize() { if (mInitialized) return; - mInitialized = true; if (!mRootDir.isDirectory()) { mRootDir.mkdirs(); @@ -209,6 +208,10 @@ public class FileCache implements Closeable { cursor.close(); } if (mTotalBytes > mCapacity) freeSomeSpaceIfNeed(MAX_DELETE_COUNT); + + // Mark initialized when everything above went through. If an exception was thrown, + // initialize() will be retried later. + mInitialized = true; } private void freeSomeSpaceIfNeed(int maxDeleteFileCount) { |
