Do not invalidate all apps if not needed.

This gets repo updates with no changes back to normal speed, keeping the new
functionalities (icons download after cache clean) intact.
This commit is contained in:
Daniel Martí 2013-07-28 09:08:20 +02:00
parent 9d6c88a8bf
commit eead91385e

View File

@ -256,19 +256,25 @@ public class UpdateService extends IntentService implements ProgressListener {
if (success) {
File d = DB.getIconsPath(this);
List<DB.App> toDownloadIcons = acceptedapps;
if (!d.exists()) {
List<DB.App> toDownloadIcons = null;
if (changes) {
toDownloadIcons = acceptedapps;
} else if (!d.exists()) {
Log.d("FDroid", "Icons were wiped. Re-downloading all of them.");
d.mkdirs();
toDownloadIcons = ((FDroidApp) getApplication()).getApps();
}
sendStatus(STATUS_INFO,
getString(R.string.status_downloading_icons));
for (DB.App app : toDownloadIcons)
getIcon(app, repos);
((FDroidApp) getApplication()).invalidateAllApps();
if (toDownloadIcons != null) {
sendStatus(STATUS_INFO,
getString(R.string.status_downloading_icons));
for (DB.App app : toDownloadIcons)
getIcon(app, repos);
}
}
if (success && changes)
((FDroidApp) getApplication()).invalidateAllApps();
if (success && changes && notify && (newUpdates > prevUpdates)) {
Log.d("FDroid", "Notifying updates. Apps before:" + prevUpdates
+ ", apps after: " + newUpdates);