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 | e046da1460d216f6267c6b9fe2e978aeff486be2 (patch) | |
tree | 3b0c0ea7760542a9f60193575a7dc7bcf1bd01a4 /gallerycommon | |
parent | a67d89563df7c8847ee335723e097aaaffe43c36 (diff) | |
download | android_packages_apps_Snap-e046da1460d216f6267c6b9fe2e978aeff486be2.tar.gz android_packages_apps_Snap-e046da1460d216f6267c6b9fe2e978aeff486be2.tar.bz2 android_packages_apps_Snap-e046da1460d216f6267c6b9fe2e978aeff486be2.zip |
Mark FileCache initialized after init really goes through.
Bug: 5988196
Change-Id: Ia826ce6a33c200a2cd09c21d7ef22f4dd161caa9
Diffstat (limited to 'gallerycommon')
-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) { |