diff options
author | ztenghui <ztenghui@google.com> | 2013-07-19 22:19:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-07-19 22:19:16 +0000 |
commit | c19f078c8a65c0b90b1d1b88e6f60f521a54ed1d (patch) | |
tree | 265e962288cbc3059c801974932a104ed4e264d2 /src/com/android/gallery3d/data/ImageCacheService.java | |
parent | 6798c34ddb5248f038f351674c6a6c7a20992c8c (diff) | |
parent | d32b92d96ad07f15f6130a8608a67ab96c962a96 (diff) | |
download | android_packages_apps_Snap-c19f078c8a65c0b90b1d1b88e6f60f521a54ed1d.tar.gz android_packages_apps_Snap-c19f078c8a65c0b90b1d1b88e6f60f521a54ed1d.tar.bz2 android_packages_apps_Snap-c19f078c8a65c0b90b1d1b88e6f60f521a54ed1d.zip |
Merge "Update Uri instead of removing" into gb-ub-photos-carlsbad
Diffstat (limited to 'src/com/android/gallery3d/data/ImageCacheService.java')
-rw-r--r-- | src/com/android/gallery3d/data/ImageCacheService.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/data/ImageCacheService.java b/src/com/android/gallery3d/data/ImageCacheService.java index 527d6c8cd..1c7cb8c5e 100644 --- a/src/com/android/gallery3d/data/ImageCacheService.java +++ b/src/com/android/gallery3d/data/ImageCacheService.java @@ -46,7 +46,8 @@ public class ImageCacheService { } /** - * Gets the cached image data for the given <code>path</code> and <code>type</code>. + * Gets the cached image data for the given <code>path</code>, + * <code>timeModified</code> and <code>type</code>. * * The image data will be stored in <code>buffer.data</code>, started from * <code>buffer.offset</code> for <code>buffer.length</code> bytes. If the @@ -54,8 +55,8 @@ public class ImageCacheService { * * @return true if the image data is found; false if not found. */ - public boolean getImageData(Path path, int type, BytesBuffer buffer) { - byte[] key = makeKey(path, type); + public boolean getImageData(Path path, long timeModified, int type, BytesBuffer buffer) { + byte[] key = makeKey(path, timeModified, type); long cacheKey = Utils.crc64Long(key); try { LookupRequest request = new LookupRequest(); @@ -76,8 +77,8 @@ public class ImageCacheService { return false; } - public void putImageData(Path path, int type, byte[] value) { - byte[] key = makeKey(path, type); + public void putImageData(Path path, long timeModified, int type, byte[] value) { + byte[] key = makeKey(path, timeModified, type); long cacheKey = Utils.crc64Long(key); ByteBuffer buffer = ByteBuffer.allocate(key.length + value.length); buffer.put(key); @@ -91,8 +92,8 @@ public class ImageCacheService { } } - public void clearImageData(Path path, int type) { - byte[] key = makeKey(path, type); + public void clearImageData(Path path, long timeModified, int type) { + byte[] key = makeKey(path, timeModified, type); long cacheKey = Utils.crc64Long(key); synchronized (mCache) { try { @@ -103,8 +104,8 @@ public class ImageCacheService { } } - private static byte[] makeKey(Path path, int type) { - return GalleryUtils.getBytes(path.toString() + "+" + type); + private static byte[] makeKey(Path path, long timeModified, int type) { + return GalleryUtils.getBytes(path.toString() + "+" + timeModified + "+" + type); } private static boolean isSameKey(byte[] key, byte[] buffer) { |