summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* allow run-time verbose debugging option on downloadmanager code.Vasu Nori2010-10-271-2/+2
| | | | | | otherwise, one has to recompile and reflash to get debug output Change-Id: I1d89d7cca3363fa793f74ba805136667e1ce3091
* remove usage of hidden public constants.Vasu Nori2010-10-206-11/+9
| | | | Change-Id: I2edf1bef5e741de8193cb293807e3ace42003b0c
* am 9f6654cf: Merge 216736d2 from gingerbreadJean-Baptiste Queru2010-10-182-54/+73
|\ | | | | | | | | | | | | Merge commit '9f6654cfec6e6d8d1e3de9a8adeba46137a22105' * commit '9f6654cfec6e6d8d1e3de9a8adeba46137a22105': bug:3099994 NPE in DownloadManager when deleting non-media file
| * Merge 216736d2 from gingerbreadJean-Baptiste Queru2010-10-152-54/+73
| |\ | | | | | | | | | Change-Id: I404d1a66d337b1dade181ade92dc21fc0e819aa7
| | * bug:3099994 NPE in DownloadManager when deleting non-media fileVasu Nori2010-10-152-54/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DownloadService always scans files and assumes MediaProvider returns a valid Uri. But MediaProvider returns null for return param 'uri' if the file is not audio/video/image etc media type file (for example, pdf) Change-Id: If32bd1895b00b5406973a5e240ad3558d46f9f4a
* | | am 3e759e21: am a53c21ed: fix broken build bug:3095237Vasu Nori2010-10-151-3/+1
|\| | | | | | | | | | | | | | | | | | | | Merge commit '3e759e21291d6ca1a49ded3f24f3be0a26af4e2b' * commit '3e759e21291d6ca1a49ded3f24f3be0a26af4e2b': fix broken build bug:3095237
| * | am a53c21ed: fix broken build bug:3095237Vasu Nori2010-10-131-3/+1
| |\| | | | | | | | | | | | | | | | | | | Merge commit 'a53c21edb5dc57d97dcddd03fbfa2022abf43787' into gingerbread-plus-aosp * commit 'a53c21edb5dc57d97dcddd03fbfa2022abf43787': 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-153-18/+139
|\| | | | | | | | | | | | | | | | | | | | | | | | | | correctly Merge commit '57c4e9180e3a339dba984f1c8dff76ef18443a7a' * commit '57c4e9180e3a339dba984f1c8dff76ef18443a7a': bug:3069735 in Download UI app, handle deletes correctly
| * | am e00c3120: bug:3069735 in Download UI app, handle deletes correctlyVasu Nori2010-10-133-18/+139
| |\| | | | | | | | | | | | | | | | | | | Merge commit 'e00c31208405bd2e4c88e069df7a2b15237f70bf' into gingerbread-plus-aosp * commit 'e00c31208405bd2e4c88e069df7a2b15237f70bf': bug:3069735 in Download UI app, handle deletes correctly
| | * bug:3069735 in Download UI app, handle deletes correctlyVasu Nori2010-10-133-18/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | am cd990514: Merge "Make DownloadProvider use parameterized queries." into ↵Steve Howard2010-10-081-39/+57
| |\| | | | | | | | | | | | | | | | | | | | | | | | | gingerbread Merge commit 'cd990514feb2b17848809d9262e0d73a828b2142' into gingerbread-plus-aosp * commit 'cd990514feb2b17848809d9262e0d73a828b2142': 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 ace1d5da: am d4dc8501: Merge "Seriously improve error reporting in ↵Steve Howard2010-10-014-198/+164
|\| | | | | | | | | | | | | | | | | | | | | | | | | | DownloadThread." into gingerbread Merge commit 'ace1d5da2b288f6166224cf2164731ae0fa2de61' * commit 'ace1d5da2b288f6166224cf2164731ae0fa2de61': Seriously improve error reporting in DownloadThread.
| * | am d4dc8501: Merge "Seriously improve error reporting in DownloadThread." ↵Steve Howard2010-10-014-198/+164
| |\| | | | | | | | | | | | | | | | | | | | | | | | | into gingerbread Merge commit 'd4dc8501ecb89b91f865510207297dd960afe031' into gingerbread-plus-aosp * commit 'd4dc8501ecb89b91f865510207297dd960afe031': Seriously improve error reporting in DownloadThread.
| | * Merge "Seriously improve error reporting in DownloadThread." into gingerbreadSteve Howard2010-10-014-198/+164
| | |\
| | | * Seriously improve error reporting in DownloadThread.Steve Howard2010-09-304-198/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My old error reporting strategy for DownloadThread was to log the stack trace for the exception, so we'd know exactly what conditions caused the StopRequest. hackbod suggested that we shouldn't log tracebacks as they clutter the log. Instead, we should just always include a little string tag explaining why the request is being stopped -- this is more concise and more useful to developers. There are three main changes here to acheive this goal: * make StopRequest require a short, log-friendly error message upon construction, and add such a message to all construction sites * make a similar change to GenerateSaveFileError, so that the variety of errors that originate with Helpers.generateSaveFile() get similarly fine-grained and concise error reporting * make network usable checking code return a distinct error code for each distinct negative condition, and add a utility to return a log-friendly error message for each such code. Finally, I cleaned up some of the ways errors/exceptions are handled in the process. Change-Id: Ie70cbf3f2960e260e97f8449258e25218d0f900f
* | | | 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
| * | | am 5d81e244: Avoid NPE when checking file URI in DownloadProviderSteve Howard2010-10-011-1/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | Merge commit '5d81e2447ed77860afecd71583e137178c2c6807' into gingerbread-plus-aosp * commit '5d81e2447ed77860afecd71583e137178c2c6807': 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 ed2f1150: resolved conflicts for merge of b108a273 to gingerbread-plus-aospSteve Howard2010-09-304-96/+58
|\| | | | | | | | | | | | | | | | | | | | Merge commit 'ed2f11502fb02509d9efec1dbda7981c86f37fbd' * commit 'ed2f11502fb02509d9efec1dbda7981c86f37fbd': Improve how the download manager reports paused statuses.
| * | resolved conflicts for merge of b108a273 to gingerbread-plus-aospSteve Howard2010-09-304-96/+58
| |\| | | | | | | | | | Change-Id: Iced3a5360702fdeb299f8b987a353d3aeca7629b
| | * Improve how the download manager reports paused statuses.Steve Howard2010-09-294-96/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes the download manager report more detail when a download is paused. Rather than always reporting status RUNNING_PAUSED, there are now four different statuses: * paused by the app * waiting to retry after a network error * waiting for network connectivity * queued for wifi due to size limits This allows a few improvements: * code deciding when to run a download can be improved and cleaned up (I've taken some extra steps in cleaning up this particular code) * notification code no longer has to rely on the in-memory-only "mPausedReason" member of DownloadInfo; instead, it knows from the status that the download is queued for wifi, and can display the appropriate string. This moves the string fetching out into the UI-specific logic and is a sign that this is really the right way to do things. And finally, the real motivation for this change: I've changed the meaning of "Queued" in the downloads UI so it now means "Queued for WiFi'. This is what was originally intended, I'd misunderstood. What was formerly known as "Queued", a download that hadn't started, is now displayed as "In progress" (it's always a transient state so it's basically meaningless anyway). Otherwise it remains the same (in particular, downloads paused for other reasons are still reported as "In progress"). I've also increased some of the logging in DownloadThread a bit, as this change initally introduced some bugs that were impossible to track down without that logging. There have been other bug reports that were impossible to diagnose and these few extra log statements should really help, without cluttering logs too much. I've taken care to avoid potentially introducing any PII into the logs. Change-Id: Id0b8d65fc8e4406ad7ffa1439ffc22a0281b051f
* | | am fce7a5e8: am d01ccf8e: Merge "Trim the database & check spurious files ↵Brad Fitzpatrick2010-09-281-2/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | off the UI thread." into gingerbread Merge commit 'fce7a5e8547d4ea53700f37b87752e26a39e4cc4' * commit 'fce7a5e8547d4ea53700f37b87752e26a39e4cc4': Trim the database & check spurious files off the UI thread.
| * | am d01ccf8e: Merge "Trim the database & check spurious files off the UI ↵Brad Fitzpatrick2010-09-281-2/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | thread." into gingerbread Merge commit 'd01ccf8ef98aba424a49c44ed6db39435c6d6d77' into gingerbread-plus-aosp * commit 'd01ccf8ef98aba424a49c44ed6db39435c6d6d77': Trim the database & check spurious files off the UI thread.
| | * Merge "Trim the database & check spurious files off the UI thread." into ↵Brad Fitzpatrick2010-09-281-2/+3
| | |\ | | | | | | | | | | | | gingerbread
| | | * Trim the database & check spurious files off the UI thread.Brad Fitzpatrick2010-09-281-2/+3
| | | | | | | | | | | | | | | | Change-Id: I92180fc4344579b93361d5584243688a1cfdd091
| * | | am 14961f94: Moved DownloadManager to android.app (DO NOT MERGE)Steve Howard2010-09-282-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | Merge commit '14961f94d762e733a733e3268fca1074d8da5f8c' into gingerbread-plus-aosp * commit '14961f94d762e733a733e3268fca1074d8da5f8c': Moved DownloadManager to android.app (DO NOT MERGE)
| | * | Moved DownloadManager to android.app (DO NOT MERGE)Steve Howard2010-09-272-2/+2
| | |/ | | | | | | | | | | | | | | | | | | I'll merge this manually, as there's some additional master-only code that will be to be simultaneously changed. Change-Id: Ifdb1740f32e228bc07f266585737b98a7b794685
* | | Manual merge: Moved DownloadManager to android.appSteve Howard2010-09-282-2/+2
| | | | | | | | | | | | Change-Id: Id1de44459ec1bf53e928cae826047467b355823d
* | | 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
| * | am 36f06f4c: Merge "DB migration to eliminate some null fields in old ↵Steve Howard2010-09-231-1/+28
| |\| | | | | | | | | | | | | | | | | | | | | | | | | downloads" into gingerbread Merge commit '36f06f4c8497ab47e64bcc5d8cea12a109fede5e' into gingerbread-plus-aosp * commit '36f06f4c8497ab47e64bcc5d8cea12a109fede5e': DB migration to eliminate some null fields in old downloads
| | * Merge "DB migration to eliminate some null fields in old downloads" into ↵Steve Howard2010-09-231-1/+28
| | |\ | | | | | | | | | | | | gingerbread
| | | * 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 5dbaa73a: am ebb555c0: Support multi-valued HTTP headers, handle new API ↵Steve Howard2010-09-232-15/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes Merge commit '5dbaa73a7f356f67810becbf3ad258a7dd765e59' * commit '5dbaa73a7f356f67810becbf3ad258a7dd765e59': Support multi-valued HTTP headers, handle new API changes
| * | | am ebb555c0: Support multi-valued HTTP headers, handle new API changesSteve Howard2010-09-232-15/+17
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | Merge commit 'ebb555c0687061993dd6a22d15f6aab2437ee8c5' into gingerbread-plus-aosp * commit 'ebb555c0687061993dd6a22d15f6aab2437ee8c5': Support multi-valued HTTP headers, handle new API changes
| | * | Support multi-valued HTTP headers, handle new API changesSteve Howard2010-09-222-15/+17
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | * backend support for multiple values for the same HTTP headers, for corresponding API changes * other minor changes in response to DownloadManager API changes Change-Id: I7c595e94a60ed7afaca6cc3fb4c05aaeeff20c2a
* | | am 7b96b251: am d3197296: Implement dialogs for wifi required + recommended ↵Steve Howard2010-09-216-25/+240
|\| | | | | | | | | | | | | | | | | | | | | | | | | | limits. Merge commit '7b96b251c0404ed3f05652bd7d5209910fb999cc' * commit '7b96b251c0404ed3f05652bd7d5209910fb999cc': Implement dialogs for wifi required + recommended limits.
| * | am d3197296: Implement dialogs for wifi required + recommended limits.Steve Howard2010-09-216-25/+240
| |\| | | | | | | | | | | | | | | | | | | Merge commit 'd319729622da1893e895f2e35f41d01ecdca3705' into gingerbread-plus-aosp * commit 'd319729622da1893e895f2e35f41d01ecdca3705': Implement dialogs for wifi required + recommended limits.
| | * Implement dialogs for wifi required + recommended limits.Steve Howard2010-09-216-25/+240
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-203-67/+103
|\| | | | | | | | | | | | | | | | | | | | | | | | | | error messages in UI" into gingerbread Merge commit '2031fa7bad5ef3e31cf0ea73d0b9bf4670842cf0' * commit '2031fa7bad5ef3e31cf0ea73d0b9bf4670842cf0': Improve file error reporting + new detailed error messages in UI
| * | am dc738781: Merge "Improve file error reporting + new detailed error ↵Steve Howard2010-09-203-67/+103
| |\| | | | | | | | | | | | | | | | | | | | | | | | | messages in UI" into gingerbread Merge commit 'dc738781156d0f5ac1db62838d42c876d740810d' into gingerbread-plus-aosp * commit 'dc738781156d0f5ac1db62838d42c876d740810d': Improve file error reporting + new detailed error messages in UI
| | * Improve file error reporting + new detailed error messages in UISteve Howard2010-09-203-67/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-207-641/+470
|\| | | | | | | | | | | | | | | | | | | | | | | | | | DownloadReceiver Merge commit 'b9115af1e7b39a25c00aed7c9d3bb413ecef9eda' * commit 'b9115af1e7b39a25c00aed7c9d3bb413ecef9eda': Fix notification bugs, cleanup DownloadService + DownloadReceiver
| * | am 3398db8f: Fix notification bugs, cleanup DownloadService + DownloadReceiverSteve Howard2010-09-207-641/+470
| |\| | | | | | | | | | | | | | | | | | | Merge commit '3398db8f3b195959faa2a7cf09918f364432ac28' into gingerbread-plus-aosp * commit '3398db8f3b195959faa2a7cf09918f364432ac28': Fix notification bugs, cleanup DownloadService + DownloadReceiver
| | * Fix notification bugs, cleanup DownloadService + DownloadReceiverSteve Howard2010-09-207-641/+470
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | am 4bebe75b: Temporary fix to support old URIs for MarketSteve Howard2010-09-171-1/+6
| |\| | | | | | | | | | | | | | | | | | | Merge commit '4bebe75b3e2361d7fb0aa966598c41c45ad9317f' into gingerbread-plus-aosp * commit '4bebe75b3e2361d7fb0aa966598c41c45ad9317f': 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