Source:
<code>public boolean tick(final long localTime) { if (localTime >= getCurrentDayResetTime()) { editor() .setCurrentDayResetTime(localTime + getMinimumTimeBetweenUploads()) .setCurrentDayFailureCount(0) .commit(); } <START> final long nextUpload = getNextSubmission(); <END> if (nextUpload >= localTime + 3 * getMinimumTimeBetweenUploads()) { Logger.warn(LOG_TAG, "Next upload scheduled far in the future; system clock reset? " + nextUpload + " > " + localTime); editor() .setNextSubmission(localTime + getMinimumTimeBetweenUploads()) .commit(); return false; } if (localTime < nextUpload) { Logger.debug(LOG_TAG, "We uploaded less than an interval ago; skipping. " + nextUpload + " > " + localTime); return false; } if (!uploadEnabled) { final String obsoleteId = tracker.getNextObsoleteId(); if (obsoleteId == null) { return false; } Editor editor = editor(); editor.setLastDeleteRequested(localTime); client.delete(localTime, obsoleteId, new DeleteDelegate(editor)); return true; } long firstRun = getFirstRunLocalTime(); if (firstRun < 0) { firstRun = localTime; editor() .setFirstRunLocalTime(firstRun) .setNextSubmission(localTime + getMinimumTimeBeforeFirstSubmission()) .setCurrentDayFailureCount(0) .commit(); } if (localTime < firstRun + getMinimumTimeBeforeFirstSubmission()) { Logger.info(LOG_TAG, "Need to wait " + getMinimumTimeBeforeFirstSubmission() + " before first upload."); return false; } String id = HealthReportUtils.generateDocumentId(); Collection<String> oldIds = tracker.getBatchOfObsoleteIds(); tracker.addObsoleteId(id); Editor editor = editor(); editor.setLastUploadRequested(localTime); client.upload(localTime, id, oldIds, new UploadDelegate(editor, oldIds)); return true; }</code><technical_language>feeling is check push out reset time occur late error count checked (i.e., upload delete). check upload is scheduled fetching checking pref</technical_language>

Target:
public boolean tick(final long localTime) { final long nextUpload = getNextSubmission(); if (nextUpload >= localTime + 3 * getMinimumTimeBetweenUploads()) { Logger.warn(LOG_TAG, "Next upload scheduled far in the future; system clock reset? " + nextUpload + " > " + localTime); editor() .setNextSubmission(localTime + getMinimumTimeBetweenUploads()) .commit(); return false; } if (localTime < nextUpload) { Logger.debug(LOG_TAG, "We uploaded less than an interval ago; skipping. " + nextUpload + " > " + localTime); return false; } if (!uploadEnabled) { final String obsoleteId = tracker.getNextObsoleteId(); if (obsoleteId == null) { return false; } Editor editor = editor(); editor.setLastDeleteRequested(localTime); client.delete(localTime, obsoleteId, new DeleteDelegate(editor)); return true; } long firstRun = getFirstRunLocalTime(); if (firstRun < 0) { firstRun = localTime; editor() .setFirstRunLocalTime(firstRun) .setNextSubmission(localTime + getMinimumTimeBeforeFirstSubmission()) .setCurrentDayFailureCount(0) .commit(); } if (localTime < firstRun + getMinimumTimeBeforeFirstSubmission()) { Logger.info(LOG_TAG, "Need to wait " + getMinimumTimeBeforeFirstSubmission() + " before first upload."); return false; } if (localTime >= getCurrentDayResetTime()) { editor() .setCurrentDayResetTime(localTime + getMinimumTimeBetweenUploads()) .setCurrentDayFailureCount(0) .commit(); } String id = HealthReportUtils.generateDocumentId(); Collection<String> oldIds = tracker.getBatchOfObsoleteIds(); tracker.addObsoleteId(id); Editor editor = editor(); editor.setLastUploadRequested(localTime); client.upload(localTime, id, oldIds, new UploadDelegate(editor, oldIds)); return true; }