| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This feature contains below points:
1. add to pause running download by manual.
2. add to resume manually paused download by manual.
3. add to show proper contents in notification and download-list
for manually paused status.
4. add to support download breakpoint continuing when HTTP server
doesn't contain etag in response header. Android baseline only
supports this when etag is not null.
5. add to show proper contents in notification and download-list
for status of waiting-for-network.
Change-Id: I433cdee2de8b3add0248bbb0a9d02f8da4e5bb38
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Launch chrome and open www.baidu.com -> Choose "software"
in the site navigation -> Tap "games" option, choose one apk
to download -> During downloading, power off the phone -> Power
on the phone and check, it can't continue to download apk.
The fix is to add one condition for retrying to download when
IO exception happens (i.e. Failed to open for writing:
java.io.FileNotFoundException).
Bug 18834618
Review: https://partner-android-review.git.corp.google.com/#/c/193436
Signed-off-by: Benson Huang <benson.huang@mediatek.com>
Change-Id: I2f975ff7ffedfc4136fb250dcb5ef8fdca4a367d
|
|
|
|
|
|
|
|
| |
Now that we're defeating connection reuse, we have one additional
type of response where the length is known.
Bug: 18306491
Change-Id: I19657c565238f07fd89a55a5dbf1e85748f6e7c3
|
|
|
|
|
|
|
|
|
| |
Otherwise servers may continue streaming large downloads into the
kept-alive socket. This changes to always close the socket, sending
a clear signal to server.
Bug: 16153076
Change-Id: I3e7fefce4f82b5f80abaab58874cc4c4374d2bfb
|
|
|
|
|
|
|
|
|
|
| |
In some cases the provider may have marked a download as deleted,
but the content change notification may lag several seconds. To stop
as soon as possible, assert that we're not deleted when writing
our progress updates.
Bug: 16405936
Change-Id: I994b746056d0427c626355e0815234ff5b73198c
|
|
|
|
|
|
|
| |
Fall back just like ENOTSUP.
Bug: 17285472
Change-Id: Ice4954726c14a0e84c39c5469d573644588934ae
|
|
|
|
| |
Change-Id: Ie72e18f539cbad593c489bf52b9afea5330f62c1
|
|
|
|
|
|
| |
(As much as possible. There are no plans to make the mocking API public.)
Change-Id: I348877b850d6d34572d5a19e67952254bc4f12ef
|
|
|
|
|
|
|
|
|
|
|
|
| |
Periodically reconcile database against disk contents. This handles
the case where a user/app deletes files directly from disk without
updating the database, and the rare case where a database delete
didn't make it to deleting the underlying file.
Also cleans up any downloads belonging to a UID when removed.
Bug: 12924143
Change-Id: I4899d09df7ef71f2625491ac01ceeafa8a2013ce
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
This reverts commit 4f9d2d04003fafb358d7c127054055b3a9732c9b, was only
wanted for debugging.
|
|
|
|
|
|
|
|
| |
Try to catch the download provider in the act of deleting pending
system updates.
Bug: 12680933
Change-Id: If58aba5c30fd624217e5d073730645af05e98ac7
|
|
|
|
|
|
|
| |
Otherwise the download thread would keep going!
Bug: 11081405
Change-Id: Ib8f1b624b29cabc782b8a0047d7b5db7e39a17de
|
|
|
|
|
|
|
| |
This matches how network usage is already counted against the app
making the request.
Change-Id: I6a862e096f2f99441925a101268235615000355a
|
|
|
|
|
| |
Bug: 8850035
Change-Id: If506ea21f0c823f9da4b7ae14d611fdbfbac8042
|
|
|
|
|
|
|
| |
Also reduce and adjust some logging.
Bug: 8470658
Change-Id: Ia1f1cbd315ded04edd2113506e5c5a1db5ec85b4
|
|
|
|
|
|
|
|
| |
Transparent gzip encoding doesn't allow us to easily resume partial
requests, so defeat it for now.
Bug: 8409417
Change-Id: I1172709c09d1153fff1ba8df072a9bef896e244d
|
|
|
|
|
|
|
|
|
| |
Otherwise we end up triggering MSG_FINAL_UPDATE while still waiting
for socket timeouts. Using 20 seconds for timeout is more sane, and
matches Volley.
Bug: 8233041
Change-Id: Ia7220033a5942c46ca1d79a88e2b3f530cb3edac
|
|
|
|
|
|
|
|
|
|
|
| |
Wait until we've passed a full sample window (500ms) before reporting
an estimated speed. This avoid showing skewed times like "900 hours
remaining."
Also remember to clean up the UpdateThread.
Bug: 8176417
Change-Id: I851e0abcbb443114abe9c22f4650fee7a9bc3aaa
|
|
|
|
|
|
|
| |
When a download fails due to a network change, treat it as waiting
for network, instead of subjecting it to full retry backoff.
Change-Id: Ifdae62fd7c2baad7422f68e09da94740b5f513d0
|
|
|
|
|
|
|
|
| |
This was moved to to solve a race condition around service shutdown,
but ended up causing another race with remote apps.
Bug: 8200919
Change-Id: Ief470e9454e9be8ec43ca3ec11e3b3440fa5852d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switch to using a ThreadPoolExecutor for handling downloads, which
gives us parallelism logic that is easier to reason about. Also
open the door to eventually waiting until the executor is drained
to stopSelf().
Removes DownloadHandler singleton, and gives explicit path for
publishing active download speeds to notifications.
Change-Id: I1836e7742bb8a84861d1ca6bd1e59b2040bd12f8
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Ib8ea24fc58a866f8a5626cdd20e5891eb0a2bbeb
|
|
|
|
|
|
|
| |
Also include more details when reporting HTTP error codes.
Bug: 7966393
Change-Id: I251b1ec7c827693817391b6e9fb8b0cab995395e
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
It was cluttering up method signatures, and can easily be reset
before starting each download pass.
Change-Id: I7dee9d2160c3b5f737e7db86baa826d5d0b04b2d
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
This cleans up writing of downloaded data by always writing through
OutputStream interface, which applies DRM if needed. Hands I/O
streams along with method calls to give clearer chain of ownership.
Only retry writes once after verifying free space. Remove
checkCanHandleDownload() check, since most downloads are now using
public API. Release DrmManagerClient sessions when finished.
Change-Id: I49e479089a8218690b556d31ec65a030930ad368
|
|
|
|
|
|
|
|
|
|
| |
Apache HttpClient is in maintenance mode, and doesn't have support
for features like Server Name Indication (SNI). This change moves
DownloadManager to use HttpURLConnection internally. It also
moves redirection handling into HttpURLConnection.
Bug: 7070597
Change-Id: Ie80093eeeecd14f94e1c8b7597ff3f8f5d220691
|
|
|
|
|
|
|
|
|
|
|
| |
Calculate remaining time in DownloadNotifier so we always use the
most recent progress data, which avoids showing stale times.
Weight speed calculation to prefer historical data so remaining time
is smoother on bumpy network connections.
Bug: 7631948
Change-Id: I497be0899e65086356745340b19d3987c6185bdd
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Downloads in the RUNNING state are considered ready to start so that
downloads are correctly resumed when the process crashes. However,
this causes a race condition while UpdateThread is processing a
Cursor when a DownloadThread finishes.
With this change, DownloadThread now skips requests for downloads
already marked as finished. Apps listening for the DOWNLOAD_COMPLETE
broadcast will no longer see data mutated by the second thread, and
will not see the broadcast duplicated.
Bug: 6948938, 6970458, 6818900
Change-Id: I35deac3cedbfe7f50091fab5818d85594dba558c
|
|
|
|
|
| |
Bug: 6544953
Change-Id: I4157c67b9b9cddab4ade795c328a202f6a230f95
|
|
|
|
|
| |
Bug: 6362988
Change-Id: Iab4b86cfcaa6aeed6466f88ff49eb935f96db495
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Include platform version, model, and build, when available. Matches
current logic used by Browser.
Bug: 6257336
Change-Id: I0addfd944aff13bd4ce4226bb8d6328da6b0f5d5
|
|
|
|
| |
Change-Id: I21e5f6280748529bad881942f8f5534aa374ba55
|
|
|
|
|
| |
Bug: 4726601
Change-Id: Ibe537bd5c2a092dbf974360cd454751881f7f4ea
|
|
|
|
| |
Change-Id: I78b6b0380a42b28f42334f93e0538ba7f32bc66d
|
|
|
|
| |
Change-Id: Ideeb8cbeaa4b4d82d7c9fc8197a35bf3541a22d7
|
|
|
|
|
|
|
|
| |
Database values can be stale, so delay sanity check until after
updating from file size on disk.
Bug: 5484249
Change-Id: Ia648a575d4a3a391a1f06a866c8282f2d569f15e
|
|
|
|
|
| |
Bug: 5461417
Change-Id: I16f1e8594162b006b80bf7f2cdc6630d0dedfa38
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DownloadThread was only maintaining ETag and the file size for the
duration of one HTTP request, rather than over all the requests needed
to fetch a file, which kind of defeats the point of having them. Fix
this by moving several state variables from InnerState to State, and
initializing the total bytes and current bytes values from the
download database.
Skip actually making the HTTP request if we've already downloaded all
the bytes of the file. This works around bug 5217390 by making the
second DownloadThread do nothing instead of trying to fetch past the
end of the file. (A real fix would eliminate the race condition that
causes the second thread to get created in the first place.)
Bug: 5217390
Change-Id: Ib5b8f87398b4ed2cb3d7f09569e245b55a89da5a
|
|
|
|
|
| |
Bug: 4948913
Change-Id: I831b9149208f0cc007cf3ebede3ef433b2636600
|
|
|
|
|
|
|
|
|
|
|
| |
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
|