question: protected void removeAllCurrentDownloads ( ) { Log . i ( LOG_TAG , "Removing all current registered downloads..." ) ; ArrayList < Long > ids = new ArrayList < Long > ( ) ; Cursor cursor = mDownloadManager . query ( new Query ( ) ) ; try { if ( cursor . moveToFirst ( ) ) { do { int index = cursor . getColumnIndex ( DownloadManager . COLUMN_ID ) ; long downloadId = cursor . getLong ( index ) ; ids . add ( downloadId ) ; } while ( cursor . moveToNext ( ) ) ; } } finally { cursor . close ( ) ; } for ( long id : ids ) { mDownloadManager . remove ( id ) ; } cursor = mDownloadManager . query ( new Query ( ) ) ; try { assertEquals ( 0 , cursor . getCount ( ) ) ; } finally { cursor . close ( ) ; } }
target:  Helper to remove all downloads that are registered with the DL Manager. Note: This gives us a clean slate b/c it includes downloads that are pending, running, paused, or have completed.