| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Note - only a small fraction of input cases are currently tested.
Change-Id: I830fff43cc283367a3534b7a3ffcc2a6d296e7c3
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
the filename does not have a file extension but there are one or more dots in the parent directory names.
e.g. /mnt/sdcard/Android/data/com.google.android.youtube/files/file
Change-Id: I5aad1625a9f36135e947c0f929ee740fc66eb0d3
|
|
|
|
| |
Change-Id: Ie8148af67507bdc1d12307ce0d957343d2a28af0
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
if a download fails for some reason, then filename could be null.
move Helpers.deleteFile() code into private method in DownloadService
Change-Id: Ifb12a84b6185e19c70d62392e102950c07f56a01
|
|
|
|
|
|
|
| |
bug:3132790
this mimics the behavior that exists today (in non-public API)
Change-Id: I722b3bc23fe8c9b0bf66a088c5f6a3130be2129f
|
|\
| |
| |
| | |
Change-Id: I404d1a66d337b1dade181ade92dc21fc0e819aa7
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\|
| |
| |
| |
| |
| |
| |
| |
| | |
into gingerbread
Merge commit 'd4dc8501ecb89b91f865510207297dd960afe031' into gingerbread-plus-aosp
* commit 'd4dc8501ecb89b91f865510207297dd960afe031':
Seriously improve error reporting in DownloadThread.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\|
| |
| |
| |
| |
| |
| |
| |
| | |
messages in UI" into gingerbread
Merge commit 'dc738781156d0f5ac1db62838d42c876d740810d' into gingerbread-plus-aosp
* commit 'dc738781156d0f5ac1db62838d42c876d740810d':
Improve file error reporting + new detailed error messages in UI
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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
|
|\|
| |
| |
| | |
Change-Id: I18ede2f2d5ad8aa40cd61bdb7213659d356fdf57
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\|
| |
| |
| |
| |
| |
| | |
Merge commit '71e7fda9135a0915af1fd419d07ebf85ad09beb4' into gingerbread-plus-aosp
* commit '71e7fda9135a0915af1fd419d07ebf85ad09beb4':
Further work on the new downloads UI.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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
|
|\ \
| |/
|/|
| |
| |
| |
| | |
Merge commit '89e4816fe5f06f4bc2c2fe0e38e63c7fbe468cd7' into gingerbread-plus-aosp
* commit '89e4816fe5f06f4bc2c2fe0e38e63c7fbe468cd7':
Added support for downloading files with unicode characters
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently only certain ASCII characters are allowed in a filename, all
other characters are replaced with an underscore. This gives bad
usability for foreign languages (e.g. japanese). This fix replaces the
current regexp with a method which replaces only those characters unsafe
to be used on VFAT filesystems (should work on most other
filesystems as well).
Change-Id: I114d47b4b35f28490e6b12493138355532fda499
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This set of changes cleans up the error codes returned by the download
manager in various failure cases, aiming for improved consistency.
Error codes are part of the public API so it's important to get this
right now.
The main changes here are:
* Refactoring the flow of error status information throughout
DownloadThread to make it more explicit, by having StopRequest
accept a status code in its constructor and eliminating
State.mFinaStatus.
* Eliminating the use of valid HTTP 4xx statuses when those statuses
weren't actually returned by the server. Now, if the returned error
code is a valid HTTP status code, that means it was returned by the
server. These cases have been replaced with more sensible
artificial error codes, including a new ERROR_CANNOT_RESUME when an
interrupted download can't be resumed.
* Improvements to some of the error handling code paths -- ensuring we
don't clear the cache for external downloads, ensuring we don't fail
with CANNOT_RESUME when the download hasn't actually started yet,
removing the restriction on acceptable mime types for public API
downloads.
Change-Id: I0d825845fe0fe7ed5df74bad26e8d34ac0d1cc4e
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
| |
Change-Id: Ife165361ebd75d558b311710e62abdfbdc355f1b
|
|
|
|
|
| |
Takes advantage of two new download status codes (STATUS_DEVICE_NOT_FOUND_ERROR
and STATUS_INSUFFICIENT_SPACE_ERROR) when reporting failed download attempts.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes http://b/issue?id=2367247
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
|/
|
|
|
|
| |
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.
|
| |
|
|
|