Merge pull request #10478 from osmandapp/add_logs
Add logs for index item update
This commit is contained in:
commit
e8b2d9be05
1 changed files with 17 additions and 6 deletions
|
@ -8,9 +8,9 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.map.WorldRegion;
|
||||
import net.osmand.plus.CustomRegion;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.CustomRegion;
|
||||
import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -21,6 +21,7 @@ import java.io.File;
|
|||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -177,6 +178,8 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
}
|
||||
if (date != null && !date.equals(indexActivatedDate) && !date.equals(indexFilesDate)) {
|
||||
long oldItemSize = 0;
|
||||
long itemSize = item.getContentSize();
|
||||
if ((item.getType() == DownloadActivityType.NORMAL_FILE && !item.extra)
|
||||
|| item.getType() == DownloadActivityType.ROADS_FILE
|
||||
|| item.getType() == DownloadActivityType.WIKIPEDIA_FILE
|
||||
|
@ -185,15 +188,12 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
outdated = true;
|
||||
} else if (item.getType() == DownloadActivityType.WIKIVOYAGE_FILE
|
||||
|| item.getType() == DownloadActivityType.TRAVEL_FILE) {
|
||||
long itemSize = item.getContentSize();
|
||||
long oldItemSize = app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR +
|
||||
oldItemSize = app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR +
|
||||
item.getTargetFileName()).length();
|
||||
if (itemSize != oldItemSize) {
|
||||
outdated = true;
|
||||
}
|
||||
} else {
|
||||
long itemSize = item.getContentSize();
|
||||
long oldItemSize = 0;
|
||||
if (parsed && item.getTimestamp() > item.getLocalTimestamp()) {
|
||||
outdated = true;
|
||||
} else if (item.getType() == DownloadActivityType.VOICE_FILE) {
|
||||
|
@ -223,12 +223,23 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
outdated = true;
|
||||
}
|
||||
}
|
||||
if (outdated) {
|
||||
logItemUpdateInfo(item, format, itemSize, oldItemSize);
|
||||
}
|
||||
}
|
||||
item.setOutdated(outdated);
|
||||
return outdated;
|
||||
}
|
||||
|
||||
|
||||
private void logItemUpdateInfo(IndexItem item, DateFormat format, long itemSize, long oldItemSize) {
|
||||
String date = item.getDate(format);
|
||||
String sfName = item.getTargetFileName();
|
||||
String indexActivatedDate = indexActivatedFileNames.get(sfName);
|
||||
String indexFilesDate = indexFileNames.get(sfName);
|
||||
LOG.info("name " + item.getFileName() + " timestamp " + item.timestamp + " localTimestamp " + item.localTimestamp + " date " + date
|
||||
+ " indexActivatedDate " + indexActivatedDate + " indexFilesDate " + indexFilesDate
|
||||
+ " itemSize " + itemSize + " oldItemSize " + oldItemSize);
|
||||
}
|
||||
|
||||
protected void updateFilesToUpdate() {
|
||||
initAlreadyLoadedFiles();
|
||||
|
|
Loading…
Reference in a new issue