@Override
 public void run() {
   try {
     final UpdateHelper updateHelper = new UpdateHelper();
     final Query query = new Query().setFilterById(mId);
     setIndeterminate(true);
     while (!isInterrupted()) {
       final Cursor cursor = mDownloadManagerWrapper.query(query);
       if (null == cursor) {
         // Can't contact DownloadManager: this should never happen.
         return;
       }
       try {
         if (cursor.moveToNext()) {
           final int columnBytesDownloadedSoFar =
               cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR);
           final int bytesDownloadedSoFar = cursor.getInt(columnBytesDownloadedSoFar);
           updateHelper.setProgressFromAnotherThread(bytesDownloadedSoFar);
         } else {
           // Download has finished and DownloadManager has already been asked to
           // clean up the db entry.
           updateHelper.setProgressFromAnotherThread(getMax());
           return;
         }
       } finally {
         cursor.close();
       }
       Thread.sleep(REPORT_PERIOD);
     }
   } catch (InterruptedException e) {
     // Do nothing and terminate normally.
   }
 }