| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Bug:29505888
Change-Id: Ifc33fd75e44d1dbc5a4ce5caa8e1ff938b94623e
|
|
|
|
|
|
|
|
|
|
|
| |
Downloads with visible notifications should behave as if the
requesting app was running a foreground service. The easiest way
to implement this for now is to ignore any BLOCKED network status
and use the new setWillBeForeground() API so job scheduling ignores
any active blocked/dozing status.
Bug: 26571724
Change-Id: I8ea2b2a7cdb5f469adc11b4d897ff55bd8a9db9a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
JobScheduler is in a much better position to coordinate tasks across
the platform to optimize battery and RAM usage. This change removes
a bunch of manual scheduling logic by representing each download as
a separate job with relevant scheduling constraints. Requested
network types, retry backoff timing, and newly added charging and
idle constraints are plumbed through as job parameters.
When a job times out, we halt the download and schedule it to resume
later. The majority of downloads should have ETag values to enable
resuming like this.
Remove local wakelocks, since the platform now acquires and blames
our jobs on the requesting app.
When an active download is pushing updates to the database, check for
both paused and cancelled state to quickly halt an ongoing download.
Shift DownloadNotifier to update directly based on a Cursor, since we
no longer have the overhead of fully-parsed DownloadInfo objects.
Unify a handful of worker threads into a single shared thread.
Remove legacy "large download" activity that was thrown in the face
of the user; the UX best-practice is to go through notification, and
update that dialog to let the user override and continue if under
the hard limit.
Bug: 28098882, 26571724
Change-Id: I33ebe59b3c2ea9c89ec526f70b1950c734abc4a7
|
|
|
|
|
|
|
|
| |
Use parseInt when the result is assigned to an int. Allocates fewer
objects.
bug: 28078871
Change-Id: I2c58112795fecce6395c558f2bb1e1fefe83a5bf
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Downloads should use the default network for the caller. This prevents
applications from, for example, bypassing VPN by routing all requests
through the DownloadProvider.
Bug: 27074270
Change-Id: I7830226dd2910757d3a5c78f373330f84637ccfa
|
|/
|
|
| |
Change-Id: I9b2711c2a9b3edd4bbef97ff6cdcae9fdc9ef433
|
|
|
|
|
| |
Bug: 22958127
Change-Id: I314a9bdd21988bf7e6cc79a2ae842bed29c96f17
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a "Cancel" action to in-progress downloads shown in notification
pane.
We add a new action type for a new "cancel" intent sent by
DownloadNotifier to DownloadReceiver, which in turn cancels the
download by way of DownloadManager.
BUG=19972464
Change-Id: I83cd2f40e1442c327f756027b99f9eac913a0e70
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the Provider-side of the DownloadManager framework honor
the per-UID cleartext network traffic policy. The policy is enforced
in the Provider rather than in its client (DownloadManager) because
download URLs could get redirected between HTTPS and HTTP and only
the Provider currently has visibility into and control over this.
Whether cleartext network traffic is permitted is a per-package
policy. However, the DownloadProvider can only access the UID of the
requesting application. Multiple packages can run under the same UID.
In that scenario, cleartext traffic is permited for the UID if
cleartext traffic is permitted for any of the packages running under
the UID. This could be improved by making the DownloadManager provide
the package name in addition to the UID.
Bug: 19215516
Change-Id: Ib37585a7a2fc2869954d52a1b08052926f49bc9b
|
|
|
|
|
|
|
| |
Bug: 18083851
(cherry pick from commit f1cd37d8bade42be0632f54dcd61f81711269606)
Change-Id: I93f14e171abc7a52fe2117c8503374734147513b
|
|
|
|
|
|
| |
(As much as possible. There are no plans to make the mocking API public.)
Change-Id: I348877b850d6d34572d5a19e67952254bc4f12ef
|
|
|
|
|
|
|
| |
StructStatVfs and ErrnoException were moved from libcore.io to
android.system
Change-Id: I42c789a941f964ae7dde224b16af39a95212fbc7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change all data transfer to occur through FileDescriptors instead of
relying on local files. This paves the way for downloading directly
to content:// Uris in the future.
Rewrite storage management logic to preflight download when size is
known. If enough space is found, immediately reserve the space with
fallocate(), advising the kernel block allocator to try giving us a
contiguous block regions to reduce fragmentation. When preflighting
on internal storage or emulated external storage, ask PackageManager
to clear private app caches to free up space.
Since we fallocate() the entire file, use the database as the source
of truth for resume locations, which requires that we fsync() before
each database update.
Store in-progress downloads in separate directories to keep the OS
from deleting out from under us. Clean up filename generation logic
to break ties in this new dual-directory case.
Clearer enforcement of successful download preconditions around
content lengths and ETags. Move all database field mutations to
clearer DownloadInfoDelta object, and write back through single
code path.
Catch and log uncaught exceptions from DownloadThread. Tests to
verify new storage behaviors. Fixed existing test to reflect correct
RFC behavior.
Bug: 5287571, 3213677, 12663412
Change-Id: I6bb905eca7c7d1a6bc88df3db28b65d70f660221
|
|
|
|
| |
Change-Id: Icaba016bc6e098745e56a3b6367a8a6af0151158
|
|
|
|
| |
Change-Id: Ida4a0a85883ccd6763b07e958ddc6ecf7eedf790
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When multiple downloads are running in parallel, they can end up
claiming the same filename and clobber over each other. This change
introduces locking around filename generation, and touches the
claimed filename so other threads fail the File.exists() check and
keep looking.
Tests to verify.
Bug: 8255596
Change-Id: Ie75ed047c199cf679832c75159056ca036eac18d
|
|
|
|
|
|
|
|
| |
Streams a 3GB file to verify that it downloads correctly, using new
MockWebServer streaming API.
Bug: 8209169
Change-Id: Ic36271bfef3176e1ccea2b40edc7abb1044222f1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the service lifecycle was managed through a large for()
loop which was extremely tricky to reason about. This resulted in
several race conditions that could leave the service running
indefinitely, or terminate it early before tasks had finished.
This change redesigns the update loop to be event driven based on
database updates, and to collapse mutiple pending update passes. It
is much easier to reason about service termination conditions, and
it correctly uses startId to handle races during command delivery.
Also moves scanner into isolated class, and switches to using public
API instead of binding to private interface.
Bug: 7638470, 7455406, 7162341
Change-Id: I380e77f5432223b2acb4e819e37f29f98ee4782b
|
|
|
|
| |
Change-Id: Ice24d5c62bbcbcfd3d7374eac3a20580f7f31f36
|
|
|
|
|
|
|
|
|
|
| |
Verify that servers responding with many retries or redirects result
in failed download, instead of spinning out of control. Test to
verify that changed ETag results in download failing.
Also fix handling of HTTP 301 to update Uri in database.
Change-Id: Iff2948d79961a245b7900117d107edaa356618c9
|
|
|
|
|
|
|
|
| |
Now the final errors are always thrown, and the outer code decides
how to handle them as retries. Also clean up method signatures.
Bug: 8022478
Change-Id: I4e7e43be793294ab837370df521e7c381e0bb6c3
|
|
|
|
|
|
|
|
|
|
| |
Move redirection handling into a single loop, and handle each HTTP
response code inline to make flow control easier to reason about.
Fix race condition in tests by waiting for first status update.
Bug: 7887226
Change-Id: Id4bfd182941baad4cd0bb702376c4beeb7275bb2
|
|
|
|
|
|
|
|
|
|
|
| |
Change runUntilStatus() methods to polling with timeout instead of
requiring internal knowledge about threading.
Fix notification tests, and move opening of InputStream until after
handling headers to avoid FNFE. Always reset facade to defaults
before each test.
Change-Id: I6b2d6cfc4e685d2090c1133b1b2e89ae12760f8b
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix bug where resumed downloads wouldn't open in append mode. Handle
end of stream exceptions from URLConnection as special-case for now
to keep tests passing.
Move stream creation outside of DrmOutputStream, and always fsync()
before closing files. Treat HTTP header errors as retryable. Add
explicit state checks to redirection tests.
Change-Id: I19d007284f6bfbffaac93859fe47cd98b79a59c4
|
|
|
|
|
|
|
|
|
|
| |
Calculate speed of in-progress downloads and estimate time remaining
until completion. Uses a moving average that is weighted 1:1 with
the most recent 500ms sample. Funnels timing data to notifications
through DownloadHandler.
Bug: 6777872
Change-Id: I9155f2979aa330bd1172f63bbfca1d053815cee5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switch to using new inbox-style notifications when collapsing multiple
downloads. Correctly handles clustering, including cancellation of
stale notifications. All notifications are now handled in a single
class, making it easier to reason about correctness.
Fixed bugs around handling of visibility flags. Move away from using
"int" as internal keys, since they can overflow. Started work for
time estimates, will finish in a future CL.
Explicitly pass all relevant IDs to DownloadReceiver instead of doing
a second racy query. Fix StrictMode warnings when querying in
DownloadReceiver.
Bug: 6777872, 5463678, 6663547, 6967346, 6634261, 5608365
Change-Id: I5eb47b73b90b6250acec2ce5bf8d7a274ed9d3a9
|
|
|
|
|
|
| |
Directly mock NotificationManager instead of using SystemFacade.
Change-Id: If932d26e23816e8674469c275a828701cce5fc2d
|
|
|
|
|
|
|
|
|
|
|
|
| |
Include flag with each download to indicate if its allowed to proceed
over metered networks. Downloads are left in WAITING_FOR_NETWORK
state, similar to how ALLOWED_NETWORK_TYPES is handled.
Also keep blocked downloads in WAITING_FOR_NETWORK state instead
of marking them as failed.
Bug: 3001465, 5734560
Change-Id: I80bb9aa9bd25ddf6f7a2472db344b6ba6878bd74
|
|
|
|
|
| |
Bug: 4726601
Change-Id: Ibe537bd5c2a092dbf974360cd454751881f7f4ea
|
|
|
|
| |
Change-Id: Idfd4da891a6709504ea4f0cc72701400f63e0c2d
|
|
|
|
|
|
|
|
|
|
|
| |
Now network access is determined by using getActiveNetworkInfoForUid()
which uses BLOCKED to indicate that network should be rejected for
the requesting UID. While download in progress, watch for any policy
changes that should trigger pause.
Also check NetworkInfo.isConnected() for correctness.
Change-Id: I1efa79823f15ecc3fa088a6719da1b770c64b255
|
|
|
|
| |
Change-Id: Ibbce0782fcf7649209d6f56be240209cebd9045b
|
|
|
|
|
|
|
| |
store its files" into honeycomb"
This reverts commit 7d96bafa59111d9ca735e5ef86dc0598f946b2be, reversing
changes made to 2ce876d2d7000b0c3a1430c5f4932568090f5170.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
data/data/com.android.providers.downlaods/cache is being used
to store the downloaded files, when the user doesn't specify the
destination path.
but system seems to remove files from this dir EVEN when space is
running low. bug:3324673
instead, let DownloadManager use
data/data/com.android.providers.downlaods/files dir
Downlaodmanager manages its space anyway.
Change-Id: I2eb15570395a214477891f50f635fada0b466544
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I61c6020017a300076ab2a5901ab87eabb1e0d0b7
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
one big change in this CL is addition of a new feature to MockWebServer.
It can now play a long response to the Downloading thread to keep it busy
while something - such as cancel/remove - can be done to that Download Request.
Also, added changes to FakeSystemFacade to start threads in normal fashion
instead of queuing them up and later running just their run() methods.
the following tests should work now
packages/providers/DownloadProvider/tests/src/com/android/providers/downloads/
DownloadManagerFunctionalTest.java
PublicApiFunctionalTest.java
ThreadingTest.java
PublicApiAccessTest.java
DownloadProviderPermissionsTest.java
the following are flaky. they need to be split up into smaller tests.
frameworks/base/core/tests/coretests/src/android/app/
DownloadManagerIntegrationTest.java
DownloadManagerStressTest.java
Change-Id: Ia0b11963f92e8f8365f701761dcbce467be3ee9b
|
|
|
|
| |
Change-Id: I2edf1bef5e741de8193cb293807e3ace42003b0c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
I'll merge this manually, as there's some additional master-only code
that will be to be simultaneously changed.
Change-Id: Ifdb1740f32e228bc07f266585737b98a7b794685
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
| |
Minor change to make title/description default to blank stings, and
add test case covering all null/empty download fields.
Change-Id: Id44344bc2e464f46589faed49c8f383a45a8d329
|