summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/MtpDeviceSet.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-04-17 12:12:03 +0800
committerOwen Lin <owenlin@google.com>2012-04-17 12:12:03 +0800
commit125649ecc3b3a20f027c11c2eaa3b2868e25a038 (patch)
treef65c6f096ea4f55afeccf91dbb73bb598c06241e /src/com/android/gallery3d/data/MtpDeviceSet.java
parent0c9b33142eab6dbc2fdfe58179b26fa497b7eff0 (diff)
downloadandroid_packages_apps_Snap-125649ecc3b3a20f027c11c2eaa3b2868e25a038.tar.gz
android_packages_apps_Snap-125649ecc3b3a20f027c11c2eaa3b2868e25a038.tar.bz2
android_packages_apps_Snap-125649ecc3b3a20f027c11c2eaa3b2868e25a038.zip
Fix a concurrent issue in reload().
We need to hold the DataManager.LOCK when calling reload. Change-Id: If908c233bcd835effffc7750a7ef07f56a63136c fix: 6315479
Diffstat (limited to 'src/com/android/gallery3d/data/MtpDeviceSet.java')
-rw-r--r--src/com/android/gallery3d/data/MtpDeviceSet.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/data/MtpDeviceSet.java b/src/com/android/gallery3d/data/MtpDeviceSet.java
index dd79bc1cb..46cc0fc68 100644
--- a/src/com/android/gallery3d/data/MtpDeviceSet.java
+++ b/src/com/android/gallery3d/data/MtpDeviceSet.java
@@ -76,10 +76,6 @@ public class MtpDeviceSet extends MediaSet
}
}
Collections.sort(result, MediaSetUtils.NAME_COMPARATOR);
-
- for (int i = 0, n = result.size(); i < n; ++i) {
- result.get(i).reload();
- }
return result;
}
}
@@ -122,6 +118,9 @@ public class MtpDeviceSet extends MediaSet
if (mLoadBuffer != null) {
mDeviceSet = mLoadBuffer;
mLoadBuffer = null;
+ for (MediaSet device : mDeviceSet) {
+ device.reload();
+ }
mDataVersion = nextVersionNumber();
}
return mDataVersion;