| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Android 8.1.0 release 43
* tag 'android-8.1.0_r43':
DO NOT MERGE: Update DownloadProvider for correct meteredness
Change-Id: Ia8bebaa361f2fd5a2a44eb4a6b9ff45b4593e6e5
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch updates DownloadProvider to use the fixed meteredness hidden
APIs for OC-MR1. This corrects a bug where DownloadProvider would fail
to allow downloads to proceed when VPNs are connected, but the
underlying networks are metered.
Bug: 78644887
Test: Flashed on Walleye and tested.
Change-Id: I13c1bd6d7ab26489923329bc7985060228e9bb29
(cherry picked from commit b627002ea9dc2511bad6ea5e68f4248f36c4a3eb)
|
|/
|
|
|
|
|
|
|
|
| |
Implement the following features:
- Manually pause/resume individual downloads in DownloadManager
- Manually pause/resume all downloads in notification
Based on commit ecd609e7017b8a69688bbae25c17d878ea305f19.
Change-Id: I433cdee2de8b3add0248bbb0a9d02f8da4e5bb38
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of reaching directly into PackageManager, use the new
StorageManager API to allocate disk space for downloads. This wraps
both clearing cached files and fallocate() into a single method.
Remove support for storing downloads on the /cache partition, which
doesn't exist on many devices.
Bug: 63057877
Test: bit DownloadProviderTests:*
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I5749f7a2f7ded9157fea763dc652bf4da88d86ff
|
|
|
|
|
|
|
|
|
|
| |
The OS now completely relies on NET_CAPABILITY_NOT_METERED to avoid
confusion and staleness.
Bug: 63391323
Test: builds, boots, Wi-Fi policy is upgraded
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: Iea83e0afd8cbd2be10d85b8a35c903047716b5b9
|
|
|
|
|
|
|
|
|
|
|
| |
Apps might end up confused if we tell them a download was completed
multiple times, so only send the broadcast exactly once when we
transition it into a "completed" state, either during an update() or
a delete() operation.
Test: verified single broadcast with test app
Bug: 31619480
Change-Id: I0b9139ea0e37f6d212b84314048692cd0c4f9cdf
|
|
|
|
|
|
| |
Change-Id: I0ac813875f73035c63d833294f85ee42306e8b95
Test: manual
BUG: 28791717
|
|
|
|
|
|
|
|
|
|
| |
When a download is deleted, we may not have an active thread, so
always send the broadcast from the provider. If an active thread
encounters a deleted download, skip sending the broadcast twice.
Change-Id: If8d5b99a1b7232bb64c6d11f22fdb4f5d6dbbfec
Test: none
Bug: 30883889
|
|
|
|
|
|
|
|
|
| |
When deciding to kick off a media scan of a newly-downloaded file,
use the latest values from InfoDelta, instead of stale values from
the last database read, which may lead us to skip the scan.
Bug: 29234780
Change-Id: I7ffbcdd1edb9965999b7f5f100f57a9c2933f3a5
|
|
|
|
|
|
|
|
|
|
| |
When a download is stopped due to a metered network, we should
reschedule the job just like any other network failure. If a
download requires an unmetered network, treat WAITING_FOR_NETWORK as
QUEUED_FOR_WIFI so we show a meaningful notification.
Bug: 29440531
Change-Id: I31e6535c575fd32e2982ef840ae501acf1db3927
|
|
|
|
|
| |
Bug:29505888
Change-Id: Ifc33fd75e44d1dbc5a4ce5caa8e1ff938b94623e
|
|
|
|
|
|
| |
BUG: 28743623
Change-Id: I314febe06e5516dfa69062da691e0189b051dac5
|
|
|
|
|
|
| |
BUG: 28521946
Change-Id: I32129977c121b610bdd1a780fd371baaff3ead4b
|
|
|
|
|
| |
BUG: 28521946
Change-Id: I31658e680e67da9e1a420a9749a67949cfe09689
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
BUG: 27481520
Change-Id: I84db23b62f60dadefc01ead78f13ed689943baad
|
|
|
|
|
| |
Bug: 27074270
Change-Id: I7145fcdf0c8af0f0c299ca491f01eaef6204e2cb
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
Now that PackageInstaller can read APKs from content:// Uris, we
don't need to make downloads world-readable. This is mostly just
cleanup, since our top-level private data directory is no longer
o+x, so other apps can't traverse in anyway.
Bug: 5464052
Change-Id: I45de6a40c28b85c64d5afbc13068fe3ae8341d93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|