| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| | |
into gingerbread
Merge commit '1d332ceb5756ef2e09ae97f1735aa9b529063874'
* commit '1d332ceb5756ef2e09ae97f1735aa9b529063874':
Make all public API downloads visible.
|
| |\
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'da5a4183312f520cf35b154d33cb7205e6ba5557' into gingerbread-plus-aosp
* commit 'da5a4183312f520cf35b154d33cb7205e6ba5557':
Make all public API downloads visible.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This change makes all downloads through the public API visible by
default. It removes the API that had allowed applications to control
notifications while the download runs. This has been replaced with a
hidden API, since such behavior is needed by SystemUpdater and Market
(for self-updates). Additionally, the behavior is now protected by a
new permission.
I'm making this permission signatureOrSystem, and changing the
non-purgeable permission to the same (it should've been that, I just
didn't know). I'm also adding string descriptions to appease the
translation folks.
Change-Id: I192e8b19ff9b0e425257cef0db081c3d75996ea5
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '3253c05afccc0cb62c29958d023d863222a5845c'
* commit '3253c05afccc0cb62c29958d023d863222a5845c':
Get wifi limit from secure settings.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '0d4f9f105c3a31475a36e9a1edfa868c66ff455f' into gingerbread-plus-aosp
* commit '0d4f9f105c3a31475a36e9a1edfa868c66ff455f':
Get wifi limit from secure settings.
|
| | |
| | |
| | |
| | | |
Change-Id: I750654c28cb3d9f9aa67bd56e4d8d770dbfde4b4
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '92ae639f324084a23a54812ab92304b009a93340'
* commit '92ae639f324084a23a54812ab92304b009a93340':
Add test for many interruptions to a single download.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'dea0a5f8e5804d3aba40eaa7de763dd88058384e' into gingerbread-plus-aosp
* commit 'dea0a5f8e5804d3aba40eaa7de763dd88058384e':
Add test for many interruptions to a single download.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Adding a new test case for downloads that undergo many interruptions
(as may happen with a very large download that takes many hours).
Includes some refactoring in the test suite.
Early on, this test exposed a race condition in which the download
manager got some I/O exception while reading from the MockWebServer.
I went in and improved/refactored much of the error logging code in
DownloadThread to try and track this down. Unfortunately, once I
finished, the race condition no longer seems to be reproducible, even
with hundreds of runs of the test case. So I've given up on it for
now. In any event, error logging is better and much duplicate code
has been eliminated.
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '915912de0373b78de4cd7cc1f45dad760ef94243'
* commit '915912de0373b78de4cd7cc1f45dad760ef94243':
Improved support for 302/307 redirects.
|
| |\|
| | |
| | |
| | | |
Change-Id: I0adb03f16a6f0cc648886e02c79ffde63e18f99f
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Change the download manager's handling of 302/307 temporary redirects
so that after an interruption of any kind, the delayed retry/resume
will return to the original URI. This complies better with the HTTP
spec. This change also makes the download manager handle other
redirects immediately rather than using the delay that's otherwise
applied to download errors.
I made one more method extraction in DownloadThread to simplify this
change, pulling the top-level logic for a single request into
executeDownload(). It was then just a matter of introducing a new
RetryDownload exeception, similar to StopRequest, and making the
redirection code use it.
Change-Id: Ic719c5725a9fd2e5eebe4dc03453ee71d9f27cd4
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
downloads.
Merge commit '7a8bf08fe936a1fdb0408dea1ec2f39b83acc5d7'
* commit '7a8bf08fe936a1fdb0408dea1ec2f39b83acc5d7':
Fix bug with closing output stream for external downloads.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'f6b4c24b4a876daa3f4e91d6da418983222b9dfd' into gingerbread-plus-aosp
* commit 'f6b4c24b4a876daa3f4e91d6da418983222b9dfd':
Fix bug with closing output stream for external downloads.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I added a unit test to cover this, and it caught another issue with
disallowing external destinations outside of the default downloads
directory (which are now allowed with the new API).
Change-Id: I4df6442bebb06458ad28c85f6bc8cbcbf3ce67a1
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'b6ba05828ace9546e5e27d3745e7cbcba323b66d'
* commit 'b6ba05828ace9546e5e27d3745e7cbcba323b66d':
Serialize threading for download manager testing.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'e6a05a1aa4697440e9630d12b741b3bae321fe49' into gingerbread-plus-aosp
* commit 'e6a05a1aa4697440e9630d12b741b3bae321fe49':
Serialize threading for download manager testing.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The download manager uses threading in a simple way -- it launches two
threads, UpdateThread and DownloadThread, and both are "fire and
forget". This is fortunate for testing, since it means we can
eliminate multithreading and simply run each thread in order, and
everything still works.
This change does just that, abstracting Thread.start() behind
SystemFacade and making FakeSystemFacade put new threads into a queue
and then run through them serially. This simplifies much of the test
code and makes it all much more predictable.
I've simplified the test code as much as possible here and moved a few
more tests over to PublicApiFunctionalTest, leaving only a minimum in
DownloadManagerFunctionalTest, which will eventually be deleted
altogether. I've also improved testing in some areas -- for example,
we can now test that running notifications get cancelled after the
download completes in a robust way.
There is one test case that checks for race conditions and requires
multithreading. I've moved this into a new ThreadingTest class, which
uses a custom FakeSystemFacade that allows multithreading. I've
extracted AbstractPublicApiTest for the newly shared code.
Change-Id: Ic1d5c76bfa9913fe053174c3d8b516790ca8b25f
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'f5373e6ba917cc60db4ee796aed8bc0e37a3f5e9'
* commit 'f5373e6ba917cc60db4ee796aed8bc0e37a3f5e9':
Stub out and test system notifications.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '93155e1da7e89d4925e244f5afa94afb8ada7381' into gingerbread-plus-aosp
* commit '93155e1da7e89d4925e244f5afa94afb8ada7381':
Stub out and test system notifications.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This change abstracts NotificationManager interactions behind
SystemFacade and takes advantage of that to test notifications, to a
limited degree.
It also fixes a silly typo in AbstractDownloadManagerFunctionalTest,
and it introduces an extra sleep between tests to avoid some
flakiness. I'll look for a better solution to that problem after this
change goes in.
Change-Id: I3a0307f828955cd45b0e3581ad499da28cc0556e
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
public API.
Merge commit '0a450da1d9e95f27f479aa45b442960baac49bb1'
* commit '0a450da1d9e95f27f479aa45b442960baac49bb1':
Support for non-purgeable downloads through the public API.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '71aab521efba9b28779541440c797220ec98ac97' into gingerbread-plus-aosp
* commit '71aab521efba9b28779541440c797220ec98ac97':
Support for non-purgeable downloads through the public API.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This change adds a permission,
android.permission.DOWNLOAD_CACHE_NON_PURGEABLE. When an app has this
permission, any downloads it requests through the public API to the
download cache will automatically become non-purgeable, i.e. they'll
never be automatically deleted by the download manager to free up
space. This is intended for use only by the system updater.
Change-Id: I35cdd44f7e5d46bc70443d1a9743f61a51395ddb
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '8667ebd109ea212a7645ad6c214d4d765bb70b75'
* commit '8667ebd109ea212a7645ad6c214d4d765bb70b75':
Make DownloadProvider accessible for public API usage.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'b06b739b078ce4b00600487cfec31659647bf31f' into gingerbread-plus-aosp
* commit 'b06b739b078ce4b00600487cfec31659647bf31f':
Make DownloadProvider accessible for public API usage.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This change removes the requirement that apps have the
ACCESS_DOWNLOAD_MANAGER permission in order to access
DownloadProvider. This enables the public API to work. Instead,
DownloadProvider enforces the new permissions model for the public
API:
* insert() requires INTERNET permission
* insert() checks that input fits within the restricted input allowed
for the public API
* insert() also strictly checks the file URI provided with
DESTINATION_FILE_URI (and still requires WRITE_EXTERNAL_STORAGE
permission if that is supplied)
Note that if an app has the ACCESS_DOWNLOAD_MANAGER permission, legacy
behavior is retained.
I've added a test to cover this new access, and updated the existing
permissions tests.
I also fixed a bug in WHERE clause construction in update() and
delete(), and refactored the code to eliminate duplication.
Change-Id: I53a08df137b35c2788c36350276c9dff24858af1
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'c2448d488ff4e476762d0a07bb0757ca99c05445'
* commit 'c2448d488ff4e476762d0a07bb0757ca99c05445':
Make COLUMN_URI readable and tighten UID restrictions.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '0d8d89105c00edbad95a268aaae65f2ff94ed5a1' into gingerbread-plus-aosp
* commit '0d8d89105c00edbad95a268aaae65f2ff94ed5a1':
Make COLUMN_URI readable and tighten UID restrictions.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I need to make COLUMN_URI readable by apps, since the public API
exposes that field. In order to avoid any possible security issues, I
got rid of the feature that potentially allowed apps to view downloads
from other UIDs. No one was using that feature and the public API
exposes no such feature (yet).
While at it, I cleaned up some related code in update() and delete().
Change-Id: I5384115d2a865255d009fbe37449488fd2269389
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
control.
Merge commit '0bd0e0c9e4eec9d63b4e0f213e80fc9eee85fdf6'
* commit '0bd0e0c9e4eec9d63b4e0f213e80fc9eee85fdf6':
Public API support for broadcasts and connectivity control.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '0a77c62a82503b38c484e0079648f0231dd85d53' into gingerbread-plus-aosp
* commit '0a77c62a82503b38c484e0079648f0231dd85d53':
Public API support for broadcasts and connectivity control.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Three new DB fields, one indicating whether a download was initiated by the public API or not, two to hold connectivity control info. DB migration to add these fields and code in DownloadProvider.insert() to handle them.
* Change broadcast intent code to match public API spec, for public API downloads only. (Legacy code can go away once existing clients are converted over to the new API.)
* Introduce SystemFacade methods for sending broadcasts and checking package ownership; this facilitates new tests of broadcast code.
* Change DownloadInfo.canUseNetwork() to obey new connectivity controls available in public API, but again, retain legacy behavior for downloads initiated directly through DownloadProvider
* New test cases to cover the new behavior
Also made a couple changes to reduce some test flakiness I was observing:
* in tearDown(), wait for any running UpdateThread to complete
* in PublicApiFunctionalTest.setUp(), if the test directory already exists, remove it rather than aborting
DB changes for broadcast + roaming support
Change-Id: I60f39fc133f678f3510880ea6eb9f639358914b4
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '918f819abfb1da3661c1c604440666655e0c8909'
* commit '918f819abfb1da3661c1c604440666655e0c8909':
Major refactoring of DownloadThread.run().
|
| |\|
| | |
| | |
| | | |
Change-Id: Icddfa080f43f882cce60af8a729436dcc2406384
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Motivation: I need to fix the handling of 302s, so that after a
disconnect, subsequent retries will use the original URI, not the
redirected one. Rather than store extra information in the DB, I'd
like to just keep the redirected URI in memory and make the redirected
request within the same DownloadThread. This involves working with
the large-scale structure of DownloadThread.run(). Since run() was a
~700 line method, I didn't feel comfortable making such changes.
So this change refactors run() into a ~80 line method which calls into
a collection of ~20 other short methods. The state previously kept in
local variables has been pulled into a couple of state-only inner
classes. The error-handling control flow, formerly handled by "break
http_request_loop" statements, is now handled by throwing a
"StopRequest" exception. The remaining structure of run() has been
simplified -- the outermost for loop, for example, could never
actually repeat and has been removed for now. Some other bits of code
have been cleaned up a bit, but the functionality has not been
modified.
There are many good next steps to this refactoring. Besides various
other cleanup bits, a major improvement would be to consolidate the
State/InnerState classes, move some functionality to this new class
(there are many functions of the form "void foo(State)" which would be
good candidates), and promote it to a top-level class. But I want to
take things one step at a time, and I think what I've got here is a
major improvement and should be enough to allow me to safely implement
the changes to redirection handling.
In the process of doing this refactoring I added many test cases to
PublicApiFunctionalTest to exercise some of the pieces of code I was
moving around. I also moved some test cases from
DownloadManagerFunctionalTest. Over time I'd like to move everything
over to use the PublicApiFunctionalTest approach, and then I may break
that into some smaller suites.
Other minor changes:
* use longs instead of ints to track file sizes, as these may be
getting quite large in the future
* provide a default DB value of -1 for COLUMN_TOTAL_BYTES, as this
simplifies some logic in DownloadThread
* small extensions to MockResponse to faciliate new test cases
Change-Id: If7862349296ad79ff6cdc97e554ad14c01ce1f49
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit 'b607c31e50fdd08258a489b881b2ad5ff5f75d0d'
* commit 'b607c31e50fdd08258a489b881b2ad5ff5f75d0d':
Fix bug with deciding when to restart a download.
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '5180de23e77139dd6971dfd48269242e3e3562d9' into gingerbread-plus-aosp
* commit '5180de23e77139dd6971dfd48269242e3e3562d9':
Fix bug with deciding when to restart a download.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In previous refactoring I had combined the code for starting a
download (from DownloadService.insertDownload()) and restarting a
download (from DownloadService.updateDownload()). I'd missed the fact
that the former checks DownloadInfo.isReadyToStart() while the latter
checks DownloadInfo.isReadyToRestart(). This cause a race condition
where multiple startService() calls during a download would cause the
service to try to spawn a second thread for the same running download.
I've fixed the bug and added a test case to exercise this.
Change-Id: Ia968331a030137daac7c8b5792a01e3e19065b38
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '7d4a4bc1f4bf92906598ede0160ff234d1179dd4'
* commit '7d4a4bc1f4bf92906598ede0160ff234d1179dd4':
Support for max download size that may go over mobile
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | | |
Merge commit '071bd7acb3185f4f1e807855605c5e6018e9742f' into gingerbread-plus-aosp
* commit '071bd7acb3185f4f1e807855605c5e6018e9742f':
Support for max download size that may go over mobile
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
TelephonyManager" into gingerbread
Merge commit 'c45c8eb1f9e8d93a02a7af2621a8fbcea1b2f6a7'
* commit 'c45c8eb1f9e8d93a02a7af2621a8fbcea1b2f6a7':
Introduce a seam to ConnectivityManager and TelephonyManager
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
TelephonyManager" into gingerbread
Merge commit '1aa26989047495ff58d3e2598d3f9549465cbb65' into gingerbread-plus-aosp
* commit '1aa26989047495ff58d3e2598d3f9549465cbb65':
Introduce a seam to ConnectivityManager and TelephonyManager
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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 commit '8e64adfed603d808a712f0caad97425a5ef038f4'
* commit '8e64adfed603d808a712f0caad97425a5ef038f4':
Use proxy for downloads.
|
| |\ \
| | |/
| |/|
| | | |
Change-Id: I706a8164dbb3f499736e6dcef0e8b65f3c309c44
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Uses the new Proxy method getPreferredHttpHost to easily get correct
proxy.
Change-Id: If859ad03c2ed5a896c62592aa131d0e79d1b9c02
|
| | |
| | |
| | |
| | | |
Change-Id: I099c98e310039886990502d63566f3e217738b45
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
requests" into gingerbread
Merge commit 'd1bec343dcbbc555837790119449ff7eea7c5312'
* commit 'd1bec343dcbbc555837790119449ff7eea7c5312':
Support for custom HTTP headers on download requests
|