Merge pull request #6837 from osmandapp/additional_logs_6201

additional logs for #6201
This commit is contained in:
vshcherb 2019-04-17 12:49:00 +02:00 committed by GitHub
commit e2fdea4ef2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -51,7 +51,6 @@ public class PerformLiveUpdateAsyncTask
final OsmandApplication myApplication = getMyApplication();
OsmandSettings.CommonPreference<Long> lastCheckPreference =
LiveUpdatesHelper.preferenceLastCheck(localIndexFileName, myApplication.getSettings());
LOG.debug(String.format("Last update check for %1s -> %2$d, current check time: %3$d", localIndexFileName, lastCheckPreference.get(), System.currentTimeMillis()));
lastCheckPreference.set(System.currentTimeMillis());
}
@ -92,7 +91,6 @@ public class PerformLiveUpdateAsyncTask
iu.timestamp, iu.sizeText, iu.contentSize,
iu.containerSize, DownloadActivityType.LIVE_UPDATES_FILE);
itemsToDownload.add(indexItem);
LOG.debug(String.format("Filename %1$s -> server timestamp: %2$s, content size: %3$s", iu.fileName, iu.timestamp, iu.contentSize));
}
DownloadIndexesThread downloadThread = application.getDownloadThread();
if (context instanceof DownloadIndexesThread.DownloadEvents) {

View file

@ -1,5 +1,7 @@
package net.osmand.plus.resources;
import android.view.LayoutInflater;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapIndexReader;
@ -7,6 +9,7 @@ import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.R;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@ -24,7 +27,7 @@ import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
public class IncrementalChangesManager {
private static final Log LOG = PlatformUtil.getLog(IncrementalChangesManager.class);
private static final String URL = "https://osmand.net/check_live";
private static final org.apache.commons.logging.Log log = PlatformUtil.getLog(IncrementalChangesManager.class);
private ResourceManager resourceManager;
@ -291,13 +294,14 @@ public class IncrementalChangesManager {
@Override
public String toString() {
return "Update " + fileName + " " + sizeText + " MB " + date;
return "Update " + fileName + " " + sizeText + " MB " + date + ", timestamp: " + timestamp;
}
}
private List<IncrementalUpdate> getIncrementalUpdates(String file, long timestamp) throws IOException,
XmlPullParserException {
String url = URL + "?aosmc=true&timestamp=" + timestamp + "&file=" + URLEncoder.encode(file);
LOG.debug(String.format("getIncrementalUpdates(): URL => %s", url)); //todo delete
HttpURLConnection conn = NetworkUtils.getHttpURLConnection(url);
conn.setUseCaches(false);
XmlPullParser parser = PlatformUtil.newXMLPullParser();
@ -313,10 +317,12 @@ public class IncrementalChangesManager {
dt.sizeText = parser.getAttributeValue("", "size");
dt.timestamp = Long.parseLong(parser.getAttributeValue("", "timestamp"));
dt.fileName = parser.getAttributeValue("", "name");
LOG.debug(String.format("getIncrementalUpdates(): update => %s", dt.toString())); //todo delete
lst.add(dt);
}
}
}
LOG.debug(String.format("getIncrementalUpdates(): list size => %s", lst.size())); //todo delete
return lst;
}