summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadProvider.java
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * DB migration to eliminate some null fields in old downloadsSteve Howard2010-09-221-1/+28
| | | | | | | | | | | | | | | | | | The DownloadProvider now ensures that current bytes, total bytes, title and description are never null in the DB. Some new code relies on this assumption for simplicity. That means we need to ensure this invariant is true for pre-existing downloads as well. Change-Id: Iea2289516d2636edf3394678ab08aa9cea31dc69
* | am 7b96b251: am d3197296: Implement dialogs for wifi required + recommended ↵Steve Howard2010-09-211-2/+9
|\| | | | | | | | | | | | | | | | | limits. Merge commit '7b96b251c0404ed3f05652bd7d5209910fb999cc' * commit '7b96b251c0404ed3f05652bd7d5209910fb999cc': Implement dialogs for wifi required + recommended limits.
| * Implement dialogs for wifi required + recommended limits.Steve Howard2010-09-211-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change extends the original work to add a size limit over which wifi is required to download a file. First, this change adds a second size limit, over which wifi is recommended but not required. The user has the option to bypass this limit. Second, this change implements dialogs shown to the user when either limit is exceeded. These dialogs are shown by the background download manager service when a download is started and found to be over the limit (and wifi is not connected). I'm including one small fix to the unit tests needed from the previous change. Change-Id: Ia0f0acaa7b0d00e98355925c3446c0472048df10
* | am 2031fa7b: am dc738781: Merge "Improve file error reporting + new detailed ↵Steve Howard2010-09-201-2/+6
|\| | | | | | | | | | | | | | | | | error messages in UI" into gingerbread Merge commit '2031fa7bad5ef3e31cf0ea73d0b9bf4670842cf0' * commit '2031fa7bad5ef3e31cf0ea73d0b9bf4670842cf0': Improve file error reporting + new detailed error messages in UI
| * Improve file error reporting + new detailed error messages in UISteve Howard2010-09-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | * support new error code for "destination file already exists" * improve error handling for various file error cases to return a more specific error code when appropriate * make UI support more detailed error messages for some cases * use Uri.getPath() instead of Uri.getSchemeSpecificPart() for file URIs Change-Id: Icb01d4d3b47c7776be3ddcd8347212e950cd023e
* | am b9115af1: am 3398db8f: Fix notification bugs, cleanup DownloadService + ↵Steve Howard2010-09-201-3/+2
|\| | | | | | | | | | | | | | | | | DownloadReceiver Merge commit 'b9115af1e7b39a25c00aed7c9d3bb413ecef9eda' * commit 'b9115af1e7b39a25c00aed7c9d3bb413ecef9eda': Fix notification bugs, cleanup DownloadService + DownloadReceiver
| * Fix notification bugs, cleanup DownloadService + DownloadReceiverSteve Howard2010-09-201-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change started out just fixing a few regressions related to notifications: * Browser downloads weren't picking up a title from the determined filename. This was due to my change to default the title field to "" instead of null. * Notification click/hide events weren't being handled properly. This was due to previous change to the URI structure of DownloadProvider. DownloadReceiver needed to be changed to perform queries through /all_downloads URIs, like all other parts of the download manager code. I did some general refactoring of the DownloadReceiver code while I was there. * The code in DownloadNotification wasn't picking up some updates to downloads properly. This was due to my change to make DownloadNotification use the DownloadInfo objects rather than querying the database directly, so that it could make use of info provided by the DownloadThread that didn't go into the DB. Fixing this didn't turn out to be all that complicated, but along the way to figuring this out I made some substantial refactoring in DownloadService which made it much cleaner anyway and eliminated a lot of duplication. That's something that had to happen eventually, so I'm leaving it all in. Change-Id: I847ccf80e3d928c84e36bc24791b33204104e1b2
* | am e8027017: am 4bebe75b: Temporary fix to support old URIs for MarketSteve Howard2010-09-181-1/+6
|\| | | | | | | | | | | | | Merge commit 'e80270177d1b504525d1f4ea4139b0c213fea891' * commit 'e80270177d1b504525d1f4ea4139b0c213fea891': Temporary fix to support old URIs for Market
| * Temporary fix to support old URIs for MarketSteve Howard2010-09-171-1/+6
| | | | | | | | | | | | | | | | Market has its own copies of the download manager URIs. This change bring back support for those so Market will keep working until they can properly update their code. Change-Id: I283ea65931085c0f083a182842d362c113427537
* | am 176a7442: resolved conflicts for merge of 3d55d829 to gingerbread-plus-aospSteve Howard2010-09-161-175/+196
|\| | | | | | | | | | | | | Merge commit '176a74426f750dc56e7d200a4cdc3b6ed75fe6cd' * commit '176a74426f750dc56e7d200a4cdc3b6ed75fe6cd': New URI structure with "my_downloads" and "all_downloads"
| * New URI structure with "my_downloads" and "all_downloads"Steve Howard2010-09-141-175/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a second view into the download manager database via a set of URIs starting with /all_downloads, renaming the original /download URIs to /my_downloads. In addition to making things more clear, this change allows the downloads UI to grant permissions on individual downloads to viewer apps. The old semantics were: * for ordinary callers, /download included only downloads initiated by the calling UID * for intraprocess calls or calls by root, /download included all downloads The new semantics are * /my_downloads always includes only downloads initiated by the calling UID, and requires only INTERNET permission. It could just as well require no permission, but that's not possible in the framework, since path-permissions can only broaden access, not tighten it. It doesn't matter, because these URIs are useless without INTERNET permission -- if a user can't initiate downloads, there's no reason to read this. * /all_downloads always includes all downloads on the system, and requires the new permission ACCESS_ALL_DOWNLOADS. This permission is currently protectionLevel=signature -- this could be relaxed later to support third-party download managers. All download manager code has been changed to use /all_downloads URIs, except when passing a URI to another app. In making this change across the download manager code, I've taken some liberties in cleaning things up. Other apps are unchanged and will use /my_downloads. Finally, this incorporates changes to DownloadManager to return a content URI for /cache downloads -- the download UI no longer assumes it's a file URI, and it grants permissions to the receiver of the VIEW intent. The public API test has also been updated. I've also fixed some null cursor checking in DownloadManager. Change-Id: I05a501eb4388249fe80c43724405657c950d7238
* | am 7fa71b17: am 71e7fda9: Further work on the new downloads UI.Steve Howard2010-09-121-2/+34
|\| | | | | | | | | | | | | Merge commit '7fa71b17d1bcaceb4688cb4b0e6982d1db4a0538' * commit '7fa71b17d1bcaceb4688cb4b0e6982d1db4a0538': Further work on the new downloads UI.
| * Further work on the new downloads UI.Steve Howard2010-09-101-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add support for downloads not visible in the UI * add support for restarting failed downloads and downloads for which the file is missing * add "clear selection" button to selection menu * fix DateSortedExpandableListAdapter to ensure the view refreshes properly anytime the underlying data changes * make DownloadList handle when a selected download gets deleted by another app * make DownloadList close a dialog for a pending download when the download starts * show a dialog when the user tries to open a download but the file is missing * display "<Unknown>" when no title is provided for a download * add a test case for DownloadManager.orderBy() (should've gone in the previous commit) Change-Id: Ibf3062e8228e7f2c1270be24d8d5527dfb064658