code: private void updateProgress(DownloadRequest request, long bytesWritten, long totalBytes) {
      long currentTimestamp = System.currentTimeMillis();
      if (bytesWritten != totalBytes
          && currentTimestamp - lastProgressTimestamp < request.progressInterval()) {
        return;
      }
  
      /* save progress timestamp */
      lastProgressTimestamp = currentTimestamp;
  
      if (!request.isCanceled()) {
        delivery.postProgress(request, bytesWritten, totalBytes);
      }
    }
docs: /* update download progress