summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadProvider.java
Commit message (Collapse)AuthorAgeFilesLines
* Always update notifications, media scanner.Jeff Sharkey2013-10-041-16/+5
| | | | | | | | | insert() was trying to be too clever, and it would end up delaying the media scanner until the next download happened. This resulted in duplicate photos in DocumentsUI. Bug: 11081685 Change-Id: Ic9549ede38118372849119dd3a21415a4723e9f5
* Allow all downloads to be writable.Jeff Sharkey2013-10-011-19/+3
| | | | | Bug: 10943812 Change-Id: Ib0cb3e608c1f40a2e2fcd6e493c8f920d8b4221b
* Revoke grants when downloads are deleted.Jeff Sharkey2013-09-261-0/+13
| | | | | | | | When deleting downloads, revoke any Uri permission grants, which removes from getPersistedUriPermissions(). Bug: 10928851 Change-Id: I3e90c4071385832dcb3e0cf9ca3fdccafbe30037
* Allow saving to Downloads.Jeff Sharkey2013-09-231-9/+46
| | | | | | | | | | | Add column to mark downloads as being writable, and allow documents to be created under Downloads backend. Update database when writing is finished, and generate unique filenames when they already exist. Check canonical path on incoming _DATA paths. Bug: 10667164, 10892621, 10893268 Change-Id: I8c203b96ff042a895b58686903fcd07fc755a00f
* Restore the appropriate SELinux context to the downloads dir.Geremy Condra2013-04-041-2/+7
| | | | Change-Id: I4839fd07abdd1c6b866f1d94dc36567df047e30c
* Dump recent downloads from provider.Jeff Sharkey2013-01-301-1/+41
| | | | | | | | | The lifetime of DownloadService can be limited, and it's often missing from bugreports. The provider has a much longer lifetime, so have it dump raw data about recent downloads. Bug: 7350685 Change-Id: I55c9d602d77014ea27820936f1cf5c8ad24f286a
* Better handling of retryable errors.Jeff Sharkey2013-01-171-1/+1
| | | | | | | | Now the final errors are always thrown, and the outer code decides how to handle them as retries. Also clean up method signatures. Bug: 8022478 Change-Id: I4e7e43be793294ab837370df521e7c381e0bb6c3
* Remove singleton StorageManager.Jeff Sharkey2013-01-051-1/+1
| | | | | | | Now DownloadService creates and owns the lifecycle of its own StorageManager instance. Change-Id: I8f6bedc02f1dbe610a8e6a25d55383a12716d344
* Rewrite of download notifications.Jeff Sharkey2012-11-091-8/+3
| | | | | | | | | | | | | | | | | | Switch to using new inbox-style notifications when collapsing multiple downloads. Correctly handles clustering, including cancellation of stale notifications. All notifications are now handled in a single class, making it easier to reason about correctness. Fixed bugs around handling of visibility flags. Move away from using "int" as internal keys, since they can overflow. Started work for time estimates, will finish in a future CL. Explicitly pass all relevant IDs to DownloadReceiver instead of doing a second racy query. Fix StrictMode warnings when querying in DownloadReceiver. Bug: 6777872, 5463678, 6663547, 6967346, 6634261, 5608365 Change-Id: I5eb47b73b90b6250acec2ce5bf8d7a274ed9d3a9
* Report MIME type for individual downloads.Jeff Sharkey2012-04-191-5/+8
| | | | | Bug: 6358473 Change-Id: Ied4a6c8194d0cbb735e43cf7d7759f4674efe535
* Add and enforce ALLOW_METERED column.Jeff Sharkey2012-04-171-1/+8
| | | | | | | | | | | | Include flag with each download to indicate if its allowed to proceed over metered networks. Downloads are left in WAITING_FOR_NETWORK state, similar to how ALLOWED_NETWORK_TYPES is handled. Also keep blocked downloads in WAITING_FOR_NETWORK state instead of marking them as failed. Bug: 3001465, 5734560 Change-Id: I80bb9aa9bd25ddf6f7a2472db344b6ba6878bd74
* View file downloads through DownloadsProvider.Jeff Sharkey2012-04-171-4/+26
| | | | | | | | | When viewing file://-style downloads, open through DownloadsProvider so that FLAG_GRANT_READ_URI_PERMISSION works. Add support for OpenableColumns to support external apps probing for metadata. Bug: 6343461 Change-Id: I630405406321ea1871c62cbcded55a4ee024ef6e
* Use UID instead of PID.Jeff Sharkey2011-11-111-1/+1
| | | | | Bug: 5606426 Change-Id: I9b9cee142c360da2a30a4bb8be8dcf40b8c7e43e
* Check canonical path when download requested.Jeff Sharkey2011-10-121-4/+10
| | | | | Bug: 5449870 Change-Id: I3219273be9b796b123545c811e5f39fa83b5768e
* Eliminate single-process mode.Jeff Brown2011-07-081-2/+1
| | | | | | Bug: 5010576 Change-Id: I2f9bcad41cf50ed0b17dd487d0389f7b38500fd7
* Allow VISIBLE_NOTIFY_COMPLETED on Request.Jeff Sharkey2011-04-131-4/+8
| | | | | | | | Updates list of allowed visibility values to enable Request builders to use Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED. Bug: 4283223 Change-Id: I8ebe4a13f95a58f25f6025946a6d4725261717f2
* bug:3513950 fix the commentsVasu Nori2011-03-071-6/+6
| | | | Change-Id: I6192a829c7cac86c55a0f67364ebd722504d5dc7
* bug:3425749 if adding completed download to db, send completion notifVasu Nori2011-02-101-8/+27
| | | | Change-Id: I9f9f6f2e0b2bd18f3767574fc51301b75bb1b76d
* am 6e9abd8e: am d119d3cb: Revert "bug:3414192 if otaupdate column is set, ↵Vasu Nori2011-02-031-10/+0
|\ | | | | | | | | | | | | don\'t check mobile download limits" * commit '6e9abd8e04c4aaafb8493a25efc34f4dd4fa6013': Revert "bug:3414192 if otaupdate column is set, don't check mobile download limits"
| * Revert "bug:3414192 if otaupdate column is set, don't check mobile download ↵Vasu Nori2011-02-031-10/+0
| | | | | | | | | | | | limits" This reverts commit ea245800c69d6bc10dc2680e6a242f59e9cb49b6.
* | am 49663f1f: am f20af912: Revert "Merge "bug:3341145 if ignore_size_limits ↵Vasu Nori2011-02-031-9/+5
|\| | | | | | | | | | | | | flag set, validate caller\'s perms" into honeycomb" * commit '49663f1ffe58a546fb0d2ab84898843ef5e89eb5': Revert "Merge "bug:3341145 if ignore_size_limits flag set, validate caller's perms" into honeycomb"
| * Revert "Merge "bug:3341145 if ignore_size_limits flag set, validate caller's ↵Vasu Nori2011-02-031-9/+5
| | | | | | | | | | | | | | perms" into honeycomb" This reverts commit 3e7bb1c5d7e7d1a013df959c1a6947b33df0a0fd, reversing changes made to b2085f61b37ad4a70c799012f25ff62a38173f68.
* | am afefa43d: am cac5bbb5: Revert "bug:3420722"Vasu Nori2011-02-031-1/+0
|\| | | | | | | | | * commit 'afefa43d9919f9284885f7080111c54a50c4fc90': Revert "bug:3420722"
| * Revert "bug:3420722"Vasu Nori2011-02-031-1/+0
| | | | | | | | This reverts commit 1cccc19b596f168ed34126db38b046ab164e063b.
* | resolved conflicts for merge of 73642748 to masterVasu Nori2011-02-031-1/+1
|\| | | | | | | Change-Id: I477599f16db5ea64e4fbc4d2be68dcedf2c80269
| * bug:3420722Vasu Nori2011-02-031-0/+1
| | | | | | | | Change-Id: Id40d2dbbefe5fa2546f8c5231be5f7fe9a7b43d6
* | resolved conflicts for merge of 43d649e9 to masterVasu Nori2011-02-021-5/+9
|\| | | | | | | Change-Id: I27a615509269f256cf66de2dd217d8c4667caab4
| * bug:3341145 if ignore_size_limits flag set, validate caller's permsVasu Nori2011-02-021-5/+9
| | | | | | | | | | | | and then of course ignore the mobile network size limits Change-Id: I6765be9255187f93bd51acecc19a15db4f324204
* | Check for null before accessing pckg.Leon Scroggins2011-02-021-1/+1
| | | | | | | | | | | | | | Prevents null pointer exception when using DownloadManager.completedDownload Change-Id: I53859705c5e925f2320491451e41a631e4fed715
* | am 8db8fba2: am ea245800: bug:3414192 if otaupdate column is set, don\'t ↵Vasu Nori2011-02-011-0/+10
|\| | | | | | | | | | | | | check mobile download limits * commit '8db8fba215a981edd24ad1f7118d3397be0114d2': bug:3414192 if otaupdate column is set, don't check mobile download limits
| * bug:3414192 if otaupdate column is set, don't check mobile download limitsVasu Nori2011-02-011-0/+10
| | | | | | | | | | | | | | this allows OTA update to work without being subject to download limits on mobile networks. Change-Id: I92c60ba3ecbde615bd93778b391a5fe067dbd2fe
* | bug:3048327 (master) ability to add completed download to dnload mgrVasu Nori2011-01-211-10/+56
|/ | | | Change-Id: Ib9d4df107787191a5349365908cbe096b67770dc
* bug:3286430 set quota on downloads data dirVasu Nori2010-12-231-1/+5
| | | | | | | | | | make sure the doanloads data dir size is limited by some quote - 100MB default and 200MB for SR. bug:3286430 tests are in Change-Id: I688f7e058511089bec7fa21e972e23780604d98a Change-Id: Iba7fab9fa91ea018f35e1c3ef5ec0e6b03cba650
* Download dir: /data/data/com.android.providers.downloads/cache NOT /cacheVasu Nori2010-12-141-2/+10
| | | | | | | | | | bug:3264401 still to do: make sure only N bytes are taken up by downloads dir N = a value specific to each device. default = 100MB. Change-Id: I2a49f4b3831d3a8d7be13b5fd46d85d56e831e38
* am 5c29cce0: am e1823c84: Don\'t filter by UID for apps with ↵Kenny Root2010-12-011-1/+3
|\ | | | | | | | | | | | | ACCESS_ALL_DOWNLOADS * commit '5c29cce0bac00a7a32cd92210825a789e140cf94': Don't filter by UID for apps with ACCESS_ALL_DOWNLOADS
| * Don't filter by UID for apps with ACCESS_ALL_DOWNLOADSKenny Root2010-12-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Old platform behavior of DownloadProvider would allow anyone with special access to access all the downloads. New behavior is to return /my_downloads/ on an .insert() call. For things that aren't using the new API where DownloadInfo.getAllDownloadsUri() is accessible, make any application with ACCESS_ALL_DOWNLOADS permission bypass the calling UID check for /my_downloads/ Bug: 3242328 Change-Id: I536fde4525dd74066879f7c7da7fa609ff344645
* | provider changes due to CL: Ief1693785f0484c1b434fb41a68693f9aff96492Vasu Nori2010-11-121-2/+6
| | | | | | | | Change-Id: I8940778292d0a9166cfcfb92d37ea568b8f6ceef
* | when a download fails, store the error msg in dbVasu Nori2010-11-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | useful for debugging for bugs like bug:3187299 without this error message, one doesn't know WHY downloads fail. to prevent PII info in database, there is a STOPSHIP comment around storage of this error message in database. Change-Id: I612e383aef8483b68b772f70dff722a5daea2ef5
* | allow the column "scanned" from DownloadManager. bug:3169437Vasu Nori2010-11-051-0/+1
| | | | | | | | Change-Id: I96f0b51295611b67735c1b726bcd46bbeaa90613
* | changes to support CL: I1f5dd734e394db0056579a3a0c26862fee27981eVasu Nori2010-11-041-1/+22
| | | | | | | | | | | | | | | | | | | | | | 1. if an application designates a downloaded file to be mediascanner scannable or not, store that fact in database. 2. use the above to determine whether a file shoudl be mediascanned or not in DownloadService 3. implement code to return mimetype for the new Uri "/public_downloads" introduced in CL: I1f5dd734e394db0056579a3a0c26862fee27981e Change-Id: I5c062ad6d1b58306044cee49ff3827e908d27fd9
* | remove usage of hidden public constants.Vasu Nori2010-10-201-4/+0
| | | | | | | | Change-Id: I2edf1bef5e741de8193cb293807e3ace42003b0c
* | am 3e759e21: am a53c21ed: fix broken build bug:3095237Vasu Nori2010-10-151-3/+1
|\| | | | | | | | | | | | | Merge commit '3e759e21291d6ca1a49ded3f24f3be0a26af4e2b' * commit '3e759e21291d6ca1a49ded3f24f3be0a26af4e2b': fix broken build bug:3095237
| * fix broken build bug:3095237Vasu Nori2010-10-131-3/+1
| | | | | | | | Change-Id: I7e1fe99cc482fc270894a820049275fc0c64233e
* | am 57c4e918: am e00c3120: bug:3069735 in Download UI app, handle deletes ↵Vasu Nori2010-10-151-2/+23
|\| | | | | | | | | | | | | | | | | correctly Merge commit '57c4e9180e3a339dba984f1c8dff76ef18443a7a' * commit '57c4e9180e3a339dba984f1c8dff76ef18443a7a': bug:3069735 in Download UI app, handle deletes correctly
| * bug:3069735 in Download UI app, handle deletes correctlyVasu Nori2010-10-131-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gingerbread. High-level details 1. When a file is downloaded by DownloadManager, metadata about the file is stored in 2 databases: DownloadProvider and MediaProvider. 2. So, when it is to be deleted, its metadata needs to be cleaned up from both the databases. 3. But the 2 databases use differnt content-uri's as "primary keys" and DownloadProvider loses the "primary-key" of the row in MediaProvider database. 4. Easiest thing would have been to have DownloadProvider give filepath to MediaProvider and let MediaProvider linearly scan its database to locate the row and delete it. 5. The other - faster but more coding for now - option is to have DownloadProvider store the "primary-key" of the MediaProvider's row. implemented in this CL. Low-level details 1. add 2 new columns to downloads table in downloads.db: mediaprovider_uri = downloaded file's content_uri in mediaprovider db this column is null for downloads that finished before this column is added to the database. deleted = flag is set to true if a file is to be deleted 2. download UI app shows only those files whose 'deleted' flag is not set. 3. when the user deletes downloads from download UI app, 3.1. if mediaprovider_uri is NOT null, then the row is deleted from downloads table AND from the mediaprovider database. 3.2 if mediaprovider_uri is NULL, then its row in downloads database is marked 'tp be deleted' by setting 'deleted' column to '1'. 4. When DownloadService (in DownloadProvider) processes all rows from downloads table, if it sees any rows wth 'deleted' = 1, then it uses MediaScanner Service to re-scan the file, get the mediaprovider_uri from MediaProvider and update the row in downloads table with this mediaprovider_uri value and then delete the row by doing the following 1. delete it from MediaProvider database using mediaprovider_uri 2. delete it from DownloadProvider database Problem with this solution: There is a small window where it is deleted by the user on the Download app (and the row disappears from the display) but it is still present in Gallery app. Thats due to the following asynchronous operations 1. DownladService which processes rows-to-be-deleted is not always up 2. DownloadService uses asynchronous call to have the file re-scanned by MediaScanner to get mediaprovider_uri Change-Id: Ib90eb9e647f543312c865d3bbf9a06fb867a648b
* | am 1f262cf3: am cd990514: Merge "Make DownloadProvider use parameterized ↵Steve Howard2010-10-101-39/+57
|\| | | | | | | | | | | | | | | | | queries." into gingerbread Merge commit '1f262cf3af0512e0d621b7818aab9bb79527f01f' * commit '1f262cf3af0512e0d621b7818aab9bb79527f01f': Make DownloadProvider use parameterized queries.
| * Make DownloadProvider use parameterized queries.Steve Howard2010-10-081-39/+57
| | | | | | | | | | | | | | | | This avoids filling up the query cache unnecessary, but required some structural changes to ease the passing around of a selection along with its arguments. Change-Id: I724185763b94146d17573cab68f675c24e49634e
* | am 42469fa4: am 5d81e244: Avoid NPE when checking file URI in DownloadProviderSteve Howard2010-10-011-1/+2
|\| | | | | | | | | | | | | Merge commit '42469fa405c7aa891e7c431cd65edd424803979c' * commit '42469fa405c7aa891e7c431cd65edd424803979c': Avoid NPE when checking file URI in DownloadProvider
| * Avoid NPE when checking file URI in DownloadProviderSteve Howard2010-09-301-1/+2
| | | | | | | | Change-Id: Ic937b05308cecce244725e25767a3a1310a8463d
* | am 04d70252: am 36f06f4c: Merge "DB migration to eliminate some null fields ↵Steve Howard2010-09-231-1/+28
|\| | | | | | | | | | | | | | | | | in old downloads" into gingerbread Merge commit '04d7025262d7f6c5c372ec699d78b18d05b0400b' * commit '04d7025262d7f6c5c372ec699d78b18d05b0400b': DB migration to eliminate some null fields in old downloads