diff options
| author | Owen Lin <owenlin@google.com> | 2011-12-01 14:43:54 +0800 |
|---|---|---|
| committer | Owen Lin <owenlin@google.com> | 2011-12-01 16:27:22 +0800 |
| commit | c0715fd58c287347458756e34f07cee1fd72b982 (patch) | |
| tree | 360546a146211643d984f55ce64a5b04cfa580e1 /gallerycommon/src/com | |
| parent | 764482c4ebffc9c3cac21fcd8707811e981cd092 (diff) | |
| download | android_packages_apps_Gallery2-c0715fd58c287347458756e34f07cee1fd72b982.tar.gz android_packages_apps_Gallery2-c0715fd58c287347458756e34f07cee1fd72b982.tar.bz2 android_packages_apps_Gallery2-c0715fd58c287347458756e34f07cee1fd72b982.zip | |
Add close() to Download cache.
Change-Id: Idf0482e9f3cd2f667dca902ffea75bb0a0225d2d
fix: 5664497
Diffstat (limited to 'gallerycommon/src/com')
| -rw-r--r-- | gallerycommon/src/com/android/gallery3d/common/BlobCache.java | 3 | ||||
| -rw-r--r-- | gallerycommon/src/com/android/gallery3d/common/FileCache.java | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/BlobCache.java b/gallerycommon/src/com/android/gallery3d/common/BlobCache.java index 19a2e3090..7788e61f5 100644 --- a/gallerycommon/src/com/android/gallery3d/common/BlobCache.java +++ b/gallerycommon/src/com/android/gallery3d/common/BlobCache.java @@ -76,7 +76,7 @@ import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.zip.Adler32; -public class BlobCache { +public class BlobCache implements Closeable { private static final String TAG = "BlobCache"; private static final int MAGIC_INDEX_FILE = 0xB3273030; @@ -171,6 +171,7 @@ public class BlobCache { // Close the cache. All resources are released. No other method should be // called after this is called. + @Override public void close() { syncAll(); closeAll(); diff --git a/gallerycommon/src/com/android/gallery3d/common/FileCache.java b/gallerycommon/src/com/android/gallery3d/common/FileCache.java index a69d6e170..938ef8c1a 100644 --- a/gallerycommon/src/com/android/gallery3d/common/FileCache.java +++ b/gallerycommon/src/com/android/gallery3d/common/FileCache.java @@ -16,8 +16,6 @@ package com.android.gallery3d.common; -import com.android.gallery3d.common.Entry.Table; - import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -25,10 +23,13 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; +import com.android.gallery3d.common.Entry.Table; + +import java.io.Closeable; import java.io.File; import java.io.IOException; -public class FileCache { +public class FileCache implements Closeable { private static final int LRU_CAPACITY = 4; private static final int MAX_DELETE_COUNT = 16; @@ -91,6 +92,10 @@ public class FileCache { mDbHelper = new DatabaseHelper(context, dbName); } + public void close() { + mDbHelper.close(); + } + public void store(String downloadUrl, File file) { if (!mInitialized) initialize(); |
