code: protected synchronized void taskCompleted(String uploadId) {
          UploadTask task = uploadTasksMap.remove(uploadId);
          uploadDelegates.remove(uploadId);
  
          // un-hold foreground upload ID if it's been hold
          if (isExecuteInForeground() && task != null && task.params.id.equals(foregroundUploadId)) {
              Logger.debug(TAG, uploadId + " now un-holded the foreground notification");
              foregroundUploadId = null;
          }
  
          if (isExecuteInForeground() && uploadTasksMap.isEmpty()) {
              Logger.debug(TAG, "All tasks completed, stopping foreground execution");
              stopForeground(true);
              shutdownIfThereArentAnyActiveTasks();
          }
      }
docs: Called by each task when it is completed (either successfully, with an error or due to
  user cancellation).
  @param uploadId the uploadID of the finished task