summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLikai Ding <likaid@codeaurora.org>2016-03-22 15:06:52 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-03-28 00:11:21 -0700
commit4fe763c636aeed00feccc7ab3224cd0f19c3008d (patch)
tree334bf88be9bda55781f2ab3e97bfb2ffc1d803be /src
parent941b4590dddeb0cea6157a43d819055a0be97a87 (diff)
downloadandroid_packages_apps_Gallery2-4fe763c636aeed00feccc7ab3224cd0f19c3008d.tar.gz
android_packages_apps_Gallery2-4fe763c636aeed00feccc7ab3224cd0f19c3008d.tar.bz2
android_packages_apps_Gallery2-4fe763c636aeed00feccc7ab3224cd0f19c3008d.zip
Gallery: fix "no photo found" when there are photos
The base MediaSet in ClusterAlbumSet has a valid version number after initialization, causing ClusterAlbumSet.reload() to return immediately though it is not actually loaded. Change-Id: I1e05d31632694692025ac78a2d83200281f464ab CRs-Fixed: 984190
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/TimeLineDataLoader.java7
-rw-r--r--src/com/android/gallery3d/data/ClusterAlbumSet.java7
2 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/app/TimeLineDataLoader.java b/src/com/android/gallery3d/app/TimeLineDataLoader.java
index 9532ab057..bd2193ff9 100644
--- a/src/com/android/gallery3d/app/TimeLineDataLoader.java
+++ b/src/com/android/gallery3d/app/TimeLineDataLoader.java
@@ -368,12 +368,13 @@ public class TimeLineDataLoader {
@Override
public void run() {
-
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
boolean updateComplete = false;
+ long version = MediaObject.INVALID_DATA_VERSION;
while (mActive) {
synchronized (this) {
- if (mActive && !mDirty && updateComplete) {
+ if (mActive && !mDirty && updateComplete
+ && version != MediaObject.INVALID_DATA_VERSION) {
updateLoading(false);
if (mFailedVersion != MediaObject.INVALID_DATA_VERSION) {
}
@@ -385,7 +386,7 @@ public class TimeLineDataLoader {
mDirty = false;
}
updateLoading(true);
- long version = mSource.reload();
+ version = mSource.reload();
UpdateInfo info = executeAndWait(new GetUpdateInfo(version));
updateComplete = info == null;
if (updateComplete) {
diff --git a/src/com/android/gallery3d/data/ClusterAlbumSet.java b/src/com/android/gallery3d/data/ClusterAlbumSet.java
index d83b4dadf..33074bea2 100644
--- a/src/com/android/gallery3d/data/ClusterAlbumSet.java
+++ b/src/com/android/gallery3d/data/ClusterAlbumSet.java
@@ -32,6 +32,7 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
private static final String TAG = "ClusterAlbumSet";
private GalleryApp mApplication;
private MediaSet mBaseSet;
+ private long mBaseDataVersion;
private int mKind;
private ArrayList<ClusterAlbum> mAlbums = new ArrayList<ClusterAlbum>();
private boolean mFirstReloadDone;
@@ -47,6 +48,7 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
super(path, INVALID_DATA_VERSION);
mApplication = application;
mBaseSet = baseSet;
+ mBaseDataVersion = mBaseSet.getDataVersion();
mKind = kind;
baseSet.addContentListener(this);
}
@@ -68,11 +70,12 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
@Override
public long reload() {
- synchronized(this){
- if (mBaseSet.reload() > mDataVersion) {
+ synchronized (this) {
+ if (mBaseSet.reload() > mBaseDataVersion) {
updateClusters();
mFirstReloadDone = true;
mDataVersion = nextVersionNumber();
+ mBaseDataVersion = mDataVersion;
}
if (mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) {
calculateTotalItemsCount();