additional logging for #6201

This commit is contained in:
madwasp79 2019-06-28 15:52:34 +03:00
parent 10dd9ff2d7
commit b09412b6ed

View file

@ -85,6 +85,7 @@ public class PerformLiveUpdateAsyncTask
settings.LIVE_UPDATES_RETRIES.resetToDefault();
List<IncrementalChangesManager.IncrementalUpdate> ll = result.getItemsForUpdate();
if (ll != null && !ll.isEmpty()) {
LOG.debug("Updates quantity: " + ll.size());
ArrayList<IndexItem> itemsToDownload = new ArrayList<>(ll.size());
for (IncrementalChangesManager.IncrementalUpdate iu : ll) {
IndexItem indexItem = new IndexItem(iu.fileName, "Incremental update",
@ -92,12 +93,16 @@ public class PerformLiveUpdateAsyncTask
iu.containerSize, DownloadActivityType.LIVE_UPDATES_FILE);
itemsToDownload.add(indexItem);
}
LOG.debug("Items to download size: " + itemsToDownload.size());
DownloadIndexesThread downloadThread = application.getDownloadThread();
if (context instanceof DownloadIndexesThread.DownloadEvents) {
downloadThread.setUiActivity((DownloadIndexesThread.DownloadEvents) context);
}
boolean downloadViaWiFi =
LiveUpdatesHelper.preferenceDownloadViaWiFi(localIndexFileName, settings).get();
LOG.debug("Internet connection available: " + getMyApplication().getSettings().isInternetConnectionAvailable());
LOG.debug("Download via Wifi: " + downloadViaWiFi);
if (getMyApplication().getSettings().isInternetConnectionAvailable()) {
if (userRequested || settings.isWifiConnected() || !downloadViaWiFi) {
long szLong = 0;
@ -113,6 +118,8 @@ public class PerformLiveUpdateAsyncTask
double sz = ((double) szLong) / (1 << 20);
// get availabile space
double asz = downloadThread.getAvailableSpace();
LOG.debug("Download size: " + sz + ", available space: " + asz);
if (asz == -1 || asz <= 0 || sz / asz <= 0.4) {
IndexItem[] itemsArray = new IndexItem[itemsToDownload.size()];
itemsArray = itemsToDownload.toArray(itemsArray);
@ -120,8 +127,10 @@ public class PerformLiveUpdateAsyncTask
if (context instanceof DownloadIndexesThread.DownloadEvents) {
((DownloadIndexesThread.DownloadEvents) context).downloadInProgress();
}
} else {
LOG.debug("onPostExecute: Not enough space for updates");
}
}
} LOG.debug("onPostExecute: No internet connection");
}
} else {
if (context instanceof DownloadIndexesThread.DownloadEvents) {