summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Support for max download size that may go over mobileSteve Howard2010-07-196-119/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces support for a maximum download size that may go over a mobile connection. Downloads above this limit will wait for a wifi connection. To accomplish this, I moved a lot of the logic for checking connectivity info into DownloadInfo itself. I then moved the code to call these checks from DownloadService, where it would call the checks before spawning a DownloadThread, into DownloadThread itself. This makes it simpler to check connectivity after we get Content-Length info. It also eliminates the risk of a race condition where connectivity changes between the check and the actual request execution. I realize this change reduces efficiency, because we now call into ConnectivityManager/TelephonyManager twice per DownloadThread, rather than once per DownloadService "tick". I feel that it's OK since its a small amount of computation running relatively infrequently. If we feel that it's a serious concern, and that the efficiency issues outweigh the race problem, I can go easily back to the old approach. I've left out the code to actually fetch the limit. I think this will come from system settings, but I want to double-check, so I'll put it in a separate change. Other changes: * simplify SystemFacade's interface to get connectivity info - rather than returning all connected types, just return the active type, since that should be all we care about * adding @LargeTest to PublicApiFunctionalTest Change-Id: Id1faa2c45bf2dade9fe779440721a1d42cbdfcd1
* Introduce a seam to ConnectivityManager and TelephonyManagerSteve Howard2010-07-157-64/+99
| | | | | | | | | This change abstracts access to ConnectivityManager and TelephonyManager behind methods on SystemFacade, moving the code from Helpers into RealSystemFacade and adding fake implementations to FakeSystemFacade. This facilitates new connectivity tests. Change-Id: Id6c6b861e1d4ca45b3c1572bfb8ae0aa26af756b
* Merge "Support for custom HTTP headers on download requests" into gingerbreadSteve Howard2010-07-154-175/+273
|\
| * Support for custom HTTP headers on download requestsSteve Howard2010-07-154-175/+273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provider changes: * new many-to-one DB table holding headers for each download. since there was no real migration logic in DownloadProvider, I implemented some. * DownloadProvider.insert() reads request headers out of the ContentValues and puts them into the new table * DownloadProvider.query() supports a new URI form, download/#/headers, to fetch the headers associated with a download * DownloadProvider.delete() removes request headers from this table Service changes: * made DownloadInfo store request headers upon initialization. While I was at it, I refactored the initialization logic into DownloadInfo to get rid of the massive 24-parameter constructor. The right next step would be to move the update logic into DownloadInfo and merge it with the initialization logic; however, I realized that headers don't need to be updatable, and in the future, we won't need the update logic at all, so i didn't bother touching the update code. * made DownloadThread read headers from the DownloadInfo and include them in the request; merged the custom Cookie and Referer logic into this logic Also added a couple new test cases for this stuff. Change-Id: I421ce1f0a694e815f2e099795182393650fcb3ff
* | Cleanup whitespace in DownloadNotificationSteve Howard2010-07-151-24/+24
|/ | | | Change-Id: I598ece9690649573d44d3089e473612e25f2974b
* Support for file URI destinations + last modified timestampSteve Howard2010-07-142-55/+114
| | | | | | | | | | | | | File URI destinations: * permission checking in DownloadProvider * implementation in Helpers.generateSaveFile(). it's a fairly small amount of logic added here, but I did some significant method extraction to simplify this change and clean up the code in general. * added test case Last modified timestamp: * made DownloadProvider use a SystemFacade for getting system time, so I could properly test timestamps * updated test cases to cover last modified time + handle new ordering
* Improve error message when SQL parser gets illegal characterSteve Howard2010-07-131-1/+1
| | | | Change-Id: Ife165361ebd75d558b311710e62abdfbdc355f1b
* Stub out the system clock in the download manager, add testsSteve Howard2010-07-014-15/+38
| | | | | | | | | | | | | | Introduce SystemFacade, an interface that allows us to stub out the system clock for testing the download manager. This allows us to test retrying a failed download without having the test wait 60 seconds. This interface can include other dependencies in the future as well. I've also used this to add tests for 503 (retry-after) and 301 (redirect), and I've added a test for download to the cache partition. Other changes: * made MockWebServer capable of checking + rethrowing exceptions from child threads * refactoring + cleanup of DownloadManagerFunctionalTest
* merge from open-source masterThe Android Open Source Project2010-05-101-1/+13
|\ | | | | | | Change-Id: If84d4054324db6d10fd0cdbd2169c039c6675726
| * code left opened files behindusul2010-05-101-1/+13
| | | | | | | | | | | | | | verified with lsof DownloadProvider after downloading a file shows: ${proc} 338 10034 33w REG 179,0 167634 5 /sdcard/download/fw4-1.pdf Change-Id: I8e2412fe9a6348f5ece6f5ca3a9ebf99a4474bce
| * Show correct date for downloads in the statusbarPer Edelberg2010-02-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The date was not set properly in notifications when the text for expanded view was created. This fix sets the displayed time to the download time for each individual file. The DownloadProvider recreates the notifications several times but don't set the time before the expanded message is created. The expanded message will therefore display the time the notification was created and not the time a file was downloaded. The displayed time will in most case be the time when the last file was downloaded. This fix sets the displayed time to the downloaded time for each individual file.
| * eclair snapshotJean-Baptiste Queru2009-11-129-472/+564
| |
* | Update to reflect android-common no longer in framework.Dianne Hackborn2010-02-241-1/+1
| |
* | Supply a Context to AndroidHttpClient.newInstance(), to enableDan Egnor2010-02-101-1/+1
| | | | | | | | persistent SSL session caching.
* | Create a new permission that allows apps to see downloads from otherLeon Scroggins2010-02-052-29/+41
| | | | | | | | | | | | | | | | | | | | | | | | applications to the SD card. Necessary for http://b/issue?id=2384554 Also create names for files by default, so they do not display as <Untitled>. Remove calls to createTitleFromFilename, which are no longer necessary. Requires a change to frameworks/base.
* | Grant access to downloaded packages to default container.Suchi Amalapurapu2010-01-271-3/+33
| | | | | | | | | | The package name is hardcoded for now but will eventually move to a separate gid guarded by a permission.
* | b/2383073 Use new fine-grained download status codes.Attila Bodis2010-01-261-29/+36
| | | | | | | | | | Takes advantage of two new download status codes (STATUS_DEVICE_NOT_FOUND_ERROR and STATUS_INSUFFICIENT_SPACE_ERROR) when reporting failed download attempts.
* | Revert "Download files even if there is no activity to launch them."Leon Scroggins2010-01-223-11/+68
| | | | | | | | | | | | | | This reverts commit 0f1aae327a9e4c68044d767e9bafbac747b6d985. I misunderstood the bug. We do not want to be able to download files for which there is currently no Activity to launch them.
* | Update the title of the download based on the filename.Leon Scroggins2010-01-211-6/+20
| | | | | | | | | | | | | | | | Now that the downloads page is not necessarily opened when a download starts, we need to provide a name even if the downloads page isn't shown. So when we create a notification, provide the title. Depends on a change to frameworks/base
* | Download files even if there is no activity to launch them.Leon Scroggins2010-01-213-68/+11
| | | | | | | | Fixes http://b/issue?id=2367247
* | Use the private legacy APIJean-Baptiste Queru2010-01-147-317/+333
| | | | | | | | | | | | | | | | | | | | The public API is getting deeply reworked for forward compatibility, but since the Download Manager and the Browser need to continue using the old API, a separate copy is being kept on the side. Bug: 2245521 Change-Id: I85eff6ba9efc68600aa80e8dffa6720b0f2ed155
* | Changed class paths for classes moved in unbundling effortPaul Westbrook2009-12-141-1/+2
| |
* | Fix Download application notification timestamp not correct issueLixin Yue2009-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Should set the value of Notification.when before calling setLatestEventInfo(). On downloading an image without exif information, the received file's timestamp is correct for main database field but incorrect for temporary display field. Root cause is that if Notification.when not set before calling setLatestEventInfo(), the timestamp value in milliseconds unit will be directly set to a field as second unit. Thus database will record the time as 1000 times forward as 2067, etc. However from UI the file's time will be just shown like "10/10/67", misleading people to think time is set backwards before system time 0(1969).
* | Disable unnecessary loggingJean-Baptiste Queru2009-09-241-3/+3
| | | | | | | | BUG=2134410
* | Re-use the same random value to compute a download's restart time.Jean-Baptiste Queru2009-09-241-1/+4
| | | | | | | | | | | | | | | | | | The restart time is used multiple times during the same pass, and it needs to be consistent across calls. Otherwise, it's possible for a download to not be restarted immediately and to not be scheduled for a future restart. BUG=2055624
* | Remove unnecessary loggingJean-Baptiste Queru2009-09-243-58/+3
| | | | | | | | | | | | | | Also tweak some slightly inaccurate logging, and add a note about a potential bug. BUG=2055624
* | Log the service being launchedJean-Baptiste Queru2009-09-221-0/+14
| | | | | | | | BUG=2055624
* | Add a bit more logging to track down network state issues.Jean-Baptiste Queru2009-09-223-11/+51
| | | | | | | | BUG=2055624
* | Add logging to track connectivity as seen from the Download Manager.Jean-Baptiste Queru2009-09-213-0/+41
| | | | | | | | | | | | | | This is enabled by a separate build-time constant, so that it can be turned on for everyone without having to use a system property. BUG=2055624
* | am d3403254: Enable full logging (for easier debugging)Jean-Baptiste Queru2009-07-141-1/+1
|\| | | | | | | | | | | | | Merge commit 'd3403254c3a290b6a68804c36c6876cb3787ec15' * commit 'd3403254c3a290b6a68804c36c6876cb3787ec15': Enable full logging (for easier debugging)
| * Enable full logging (for easier debugging)Jean-Baptiste Queru2009-07-141-1/+1
| | | | | | | | See http://b/1973844
* | Merge commit 'f0fa1cdc' into manualmergeJean-Baptiste Queru2009-07-062-2/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix crash in discardPurgeableFiles with proper selection syntax. The basic crash is that this codepath was doing a query to the download provider without properly quoting its selection arguments (which is mandated by the download provider). A secondary crash is that the DESTINATION column wasn't readable. This fixes bug 1941125. Tested by force-calling discardPurgeableFiles for each download to /cache, locally adding a few debugging statements to be sure that the codepath was getting executed, and doing a market download. Conflicts: src/com/android/providers/downloads/DownloadProvider.java src/com/android/providers/downloads/Helpers.java
| * Fix crash in discardPurgeableFiles with proper selection syntax.Jean-Baptiste Queru2009-07-022-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic crash is that this codepath was doing a query to the download provider without properly quoting its selection arguments (which is mandated by the download provider). A secondary crash is that the DESTINATION column wasn't readable. This fixes bug 1941125. Tested by force-calling discardPurgeableFiles for each download to /cache, locally adding a few debugging statements to be sure that the codepath was getting executed, and doing a market download.
| * Automated import from //branches/donutburger/...@140733,140733Feng Qian2009-03-241-1/+1
| |
* | Merge commit 'korg/cupcake'The Android Open Source Project2009-03-271-6/+23
|\ \ | | | | | | | | | | | | Conflicts: src/com/android/providers/downloads/DownloadThread.java
| * | auto import from //branches/cupcake_rel/...@141571The Android Open Source Project2009-03-191-1/+1
| |/
| * auto import from //branches/cupcake_rel/...@140373The Android Open Source Project2009-03-181-7/+24
| |
* | Merge commit 'remotes/korg/cupcake' into mergeJean-Baptiste Queru2009-03-171-2/+2
|\| | | | | | | | | | | | | Conflicts: docs/index.html src/com/android/providers/downloads/DownloadProvider.java src/com/android/providers/downloads/DownloadService.java
| * auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-039-0/+3969
| |
| * auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-039-3969/+0
| |
| * auto import from //branches/cupcake/...@132276The Android Open Source Project2009-02-192-5/+4
| |
| * auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-101-8/+14
| |
* | Make the DownloadProvider work in the simulatorJean-Baptiste Queru2009-02-271-1/+2
| |
* | Optimize call to queryIntentActivities()Jean-Baptiste Queru2009-02-271-4/+2
| | | | | | | | | | | | | | | | Replace a call to queryIntentActivities() with a calls to resolveActivity(). This is done since the only purpose of the call is to check if the returned list is empty or non-empty. It's inefficient to move an entire list across the process boundary, only to discard it.
* | Refine interaction between destination and default visibility.Jean-Baptiste Queru2009-02-061-8/+14
| | | | | | | | | | | | The previous code was hard to read, and relied on the fact that one of the constants was 0 (which is also the default value when reading back uninitialized columns).
* | Force sync the downloaded file to the storage after completion.Dennis Hsieh2009-01-211-0/+15
| | | | | | | | | | | | This will write the downlaoded file to the storage (sdcard in default). It can prevent file corruption if the user removes the sdcard unsafely after a download completes.
* | Use the new download manager APIs introduced in change 7400Jean-Baptiste Queru2009-01-217-153/+173
| |
* | Match the official code style guide.Jean-Baptiste Queru2009-01-209-327/+341
|/ | | | | | This fixes a number of style violations that weren't caught by automated tools and brings those files closer to compliance with the official style guide for this language.
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-178-462/+1074
|
* Initial ContributionThe Android Open Source Project2008-10-219-0/+3352