summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2010-11-09 12:13:38 -0800
committerVasu Nori <vnori@google.com>2010-11-12 09:58:56 -0800
commitaad00f949ff6f941a251c8ad9bfa341dce412c58 (patch)
tree32b5e71f693cfd0275658b1f73cb4e90b88191b4 /ui
parent9d27069a5453574824860ad3db179599d044e7bd (diff)
downloadandroid_packages_providers_DownloadProvider-aad00f949ff6f941a251c8ad9bfa341dce412c58.tar.gz
android_packages_providers_DownloadProvider-aad00f949ff6f941a251c8ad9bfa341dce412c58.tar.bz2
android_packages_providers_DownloadProvider-aad00f949ff6f941a251c8ad9bfa341dce412c58.zip
simplify actions to perform when user clicks on delete in download app
bug:3175143 let downloadservice do the cleanup from all dataases and also let it handle removal of the file from the sdcard. Change-Id: I12eb8458223228109f1340552009d400b070bf54
Diffstat (limited to 'ui')
-rw-r--r--ui/src/com/android/providers/downloads/ui/DownloadList.java30
1 files changed, 4 insertions, 26 deletions
diff --git a/ui/src/com/android/providers/downloads/ui/DownloadList.java b/ui/src/com/android/providers/downloads/ui/DownloadList.java
index 0ab3f936..133b0bfe 100644
--- a/ui/src/com/android/providers/downloads/ui/DownloadList.java
+++ b/ui/src/com/android/providers/downloads/ui/DownloadList.java
@@ -33,7 +33,6 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.Downloads;
-import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -572,31 +571,10 @@ public class DownloadList extends Activity
* Delete a download from the Download Manager.
*/
private void deleteDownload(long downloadId) {
- if (moveToDownload(downloadId)) {
- int status = mDateSortedCursor.getInt(mStatusColumnId);
- boolean isComplete = status == DownloadManager.STATUS_SUCCESSFUL
- || status == DownloadManager.STATUS_FAILED;
- String localUri = mDateSortedCursor.getString(mLocalUriColumnId);
- if (isComplete && localUri != null) {
- String path = Uri.parse(localUri).getPath();
- if (path.startsWith(Environment.getExternalStorageDirectory().getPath())) {
- String mediaProviderUri = mDateSortedCursor.getString(mMediaProviderUriId);
- if (TextUtils.isEmpty(mediaProviderUri)) {
- // downloads database doesn't have the mediaprovider_uri. It means
- // this download occurred before mediaprovider_uri column existed
- // in downloads table. Since MediaProvider needs the mediaprovider_uri to
- // delete this download, just set the 'deleted' flag to 1 on this row
- // in the database. DownloadService, upon seeing this flag set to 1, will
- // re-scan the file and get the MediaProviderUri and then delete the file
- mDownloadManager.markRowDeleted(downloadId);
- return;
- } else {
- getContentResolver().delete(Uri.parse(mediaProviderUri), null, null);
- }
- }
- }
- }
- mDownloadManager.remove(downloadId);
+ // let DownloadService do the job of cleaning up the downloads db, mediaprovider db,
+ // and removal of file from sdcard
+ // TODO do the following in asynctask - not on main thread.
+ mDownloadManager.markRowDeleted(downloadId);
}
@Override