diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2011-05-26 10:50:16 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-05-26 10:50:16 -0700 |
commit | 4e17e7a57e28008a8b7295247c3e6e0cb642ab70 (patch) | |
tree | 52248b3d4953e0289b6f28311a3e9a5c6f52270c | |
parent | ec131c48ff140bbfacbe3b3878365b7c23ffb00e (diff) | |
parent | 61ab647c5ad9a101a01fff7f677fead8d37ebfba (diff) | |
download | Gallery3D-4e17e7a57e28008a8b7295247c3e6e0cb642ab70.tar.gz |
am 61ab647c: Merge "Fixed the issue that media sets still appear after deleting all albums in Gallery3D." into gingerbread
* commit '61ab647c5ad9a101a01fff7f677fead8d37ebfba':
Fixed the issue that media sets still appear after deleting all albums in Gallery3D.
-rw-r--r-- | src/com/cooliris/cache/CacheService.java | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/com/cooliris/cache/CacheService.java b/src/com/cooliris/cache/CacheService.java index c8a5fc0..6f68913 100644 --- a/src/com/cooliris/cache/CacheService.java +++ b/src/com/cooliris/cache/CacheService.java @@ -1011,26 +1011,33 @@ public final class CacheService extends IntentService { } ++ctr; } while (ctr < numSets); - // We now check for any deleted sets. - final byte[] albumData = sAlbumCache.get(ALBUM_CACHE_METADATA_INDEX, 0); - if (albumData != null && albumData.length > 0) { - final DataInputStream dis = new DataInputStream(new BufferedInputStream(new ByteArrayInputStream(albumData), 256)); - try { - final int numAlbums = dis.readInt(); - for (int i = 0; i < numAlbums; ++i) { - final long setId = dis.readLong(); - Utils.readUTF(dis); - dis.readBoolean(); - dis.readBoolean(); - if (!setIds.contains(setId)) { + } + // We now check for any deleted sets. + final byte[] albumData = sAlbumCache.get(ALBUM_CACHE_METADATA_INDEX, 0); + if (albumData != null && albumData.length > 0) { + final DataInputStream dis = new DataInputStream(new BufferedInputStream(new ByteArrayInputStream(albumData), 256)); + try { + final int numAlbums = dis.readInt(); + for (int i = 0; i < numAlbums; ++i) { + final long setId = dis.readLong(); + Utils.readUTF(dis); + dis.readBoolean(); + dis.readBoolean(); + if (!setIds.contains(setId)) { + final byte[] existingData = sAlbumCache.get(ALBUM_CACHE_DIRTY_INDEX, 0); + if (existingData != null && existingData.length == 1 + && existingData[0] == sDummyData[0]) { + // markDirty() was already called, skip this time. + // (not do it too aggressively) + } else { // This set was deleted, we need to recompute the cache. markDirty(); - break; } + break; } - } catch (Exception e) { - ; } + } catch (Exception e) { + ; } } } finally { |